1 <?php |
1 <?php |
2 /* |
2 /* |
3 Plugin Name: Duplicator |
3 Plugin Name: Duplicator |
4 Plugin URI: http://www.lifeinthegrid.com/duplicator/ |
4 Plugin URI: http://www.lifeinthegrid.com/duplicator/ |
5 Description: Create a full WordPress backup of your files and database with one click. Duplicate and move an entire site from one location to another in 3 easy steps. Create full snapshot of your site at any point in time. |
5 Description: Create a full WordPress backup of your files and database with one click. Duplicate and move an entire site from one location to another in 3 easy steps. Create full snapshot of your site at any point in time. |
6 Version: 0.3.2 |
6 Version: 0.4.1 |
7 Author: LifeInTheGrid |
7 Author: LifeInTheGrid |
8 Author URI: http://www.lifeinthegrid.com |
8 Author URI: http://www.lifeinthegrid.com |
9 License: GPLv2 or later |
9 License: GPLv2 or later |
10 */ |
10 */ |
11 |
11 |
12 /* ================================================================================ |
12 /* ================================================================================ |
13 Copyright 2011-2012 Cory Lamle |
13 Copyright 2011-2012 Cory Lamle |
14 Copyright 2011 Gaurav Aggarwal |
14 |
15 This program is free software; you can redistribute it and/or modify |
15 This program is free software; you can redistribute it and/or modify |
16 it under the terms of the GNU General Public License, version 2, as |
16 it under the terms of the GNU General Public License, version 2, as |
17 published by the Free Software Foundation. |
17 published by the Free Software Foundation. |
18 |
18 |
19 This program is distributed in the hope that it will be useful, |
19 This program is distributed in the hope that it will be useful, |
23 |
23 |
24 You should have received a copy of the GNU General Public License |
24 You should have received a copy of the GNU General Public License |
25 along with this program; if not, write to the Free Software |
25 along with this program; if not, write to the Free Software |
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
27 |
27 |
28 Contributors: |
28 SOURCE CONTRIBUTORS: |
29 Many thanks go out to Gaurav Aggarwal for starting the Backup and Move Plugin. |
29 Gaurav Aggarwal |
30 This project is a fork of that project see backup-and-move for more details. |
|
31 |
30 |
32 ================================================================================ */ |
31 ================================================================================ */ |
33 |
32 |
34 require_once("define.php"); |
33 require_once("define.php"); |
35 |
34 |
42 $GLOBALS['duplicator_opts']['dbhost'] = isset($GLOBALS['duplicator_opts']['dbhost']) ? $GLOBALS['duplicator_opts']['dbhost'] : ''; |
41 $GLOBALS['duplicator_opts']['dbhost'] = isset($GLOBALS['duplicator_opts']['dbhost']) ? $GLOBALS['duplicator_opts']['dbhost'] : ''; |
43 $GLOBALS['duplicator_opts']['dbname'] = isset($GLOBALS['duplicator_opts']['dbname']) ? $GLOBALS['duplicator_opts']['dbname'] : ''; |
42 $GLOBALS['duplicator_opts']['dbname'] = isset($GLOBALS['duplicator_opts']['dbname']) ? $GLOBALS['duplicator_opts']['dbname'] : ''; |
44 $GLOBALS['duplicator_opts']['dbuser'] = isset($GLOBALS['duplicator_opts']['dbuser']) ? $GLOBALS['duplicator_opts']['dbuser'] : ''; |
43 $GLOBALS['duplicator_opts']['dbuser'] = isset($GLOBALS['duplicator_opts']['dbuser']) ? $GLOBALS['duplicator_opts']['dbuser'] : ''; |
45 $GLOBALS['duplicator_opts']['dbiconv'] = isset($GLOBALS['duplicator_opts']['dbiconv']) ? $GLOBALS['duplicator_opts']['dbiconv'] : '1'; |
44 $GLOBALS['duplicator_opts']['dbiconv'] = isset($GLOBALS['duplicator_opts']['dbiconv']) ? $GLOBALS['duplicator_opts']['dbiconv'] : '1'; |
46 $GLOBALS['duplicator_opts']['dbadd_drop'] = isset($GLOBALS['duplicator_opts']['dbadd_drop']) ? $GLOBALS['duplicator_opts']['dbadd_drop'] : '0'; |
45 $GLOBALS['duplicator_opts']['dbadd_drop'] = isset($GLOBALS['duplicator_opts']['dbadd_drop']) ? $GLOBALS['duplicator_opts']['dbadd_drop'] : '0'; |
47 $GLOBALS['duplicator_opts']['nurl'] = isset($GLOBALS['duplicator_opts']['nurl'] ) ? $GLOBALS['duplicator_opts']['nurl'] : ''; |
46 $GLOBALS['duplicator_opts']['url_new'] = isset($GLOBALS['duplicator_opts']['url_new'] ) ? $GLOBALS['duplicator_opts']['url_new'] : ''; |
48 $GLOBALS['duplicator_opts']['email-me'] = isset($GLOBALS['duplicator_opts']['email-me']) ? $GLOBALS['duplicator_opts']['email-me'] : '0'; |
47 $GLOBALS['duplicator_opts']['email-me'] = isset($GLOBALS['duplicator_opts']['email-me']) ? $GLOBALS['duplicator_opts']['email-me'] : '0'; |
49 $GLOBALS['duplicator_opts']['log_level'] = isset($GLOBALS['duplicator_opts']['log_level']) ? $GLOBALS['duplicator_opts']['log_level'] : '0'; |
48 $GLOBALS['duplicator_opts']['log_level'] = isset($GLOBALS['duplicator_opts']['log_level']) ? $GLOBALS['duplicator_opts']['log_level'] : '0'; |
50 $GLOBALS['duplicator_opts']['max_time'] = is_numeric($GLOBALS['duplicator_opts']['max_time']) ? $GLOBALS['duplicator_opts']['max_time'] : 1000; |
|
51 $GLOBALS['duplicator_opts']['max_memory'] = isset($GLOBALS['duplicator_opts']['max_memory']) ? $GLOBALS['duplicator_opts']['max_memory'] : '1000M'; |
49 $GLOBALS['duplicator_opts']['max_memory'] = isset($GLOBALS['duplicator_opts']['max_memory']) ? $GLOBALS['duplicator_opts']['max_memory'] : '1000M'; |
52 $GLOBALS['duplicator_opts']['email_others'] = isset($GLOBALS['duplicator_opts']['email_others']) ? $GLOBALS['duplicator_opts']['email_others'] : ''; |
50 $GLOBALS['duplicator_opts']['email_others'] = isset($GLOBALS['duplicator_opts']['email_others']) ? $GLOBALS['duplicator_opts']['email_others'] : ''; |
53 $GLOBALS['duplicator_opts']['skip_ext'] = isset($GLOBALS['duplicator_opts']['skip_ext']) ? $GLOBALS['duplicator_opts']['skip_ext'] : ''; |
51 $GLOBALS['duplicator_opts']['skip_ext'] = isset($GLOBALS['duplicator_opts']['skip_ext']) ? $GLOBALS['duplicator_opts']['skip_ext'] : ''; |
54 $GLOBALS['duplicator_opts']['dir_bypass'] = isset($GLOBALS['duplicator_opts']['dir_bypass']) ? $GLOBALS['duplicator_opts']['dir_bypass'] : ''; |
52 $GLOBALS['duplicator_opts']['dir_bypass'] = isset($GLOBALS['duplicator_opts']['dir_bypass']) ? $GLOBALS['duplicator_opts']['dir_bypass'] : ''; |
55 $GLOBALS['duplicator_opts']['rm_snapshot'] = isset($GLOBALS['duplicator_opts']['rm_snapshot']) ? $GLOBALS['duplicator_opts']['rm_snapshot'] : '1'; |
53 $GLOBALS['duplicator_opts']['rm_snapshot'] = isset($GLOBALS['duplicator_opts']['rm_snapshot']) ? $GLOBALS['duplicator_opts']['rm_snapshot'] : '1'; |
|
54 //max_time needs to be numeric |
|
55 if (isset($GLOBALS['duplicator_opts']['max_time'])) { |
|
56 $GLOBALS['duplicator_opts']['max_time'] = is_numeric($GLOBALS['duplicator_opts']['max_time']) ? $GLOBALS['duplicator_opts']['max_time'] : 1000; |
|
57 } else { |
|
58 $GLOBALS['duplicator_opts']['max_time'] = 1000; |
|
59 } |
56 |
60 |
57 //Default Arrays |
61 //Default Arrays |
58 $GLOBALS['duplicator_bypass-array'] = explode(";", $GLOBALS['duplicator_opts']['dir_bypass'], -1); |
62 $GLOBALS['duplicator_bypass-array'] = explode(";", $GLOBALS['duplicator_opts']['dir_bypass'], -1); |
59 $GLOBALS['duplicator_bypass-array'] = count($GLOBALS['duplicator_bypass-array']) ? $GLOBALS['duplicator_bypass-array'] : null; |
63 $GLOBALS['duplicator_bypass-array'] = count($GLOBALS['duplicator_bypass-array']) ? $GLOBALS['duplicator_bypass-array'] : null; |
60 $GLOBALS['duplicator_skip_ext-array'] = explode(";", $GLOBALS['duplicator_opts']['skip_ext']) ? explode(";", $GLOBALS['duplicator_opts']['skip_ext']) : array(); |
64 $GLOBALS['duplicator_skip_ext-array'] = explode(";", $GLOBALS['duplicator_opts']['skip_ext']) ? explode(";", $GLOBALS['duplicator_opts']['skip_ext']) : array(); |
86 |
90 |
87 $duplicator_opts = array( |
91 $duplicator_opts = array( |
88 'dbhost' =>'localhost', |
92 'dbhost' =>'localhost', |
89 'dbname' =>'', |
93 'dbname' =>'', |
90 'dbuser' =>'', |
94 'dbuser' =>'', |
91 'nurl' =>'', |
95 'url_new' =>'', |
92 'email-me' =>"{$GLOBALS['duplicator_opts']['email-me']}", |
96 'email-me' =>"{$GLOBALS['duplicator_opts']['email-me']}", |
93 'email_others' =>"{$GLOBALS['duplicator_opts']['email_others']}", |
97 'email_others' =>"{$GLOBALS['duplicator_opts']['email_others']}", |
94 'max_time' =>$GLOBALS['duplicator_opts']['max_time'], |
98 'max_time' =>$GLOBALS['duplicator_opts']['max_time'], |
95 'max_memory' =>$GLOBALS['duplicator_opts']['max_memory'], |
99 'max_memory' =>$GLOBALS['duplicator_opts']['max_memory'], |
96 'dir_bypass' =>"{$GLOBALS['duplicator_opts']['dir_bypass']}", |
100 'dir_bypass' =>"{$GLOBALS['duplicator_opts']['dir_bypass']}", |
197 } |
201 } |
198 return $links; |
202 return $links; |
199 } |
203 } |
200 |
204 |
201 //HOOKS & ACTIONS |
205 //HOOKS & ACTIONS |
202 load_plugin_textdomain('wpduplicator' , FALSE, basename( dirname( __FILE__ ) ) . '/lang/' ); |
206 load_plugin_textdomain('wpduplicator' , FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang/'); |
203 register_activation_hook(__FILE__ , 'duplicator_activate'); |
207 register_activation_hook(__FILE__ , 'duplicator_activate'); |
204 register_deactivation_hook(__FILE__ , 'duplicator_deactivate'); |
208 register_deactivation_hook(__FILE__ , 'duplicator_deactivate'); |
205 register_uninstall_hook(__FILE__ , 'duplicator_uninstall'); |
209 register_uninstall_hook(__FILE__ , 'duplicator_uninstall'); |
206 |
210 |
207 add_action('plugins_loaded', 'duplicator_update'); |
211 add_action('plugins_loaded', 'duplicator_update'); |
219 /** |
223 /** |
220 * DUPLICATOR_INIT |
224 * DUPLICATOR_INIT |
221 * Init routines */ |
225 * Init routines */ |
222 function duplicator_init() { |
226 function duplicator_init() { |
223 /* Register our stylesheet. */ |
227 /* Register our stylesheet. */ |
224 wp_register_style('jquery-ui', DUPLICATOR_PLUGIN_URL . 'css/jquery-ui.css', null , "1.8.21" ); |
228 wp_register_style('jquery-ui', DUPLICATOR_PLUGIN_URL . 'css/jquery-ui.css', null , "1.9.2" ); |
225 wp_register_style('duplicator_style', DUPLICATOR_PLUGIN_URL . 'css/style.css' ); |
229 wp_register_style('duplicator_style', DUPLICATOR_PLUGIN_URL . 'css/style.css' ); |
226 } |
230 } |
227 |
231 |
228 /** |
232 /** |
229 * DUPLICATOR_VIEWS |
233 * DUPLICATOR_VIEWS |
256 add_action('admin_print_styles-' . $page_about, 'duplicator_styles' ); |
260 add_action('admin_print_styles-' . $page_about, 'duplicator_styles' ); |
257 add_action('admin_print_styles-' . $page_support, 'duplicator_styles' ); |
261 add_action('admin_print_styles-' . $page_support, 'duplicator_styles' ); |
258 } |
262 } |
259 |
263 |
260 /** |
264 /** |
261 * DUPLICATOR_SCRIPTS |
265 * DUPLICATOR_SCRIPTS |
262 * Loads the required javascript libs only for this plugin */ |
266 * Loads the required javascript libs only for this plugin */ |
263 function duplicator_scripts() { |
267 function duplicator_scripts() { |
264 wp_enqueue_script("jquery-ui", DUPLICATOR_PLUGIN_URL . "js/jquery-ui.min.js", array( 'jquery' ), "1.8.21"); |
268 wp_enqueue_script('jquery'); |
|
269 wp_enqueue_script('jquery-ui-core'); |
|
270 wp_enqueue_script('jquery-ui-dialog'); |
|
271 wp_enqueue_script('jquery-ui-button'); |
|
272 wp_enqueue_script('jquery-ui-tabs'); |
265 } |
273 } |
266 |
274 |
267 /** |
275 /** |
268 * DUPLICATOR_STYLES |
276 * DUPLICATOR_STYLES |
269 * Loads the required css links only for this plugin */ |
277 * Loads the required css links only for this plugin */ |