XPressME Integration Kit

Trac

source: trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/update_xpress.php @ 704

Last change on this file since 704 was 704, checked in by toemon, 14 years ago

Fix ftp connection Err.
edit language

File size: 2.1 KB
Line 
1<?php
2/**
3 * XPressME Integration Kit upgrade functionality.
4 */
5
6/**
7 * Stores files to be deleted.
8 */
9global $_old_xpress_files;
10
11$_old_xpress_files = array(
12// 2.03
13'wp-content/themes/xpress_default/images/titleline.jpg',
14'wp-content/themes/xpress_default/ja.mo',
15'wp-content/themes/xpress_default/ja.po',
16// 2.3.0
17'wp-content/themes/xpress_default/ja_EUC.mo',
18'wp-content/themes/xpress_default/ja_EUC.po',
19'wp-content/themes/xpress_default/ja_UTF.mo',
20'wp-content/themes/xpress_default/ja_UTF.po',
21);
22
23/**
24 * Upgrade the XPressME .
25 *
26 * @param string $from New release unzipped path.
27 * @param string $to Path to old WordPress installation.
28 * @return WP_Error|null WP_Error on failure, null on success.
29 */
30function update_xpress($from, $to) {
31        global $wp_filesystem, $_old_xpress_files, $wpdb;
32        show_message( __('Disable overwrite of wp-config.php...', 'xpressme') );
33        // remove wp-config.php from the new version into place.
34        $wp_config = $from . 'wp-config.php';
35        if ( !$wp_filesystem->delete($wp_config, true)){
36                return new WP_Error('delete_failed', $this->strings['delete_failed']);
37        }
38
39        // Copy new versions of XPressME Integration Kit files into place.
40        show_message( __('Copy new versions of XPressME Integration Kit files into place...', 'xpressme') );
41        $result = copy_dir($from . $distro, $to);
42        if ( is_wp_error($result) ) {
43                $wp_filesystem->delete($maintenance_file);
44                $wp_filesystem->delete($from, true);
45                return $result;
46        }
47
48        // Remove old files
49        show_message( __('Remove an unnecessary, old file...', 'xpressme') );
50        foreach ( $_old_xpress_files as $old_file ) {
51                $old_file = $to . $old_file;
52                if ( !$wp_filesystem->exists($old_file) )
53                        continue;
54                $wp_filesystem->delete($old_file, true);
55        }
56        show_message( __('Set templates directory chmod 777', 'xpressme') );
57        $wp_filesystem->chmod($to . 'templates/', 0777);
58
59        // Remove working directory
60        $working_dir = dirname(dirname($from));
61        show_message( sprintf(__('Remove working directory(%s)...', 'xpressme'),$working_dir) );
62        $wp_filesystem->delete($working_dir, true);
63
64}
65
66?>
Note: See TracBrowser for help on using the repository browser.