Duplicator – WordPress Migration Plugin - Version 0.5.12

Version Description

Download this release

Release Info

Developer cory@lamle.org
Plugin Icon 128x128 Duplicator – WordPress Migration Plugin
Version 0.5.12
Comparing to
See all releases

Code changes from version 0.5.10 to 0.5.12

classes/logging.php CHANGED
@@ -32,9 +32,15 @@ class DUP_Log {
32
  /**
33
  * General information logging
34
  * @param string $msg The message to log
 
 
 
 
35
  */
36
  static public function Info($msg) {
37
  @fwrite(self::$logFileHandle, "{$msg} \n");
 
 
38
  }
39
 
40
  /**
@@ -47,7 +53,7 @@ class DUP_Log {
47
  $source = self::getStack(debug_backtrace());
48
 
49
  $err_msg = "\n==================================================================================\n";
50
- $err_msg .= "!!!DUPLICATOR ERROR!!!\n";
51
  $err_msg .= "Please Try Again! If the error persists please see the Duplicator 'Support' link.\n";
52
  $err_msg .= "---------------------------------------------------------------------------------\n";
53
  $err_msg .= "MESSAGE:\n{$msg}\n";
32
  /**
33
  * General information logging
34
  * @param string $msg The message to log
35
+ *
36
+ * REPLACE TO DEBUG: Memory consuption as script runs
37
+ * $results = DUP_Util::ByteSize(memory_get_peak_usage(true)) . "\t" . $msg;
38
+ * @fwrite(self::$logFileHandle, "{$results} \n");
39
  */
40
  static public function Info($msg) {
41
  @fwrite(self::$logFileHandle, "{$msg} \n");
42
+ //$results = DUP_Util::ByteSize(memory_get_usage(true)) . "\t" . $msg;
43
+ //@fwrite(self::$logFileHandle, "{$results} \n");
44
  }
45
 
46
  /**
53
  $source = self::getStack(debug_backtrace());
54
 
55
  $err_msg = "\n==================================================================================\n";
56
+ $err_msg .= "!!DUPLICATOR ERROR!!\n";
57
  $err_msg .= "Please Try Again! If the error persists please see the Duplicator 'Support' link.\n";
58
  $err_msg .= "---------------------------------------------------------------------------------\n";
59
  $err_msg .= "MESSAGE:\n{$msg}\n";
classes/package.archive.php CHANGED
@@ -131,6 +131,7 @@ class DUP_Archive {
131
  || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $name)
132
  || trim($name) == ""
133
  || (strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.');
 
134
  if ($invalid_test) {
135
  $this->WarnFileName[] = $val;
136
  $this->OmitDirs[] = $val;
131
  || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $name)
132
  || trim($name) == ""
133
  || (strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.');
134
+
135
  if ($invalid_test) {
136
  $this->WarnFileName[] = $val;
137
  $this->OmitDirs[] = $val;
classes/package.archive.zip.php CHANGED
@@ -128,10 +128,12 @@ class DUP_Zip extends DUP_Archive {
128
 
129
  $timerAllEnd = DUP_Util::GetMicrotime();
130
  $timerAllSum = DUP_Util::ElapsedTime($timerAllEnd, $timerAllStart);
 
131
 
132
  self::$zipFileSize = @filesize(self::$zipPath);
133
  DUP_Log::Info("COMPRESSED SIZE: " . DUP_Util::ByteSize(self::$zipFileSize));
134
  DUP_Log::Info("ARCHIVE RUNTIME: {$timerAllSum}");
 
135
  }
136
  catch (Exception $e) {
137
  DUP_Log::Error("Runtime error in package.archive.zip.php constructor.", "Exception: {$e}");
128
 
129
  $timerAllEnd = DUP_Util::GetMicrotime();
130
  $timerAllSum = DUP_Util::ElapsedTime($timerAllEnd, $timerAllStart);
131
+
132
 
133
  self::$zipFileSize = @filesize(self::$zipPath);
134
  DUP_Log::Info("COMPRESSED SIZE: " . DUP_Util::ByteSize(self::$zipFileSize));
135
  DUP_Log::Info("ARCHIVE RUNTIME: {$timerAllSum}");
136
+ DUP_Log::Info("MEMORY STACK: " . DUP_Server::GetPHPMemory());
137
  }
138
  catch (Exception $e) {
139
  DUP_Log::Error("Runtime error in package.archive.zip.php constructor.", "Exception: {$e}");
classes/package.database.php CHANGED
@@ -37,6 +37,8 @@ class DUP_Database {
37
  $this->Package->SetStatus(DUP_PackageStatus::DBSTART);
38
 
39
  $package_mysqldump = DUP_Settings::Get('package_mysqldump');
 
 
40
  $this->dbStorePath = "{$this->Package->StorePath}/{$this->File}";
41
  $mysqlDumpPath = self::GetMySqlDumpPath();
42
  $mode = ($mysqlDumpPath && $package_mysqldump) ? 'MYSQLDUMP' : 'PHP';
@@ -45,10 +47,12 @@ class DUP_Database {
45
  $log = "\n********************************************************************************\n";
46
  $log .= "DATABASE:\n";
47
  $log .= "********************************************************************************\n";
48
- $log .= "BUILD MODE: {$mode}\n";
 
49
  $log .= "MYSQLDUMP: {$mysqlDumpSupport}\n";
50
  $log .= "MYSQLTIMEOUT: " . DUPLICATOR_DB_MAX_TIME;
51
  DUP_Log::Info($log);
 
52
 
53
  switch ($mode) {
54
  case 'MYSQLDUMP': $this->mysqlDump($mysqlDumpPath); break;
@@ -64,8 +68,9 @@ class DUP_Database {
64
  DUP_Log::Error("SQL file generated zero bytes.", "No data was written to the sql file. Check permission on file and parent directory at [{$this->dbStorePath}]");
65
  }
66
  DUP_Log::Info("SQL FILE SIZE: " . DUP_Util::ByteSize($sql_file_size));
 
67
  DUP_Log::Info("SQL RUNTIME: {$time_sum}");
68
-
69
  $this->Size = @filesize($this->dbStorePath);
70
  $this->Package->SetStatus(DUP_PackageStatus::DBDONE);
71
 
@@ -83,8 +88,7 @@ class DUP_Database {
83
  $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
84
  $tblCount = 0;
85
 
86
- $sql = "SHOW TABLE STATUS";
87
- $tables = $wpdb->get_results($sql, ARRAY_A);
88
  $info = array();
89
  $info['Status']['Success'] = is_null($tables) ? false : true;
90
  $info['Status']['Size'] = 'Good';
@@ -183,8 +187,6 @@ class DUP_Database {
183
  }
184
 
185
 
186
-
187
-
188
  private function mysqlDump($exePath) {
189
 
190
  global $wpdb;
@@ -238,14 +240,15 @@ class DUP_Database {
238
  DUP_Log::Info("TABLES: total:{$tblAllCount} | filtered:{$tblFilterCount} | create:{$tblCreateCount}");
239
  DUP_Log::Info("FILTERED: [{$this->FilterTables}]");
240
  DUP_Log::Info("RESPONSE: {$output}");
241
-
242
- $sql_footer = "/* " . DUPLICATOR_DB_EOF_MARKER . " */\n\n";
 
243
  file_put_contents($this->dbStorePath, $sql_footer, FILE_APPEND);
244
-
245
  return ($output) ? false : true;
246
  }
247
 
248
- //TODO: esc_sql is a wrapper around mysqli_real_escape_string
249
  private function phpDump() {
250
 
251
  global $wpdb;
@@ -254,9 +257,10 @@ class DUP_Database {
254
  $handle = fopen($this->dbStorePath, 'w+');
255
  $tables = $wpdb->get_col('SHOW TABLES');
256
 
257
- $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
258
  $tblAllCount = count($tables);
259
  $tblFilterOn = ($this->FilterOn) ? 'ON' : 'OFF';
 
260
 
261
  if (is_array($filterTables) && $this->FilterOn) {
262
  foreach ($tables as $key => $val) {
@@ -271,9 +275,9 @@ class DUP_Database {
271
  DUP_Log::Info("TABLES: total:{$tblAllCount} | filtered:{$tblFilterCount} | create:{$tblCreateCount}");
272
  DUP_Log::Info("FILTERED: [{$this->FilterTables}]");
273
 
274
- $sql_header = "/* DUPLICATOR MYSQL SCRIPT CREATED ON : " . @date("F j, Y, g:i a") . " */\n\n";
275
  $sql_header .= "SET FOREIGN_KEY_CHECKS = 0;\n\n";
276
- @fwrite($handle, $sql_header);
277
 
278
  //BUILD CREATES:
279
  //All creates must be created before inserts do to foreign key constraints
@@ -289,22 +293,22 @@ class DUP_Database {
289
  foreach ($tables as $table) {
290
 
291
  $row_count = $wpdb->get_var("SELECT Count(*) FROM `{$table}`");
292
- DUP_Log::Info("{$table} ({$row_count})");
293
 
294
- if ($row_count > 100) {
295
- $row_count = ceil($row_count / 100);
296
  } else if ($row_count > 0) {
297
  $row_count = 1;
298
  }
299
 
300
  if ($row_count >= 1) {
301
- @fwrite($handle, "\n/* INSERT TABLE DATA: {$table} */\n");
302
  }
303
 
304
  for ($i = 0; $i < $row_count; $i++) {
305
  $sql = "";
306
- $limit = $i * 100;
307
- $query = "SELECT * FROM `{$table}` LIMIT {$limit}, 100";
308
  $rows = $wpdb->get_results($query, ARRAY_A);
309
  if (is_array($rows)) {
310
  foreach ($rows as $row) {
@@ -323,22 +327,24 @@ class DUP_Database {
323
  }
324
  $sql .= ");\n";
325
  }
326
- @fwrite($handle, $sql);
327
- if ($this->networkFlush) {
328
- DUP_Util::FcgiFlush();
329
- }
330
  }
331
  }
 
 
 
 
 
 
 
332
  }
333
- unset($sql);
334
  $sql_footer = "\nSET FOREIGN_KEY_CHECKS = 1; \n\n";
335
- $sql_footer .= "/* DUPLICATOR MYSQL SCRIPT END ON : " . @date("F j, Y, g:i a") . " */\n\n";
336
- $sql_footer .= "/* " . DUPLICATOR_DB_EOF_MARKER . " */\n\n";
337
- @fwrite($handle, $sql_footer);
338
  $wpdb->flush();
339
  fclose($handle);
340
  }
341
-
342
-
343
  }
344
  ?>
37
  $this->Package->SetStatus(DUP_PackageStatus::DBSTART);
38
 
39
  $package_mysqldump = DUP_Settings::Get('package_mysqldump');
40
+ $package_phpdump_qrylimit = DUP_Settings::Get('package_phpdump_qrylimit');
41
+
42
  $this->dbStorePath = "{$this->Package->StorePath}/{$this->File}";
43
  $mysqlDumpPath = self::GetMySqlDumpPath();
44
  $mode = ($mysqlDumpPath && $package_mysqldump) ? 'MYSQLDUMP' : 'PHP';
47
  $log = "\n********************************************************************************\n";
48
  $log .= "DATABASE:\n";
49
  $log .= "********************************************************************************\n";
50
+ $log .= "BUILD MODE: {$mode} ";
51
+ $log .= ($mode == 'PHP') ? "(query limit - {$package_phpdump_qrylimit})\n" : "\n";
52
  $log .= "MYSQLDUMP: {$mysqlDumpSupport}\n";
53
  $log .= "MYSQLTIMEOUT: " . DUPLICATOR_DB_MAX_TIME;
54
  DUP_Log::Info($log);
55
+ $log = null;
56
 
57
  switch ($mode) {
58
  case 'MYSQLDUMP': $this->mysqlDump($mysqlDumpPath); break;
68
  DUP_Log::Error("SQL file generated zero bytes.", "No data was written to the sql file. Check permission on file and parent directory at [{$this->dbStorePath}]");
69
  }
70
  DUP_Log::Info("SQL FILE SIZE: " . DUP_Util::ByteSize($sql_file_size));
71
+ DUP_Log::Info("SQL FILE TIME: " . date("Y-m-d H:i:s"));
72
  DUP_Log::Info("SQL RUNTIME: {$time_sum}");
73
+
74
  $this->Size = @filesize($this->dbStorePath);
75
  $this->Package->SetStatus(DUP_PackageStatus::DBDONE);
76
 
88
  $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
89
  $tblCount = 0;
90
 
91
+ $tables = $wpdb->get_results("SHOW TABLE STATUS", ARRAY_A);
 
92
  $info = array();
93
  $info['Status']['Success'] = is_null($tables) ? false : true;
94
  $info['Status']['Size'] = 'Good';
187
  }
188
 
189
 
 
 
190
  private function mysqlDump($exePath) {
191
 
192
  global $wpdb;
240
  DUP_Log::Info("TABLES: total:{$tblAllCount} | filtered:{$tblFilterCount} | create:{$tblCreateCount}");
241
  DUP_Log::Info("FILTERED: [{$this->FilterTables}]");
242
  DUP_Log::Info("RESPONSE: {$output}");
243
+
244
+ $sql_footer = "\n\n/* Duplicator WordPress Timestamp: " . date("Y-m-d H:i:s") . "*/\n";
245
+ $sql_footer .= "/* " . DUPLICATOR_DB_EOF_MARKER . " */\n";
246
  file_put_contents($this->dbStorePath, $sql_footer, FILE_APPEND);
247
+
248
  return ($output) ? false : true;
249
  }
250
 
251
+
252
  private function phpDump() {
253
 
254
  global $wpdb;
257
  $handle = fopen($this->dbStorePath, 'w+');
258
  $tables = $wpdb->get_col('SHOW TABLES');
259
 
260
+ $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
261
  $tblAllCount = count($tables);
262
  $tblFilterOn = ($this->FilterOn) ? 'ON' : 'OFF';
263
+ $qryLimit = DUP_Settings::Get('package_phpdump_qrylimit');
264
 
265
  if (is_array($filterTables) && $this->FilterOn) {
266
  foreach ($tables as $key => $val) {
275
  DUP_Log::Info("TABLES: total:{$tblAllCount} | filtered:{$tblFilterCount} | create:{$tblCreateCount}");
276
  DUP_Log::Info("FILTERED: [{$this->FilterTables}]");
277
 
278
+ $sql_header = "/* DUPLICATOR MYSQL SCRIPT CREATED ON : " . @date("Y-m-d H:i:s") . " */\n\n";
279
  $sql_header .= "SET FOREIGN_KEY_CHECKS = 0;\n\n";
280
+ fwrite($handle, $sql_header);
281
 
282
  //BUILD CREATES:
283
  //All creates must be created before inserts do to foreign key constraints
293
  foreach ($tables as $table) {
294
 
295
  $row_count = $wpdb->get_var("SELECT Count(*) FROM `{$table}`");
296
+ //DUP_Log::Info("{$table} ({$row_count})");
297
 
298
+ if ($row_count > $qryLimit) {
299
+ $row_count = ceil($row_count / $qryLimit);
300
  } else if ($row_count > 0) {
301
  $row_count = 1;
302
  }
303
 
304
  if ($row_count >= 1) {
305
+ fwrite($handle, "\n/* INSERT TABLE DATA: {$table} */\n");
306
  }
307
 
308
  for ($i = 0; $i < $row_count; $i++) {
309
  $sql = "";
310
+ $limit = $i * $qryLimit;
311
+ $query = "SELECT * FROM `{$table}` LIMIT {$limit}, {$qryLimit}";
312
  $rows = $wpdb->get_results($query, ARRAY_A);
313
  if (is_array($rows)) {
314
  foreach ($rows as $row) {
327
  }
328
  $sql .= ");\n";
329
  }
330
+ fwrite($handle, $sql);
 
 
 
331
  }
332
  }
333
+
334
+ //Flush buffer if enabled
335
+ if ($this->networkFlush) {
336
+ DUP_Util::FcgiFlush();
337
+ }
338
+ $sql = null;
339
+ $rows = null;
340
  }
341
+
342
  $sql_footer = "\nSET FOREIGN_KEY_CHECKS = 1; \n\n";
343
+ $sql_footer .= "/* Duplicator WordPress Timestamp: " . date("Y-m-d H:i:s") . "*/\n";
344
+ $sql_footer .= "/* " . DUPLICATOR_DB_EOF_MARKER . " */\n";
345
+ fwrite($handle, $sql_footer);
346
  $wpdb->flush();
347
  fclose($handle);
348
  }
 
 
349
  }
350
  ?>
classes/package.installer.php CHANGED
@@ -120,8 +120,6 @@ class DUP_Installer {
120
  DUP_Log::Info("Preping for use");
121
  $installer = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP) . "/{$this->Package->NameHash}_installer.php";
122
 
123
- //$tablePrefix = (is_multisite()) ? $wpdb->get_blog_prefix() : $wpdb->prefix;
124
-
125
  //Option values to delete at install time
126
  $deleteOpts = $GLOBALS['DUPLICATOR_OPTS_DELETE'];
127
 
120
  DUP_Log::Info("Preping for use");
121
  $installer = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP) . "/{$this->Package->NameHash}_installer.php";
122
 
 
 
123
  //Option values to delete at install time
124
  $deleteOpts = $GLOBALS['DUPLICATOR_OPTS_DELETE'];
125
 
classes/package.php CHANGED
@@ -151,9 +151,10 @@ class DUP_Package {
151
  $info .= "PHP INFO:\t" . phpversion() . ' | ' . 'SAPI: ' . php_sapi_name() . "\n";
152
  $info .= "SERVER:\t\t{$_SERVER['SERVER_SOFTWARE']} \n";
153
  $info .= "PHP TIME LIMIT: {$php_max_time} \n";
154
- $info .= "PHP MAX MEMORY: {$php_max_memory}";
 
155
  DUP_Log::Info($info);
156
- unset($info);
157
 
158
  //CREATE DB RECORD
159
  $packageObj = serialize($this);
@@ -196,17 +197,18 @@ class DUP_Package {
196
  $dbSizeRead = DUP_Util::ByteSize($this->Database->Size);
197
  $zipSizeRead = DUP_Util::ByteSize($this->Archive->Size);
198
  $exeSizeRead = DUP_Util::ByteSize($this->Installer->Size);
 
199
  DUP_Log::Info("SQL File: {$dbSizeRead}");
200
  DUP_Log::Info("Installer File: {$exeSizeRead}");
201
  DUP_Log::Info("Archive File: {$zipSizeRead} ");
202
-
203
  if ( !($this->Archive->Size && $this->Database->Size && $this->Installer->Size)) {
204
  DUP_Log::Error("A required file contains zero bytes.", "Archive Size: {$zipSizeRead} | SQL Size: {$dbSizeRead} | Installer Size: {$exeSizeRead}");
205
  }
206
 
207
  //Validate SQL files completed
208
  $sql_tmp_path = DUP_UTIL::SafePath(DUPLICATOR_SSDIR_PATH_TMP . '/'. $this->Database->File);
209
- $sql_complete_txt = DUP_Util::TailFile($sql_tmp_path, 5);
210
  if (! strstr($sql_complete_txt, 'DUPLICATOR_MYSQLDUMP_EOF')) {
211
  DUP_Log::Error("ERROR: SQL file not complete. The end of file marker was not found. Please try to re-create the package.");
212
  }
@@ -224,6 +226,7 @@ class DUP_Package {
224
  $info = "\n********************************************************************************\n";
225
  $info .= "RECORD ID:[{$this->ID}]\n";
226
  $info .= "TOTAL PROCESS RUNTIME: {$timerSum}\n";
 
227
  $info .= "DONE PROCESSING => {$this->Name} " . @date("Y-m-d H:i:s") . "\n";
228
 
229
  DUP_Log::Info($info);
@@ -423,11 +426,11 @@ class DUP_Package {
423
  }
424
  }
425
 
426
-
427
  private function parseDirectoryFilter($dirs = "") {
428
- $dirs = str_replace(array('.', ' ', "\n", "\t", "\r"), '', $dirs);
429
  $filter_dirs = "";
430
- foreach (explode(";", $dirs) as $val) {
 
431
  if (strlen($val) >= 2) {
432
  $filter_dirs .= DUP_Util::SafePath(trim(rtrim($val, "/\\"))) . ";";
433
  }
151
  $info .= "PHP INFO:\t" . phpversion() . ' | ' . 'SAPI: ' . php_sapi_name() . "\n";
152
  $info .= "SERVER:\t\t{$_SERVER['SERVER_SOFTWARE']} \n";
153
  $info .= "PHP TIME LIMIT: {$php_max_time} \n";
154
+ $info .= "PHP MAX MEMORY: {$php_max_memory} \n";
155
+ $info .= "MEMORY STACK: " . DUP_Server::GetPHPMemory();
156
  DUP_Log::Info($info);
157
+ $info = null;
158
 
159
  //CREATE DB RECORD
160
  $packageObj = serialize($this);
197
  $dbSizeRead = DUP_Util::ByteSize($this->Database->Size);
198
  $zipSizeRead = DUP_Util::ByteSize($this->Archive->Size);
199
  $exeSizeRead = DUP_Util::ByteSize($this->Installer->Size);
200
+
201
  DUP_Log::Info("SQL File: {$dbSizeRead}");
202
  DUP_Log::Info("Installer File: {$exeSizeRead}");
203
  DUP_Log::Info("Archive File: {$zipSizeRead} ");
204
+
205
  if ( !($this->Archive->Size && $this->Database->Size && $this->Installer->Size)) {
206
  DUP_Log::Error("A required file contains zero bytes.", "Archive Size: {$zipSizeRead} | SQL Size: {$dbSizeRead} | Installer Size: {$exeSizeRead}");
207
  }
208
 
209
  //Validate SQL files completed
210
  $sql_tmp_path = DUP_UTIL::SafePath(DUPLICATOR_SSDIR_PATH_TMP . '/'. $this->Database->File);
211
+ $sql_complete_txt = DUP_Util::TailFile($sql_tmp_path, 3);
212
  if (! strstr($sql_complete_txt, 'DUPLICATOR_MYSQLDUMP_EOF')) {
213
  DUP_Log::Error("ERROR: SQL file not complete. The end of file marker was not found. Please try to re-create the package.");
214
  }
226
  $info = "\n********************************************************************************\n";
227
  $info .= "RECORD ID:[{$this->ID}]\n";
228
  $info .= "TOTAL PROCESS RUNTIME: {$timerSum}\n";
229
+ $info .= "PEAK PHP MEMORY USED: " . DUP_Server::GetPHPMemory(true) . "\n";
230
  $info .= "DONE PROCESSING => {$this->Name} " . @date("Y-m-d H:i:s") . "\n";
231
 
232
  DUP_Log::Info($info);
426
  }
427
  }
428
 
 
429
  private function parseDirectoryFilter($dirs = "") {
430
+ $dirs = str_replace(array("\n", "\t", "\r"), '', $dirs);
431
  $filter_dirs = "";
432
+ $dir_array = array_unique(explode(";", $dirs));
433
+ foreach ($dir_array as $val) {
434
  if (strlen($val) >= 2) {
435
  $filter_dirs .= DUP_Util::SafePath(trim(rtrim($val, "/\\"))) . ";";
436
  }
classes/server.php CHANGED
@@ -112,7 +112,6 @@ class DUP_Server {
112
  return ($phpFile || $sqlFile || $logFile);
113
  }
114
 
115
-
116
  /**
117
  * Get the IP of a client machine
118
  * @return string IP of the client machine
@@ -130,5 +129,26 @@ class DUP_Server {
130
  return '';
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
  ?>
112
  return ($phpFile || $sqlFile || $logFile);
113
  }
114
 
 
115
  /**
116
  * Get the IP of a client machine
117
  * @return string IP of the client machine
129
  return '';
130
  }
131
 
132
+ /**
133
+ * Get PHP memory useage
134
+ * @return string Returns human readable memory useage.
135
+ */
136
+ public static function GetPHPMemory($peak = false) {
137
+
138
+ if ($peak) {
139
+ $result = 'Unable to read PHP peak memory usage';
140
+ if (function_exists('memory_get_peak_usage')) {
141
+ $result = DUP_Util::ByteSize(memory_get_peak_usage(true));
142
+ }
143
+ } else {
144
+ $result = 'Unable to read PHP memory usage';
145
+ if (function_exists('memory_get_usage')) {
146
+ $result = DUP_Util::ByteSize(memory_get_usage(true));
147
+ }
148
+ }
149
+
150
+ return $result;
151
+ }
152
+
153
  }
154
  ?>
classes/settings.php CHANGED
@@ -28,7 +28,16 @@ class DUP_Settings
28
  * @return The value stored in the key returns null if key does not exist
29
  */
30
  public static function Get($key = '') {
31
- return isset(self::$Data[$key]) ? self::$Data[$key] : null;
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
  /**
@@ -66,36 +75,9 @@ class DUP_Settings
66
  * @return True if option value has changed, false if not or if update failed.
67
  */
68
  public static function SetDefaults() {
69
- $default = array();
70
- $default['version'] = self::$Version;
71
-
72
- //Flag used to remove the wp_options value duplicator_settings which are all the settings in this class
73
- $default['uninstall_settings'] = isset(self::$Data['uninstall_settings']) ? self::$Data['uninstall_settings'] : true;
74
-
75
- //Flag used to remove entire wp-snapshot directory
76
- $default['uninstall_files'] = isset(self::$Data['uninstall_files']) ? self::$Data['uninstall_files'] : true;
77
-
78
- //Flag used to remove all tables
79
- $default['uninstall_tables'] = isset(self::$Data['uninstall_tables']) ? self::$Data['uninstall_tables'] : true;
80
-
81
- //Flag used to show debug info
82
- $default['package_debug'] = isset(self::$Data['package_debug']) ? self::$Data['package_debug'] : false;
83
-
84
- //Flag used to enable mysqldump
85
- $default['package_mysqldump'] = isset(self::$Data['package_mysqldump']) ? self::$Data['package_mysqldump'] : false;
86
-
87
- //Optional mysqldump search path
88
- $default['package_mysqldump_path'] = isset(self::$Data['package_mysqldump_path']) ? self::$Data['package_mysqldump_path'] : '';
89
-
90
- //Optional mysqldump search path
91
- $default['package_zip_flush'] = isset(self::$Data['package_zip_flush']) ? self::$Data['package_zip_flush'] : false;
92
-
93
- //Flag for .htaccess file
94
- $default['storage_htaccess_off'] = isset(self::$Data['storage_htaccess_off']) ? self::$Data['storage_htaccess_off'] : false;
95
-
96
- self::$Data = $default;
97
  return self::Save();
98
-
99
  }
100
 
101
  /**
@@ -112,7 +94,7 @@ class DUP_Settings
112
  delete_option('duplicator_add1_clicked');
113
  delete_option('duplicator_options');
114
 
115
- //PRE 5.1
116
  //Next version here if needed
117
  }
118
 
@@ -126,7 +108,35 @@ class DUP_Settings
126
  }
127
  return false;
128
  }
 
 
 
 
 
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  }
131
 
132
  //Init Class
28
  * @return The value stored in the key returns null if key does not exist
29
  */
30
  public static function Get($key = '') {
31
+ $result = null;
32
+ if (isset(self::$Data[$key])) {
33
+ $result = self::$Data[$key];
34
+ } else {
35
+ $defaults = self::GetAllDefaults();
36
+ if (isset($defaults[$key])) {
37
+ $result = $defaults[$key];
38
+ }
39
+ }
40
+ return $result;
41
  }
42
 
43
  /**
75
  * @return True if option value has changed, false if not or if update failed.
76
  */
77
  public static function SetDefaults() {
78
+ $defaults = self::GetAllDefaults();
79
+ self::$Data = $defaults;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  return self::Save();
 
81
  }
82
 
83
  /**
94
  delete_option('duplicator_add1_clicked');
95
  delete_option('duplicator_options');
96
 
97
+ //PRE 5.n
98
  //Next version here if needed
99
  }
100
 
108
  }
109
  return false;
110
  }
111
+
112
+
113
+ public static function GetAllDefaults() {
114
+ $default = array();
115
+ $default['version'] = self::$Version;
116
 
117
+ //Flag used to remove the wp_options value duplicator_settings which are all the settings in this class
118
+ $default['uninstall_settings'] = isset(self::$Data['uninstall_settings']) ? self::$Data['uninstall_settings'] : true;
119
+ //Flag used to remove entire wp-snapshot directory
120
+ $default['uninstall_files'] = isset(self::$Data['uninstall_files']) ? self::$Data['uninstall_files'] : true;
121
+ //Flag used to remove all tables
122
+ $default['uninstall_tables'] = isset(self::$Data['uninstall_tables']) ? self::$Data['uninstall_tables'] : true;
123
+
124
+ //Flag used to show debug info
125
+ $default['package_debug'] = isset(self::$Data['package_debug']) ? self::$Data['package_debug'] : false;
126
+ //Flag used to enable mysqldump
127
+ $default['package_mysqldump'] = isset(self::$Data['package_mysqldump']) ? self::$Data['package_mysqldump'] : false;
128
+ //Optional mysqldump search path
129
+ $default['package_mysqldump_path'] = isset(self::$Data['package_mysqldump_path']) ? self::$Data['package_mysqldump_path'] : '';
130
+ //Optional mysql limit size
131
+ $default['package_phpdump_qrylimit'] = isset(self::$Data['package_phpdump_qrylimit']) ? self::$Data['package_phpdump_qrylimit'] : "100";
132
+ //Optional mysqldump search path
133
+ $default['package_zip_flush'] = isset(self::$Data['package_zip_flush']) ? self::$Data['package_zip_flush'] : false;
134
+
135
+ //Flag for .htaccess file
136
+ $default['storage_htaccess_off'] = isset(self::$Data['storage_htaccess_off']) ? self::$Data['storage_htaccess_off'] : false;
137
+
138
+ return $default;
139
+ }
140
  }
141
 
142
  //Init Class
classes/utility.php CHANGED
@@ -23,15 +23,14 @@ class DUP_Util {
23
  * Returns the last N lines of a file
24
  * Equivelent to tail command
25
  */
26
- static public function TailFile($filepath, $lines = 2, $adaptive = true) {
27
 
28
  // Open file
29
  $f = @fopen($filepath, "rb");
30
  if ($f === false) return false;
31
 
32
  // Sets buffer size
33
- if (!$adaptive) $buffer = 4096;
34
- else $buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096));
35
 
36
  // Jump to last character
37
  fseek($f, -1, SEEK_END);
23
  * Returns the last N lines of a file
24
  * Equivelent to tail command
25
  */
26
+ static public function TailFile($filepath, $lines = 2) {
27
 
28
  // Open file
29
  $f = @fopen($filepath, "rb");
30
  if ($f === false) return false;
31
 
32
  // Sets buffer size
33
+ $buffer = 256;
 
34
 
35
  // Jump to last character
36
  fseek($f, -1, SEEK_END);
define.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  //Prevent directly browsing to the file
3
  if (function_exists('plugin_dir_url')) {
4
- define('DUPLICATOR_VERSION', '0.5.10');
5
  define("DUPLICATOR_HOMEPAGE", "http://lifeinthegrid.com/labs/duplicator");
6
  define("DUPLICATOR_GIVELINK", "http://lifeinthegrid.com/partner");
7
  define("DUPLICATOR_HELPLINK", "http://lifeinthegrid.com/duplicator-docs");
1
  <?php
2
  //Prevent directly browsing to the file
3
  if (function_exists('plugin_dir_url')) {
4
+ define('DUPLICATOR_VERSION', '0.5.12');
5
  define("DUPLICATOR_HOMEPAGE", "http://lifeinthegrid.com/labs/duplicator");
6
  define("DUPLICATOR_GIVELINK", "http://lifeinthegrid.com/partner");
7
  define("DUPLICATOR_HELPLINK", "http://lifeinthegrid.com/duplicator-docs");
duplicator.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Duplicator
5
  Plugin URI: http://www.lifeinthegrid.com/duplicator/
6
  Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
7
- Version: 0.5.10
8
  Author: LifeInTheGrid
9
  Author URI: http://www.lifeinthegrid.com
10
  License: GPLv2 or later
@@ -41,7 +41,6 @@ if (is_admin() == true) {
41
  require_once 'classes/settings.php';
42
  require_once 'classes/server.php';
43
  require_once 'classes/package.php';
44
- require_once 'classes/package.archive.zip.php';
45
  require_once 'views/actions.php';
46
 
47
  /* ACTIVATION
4
  Plugin Name: Duplicator
5
  Plugin URI: http://www.lifeinthegrid.com/duplicator/
6
  Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
7
+ Version: 0.5.12
8
  Author: LifeInTheGrid
9
  Author URI: http://www.lifeinthegrid.com
10
  License: GPLv2 or later
41
  require_once 'classes/settings.php';
42
  require_once 'classes/server.php';
43
  require_once 'classes/package.php';
 
44
  require_once 'views/actions.php';
45
 
46
  /* ACTIVATION
installer/build/assets/inc.css.php CHANGED
@@ -78,7 +78,7 @@
78
  div.dup-db-test label{display:inline-block; width:150px; font-weight:bold; white-space:nowrap;}
79
  div.dup-db-test small{display:block; margin:5px 0 5px 0px; font-style:italic; color:#444}
80
  div#dbconn-test-msg {font-size:12px}
81
- div#dup-step1-dbconn-status {border:1px solid silver; border-radius:3px; background-color:#f9f9f9; padding:10px; margin-top:10px; height:125px}
82
 
83
  /*Warning Area and Message */
84
  div#dup-step1-warning {margin-top:40px;padding:5px;font-size:11px; color:gray; line-height:12px;font-style:italic; overflow-y:scroll; height:75px; border:1px solid #dfdfdf; background-color:#fff; border-radius:3px}
@@ -109,7 +109,6 @@
109
  div.dup-step3-final-msg {height:110px; border:1px solid #CDCDCD; padding:8px;font-size:12px; border-radius:5px;box-shadow:0 4px 2px -2px #777;}
110
  div.dup-step3-final-title {color:#BE2323;}
111
  div.dup-step3-connect {font-size:12px; text-align:center; font-style:italic; position:absolute; bottom:10px; padding:10px; width:100%; margin-top:20px}
112
- div#dup-step3-dialog{font-size:12px}
113
  table.dup-step3-report-results,
114
  table.dup-step3-report-errs {border-collapse:collapse; border:1px solid #dfdfdf; }
115
  table.dup-step3-report-errs td {text-align:center; width:33%}
78
  div.dup-db-test label{display:inline-block; width:150px; font-weight:bold; white-space:nowrap;}
79
  div.dup-db-test small{display:block; margin:5px 0 5px 0px; font-style:italic; color:#444}
80
  div#dbconn-test-msg {font-size:12px}
81
+ div#dup-step1-dbconn-status {border:1px solid silver; border-radius:3px; background-color:#f9f9f9; padding:10px; margin-top:10px; height:125px; overflow-y: scroll}
82
 
83
  /*Warning Area and Message */
84
  div#dup-step1-warning {margin-top:40px;padding:5px;font-size:11px; color:gray; line-height:12px;font-style:italic; overflow-y:scroll; height:75px; border:1px solid #dfdfdf; background-color:#fff; border-radius:3px}
109
  div.dup-step3-final-msg {height:110px; border:1px solid #CDCDCD; padding:8px;font-size:12px; border-radius:5px;box-shadow:0 4px 2px -2px #777;}
110
  div.dup-step3-final-title {color:#BE2323;}
111
  div.dup-step3-connect {font-size:12px; text-align:center; font-style:italic; position:absolute; bottom:10px; padding:10px; width:100%; margin-top:20px}
 
112
  table.dup-step3-report-results,
113
  table.dup-step3-report-errs {border-collapse:collapse; border:1px solid #dfdfdf; }
114
  table.dup-step3-report-errs td {text-align:center; width:33%}
installer/build/view.help.php CHANGED
@@ -11,153 +11,202 @@
11
  <!-- =========================================
12
  HELP FORM -->
13
  <div id="dup-main-help">
14
- <div style="text-align:center">For in-depth help please see the <a href="http://lifeinthegrid.com/duplicator-docs" target="_blank">online resources</a></div>
15
-
16
- <h3>Step 1 - Deploy</h3>
17
- <div id="dup-help-step1" class="dup-help-page">
18
- <!-- MYSQL SERVER -->
19
- <fieldset>
20
- <legend><b>MySQL Server</b></legend>
21
-
22
- <b>Action:</b><br/>
23
- 'Create New' will attempt to create a new database if it does not exist. This option will not work on many hosting providers. If the database does not exist then you will need to login to your control panel and create the database. If 'Connect and Remove All Data' is checked this will DELETE all tables in the database you are connecting to as the Duplicator requires a blank database. Please make sure you have backups of all your data before using an portion of the installer, as this option WILL remove all data. Please contact your server administrator for more details.
24
- <br/><br/>
25
-
26
- <b>Host:</b><br/>
27
- The name of the host server that the database resides on. Many times this will be localhost, however each hosting provider will have it's own naming convention please check with your server administrator. To add a port number just append it to the host i.e. 'localhost:3306'.
28
- <br/><br/>
29
-
30
- <b>User:</b><br/>
31
- The name of a MySQL database server user. This is special account that has privileges to access a database and can read from or write to that database. <i style='font-size:11px'>This is <b>not</b> the same thing as your WordPress administrator account</i>
32
- <br/><br/>
33
-
34
- <b>Password:</b><br/>
35
- The password of the MySQL database server user.
36
- <br/><br/>
37
-
38
- <b>Name:</b><br/>
39
- The name of the database to which this installation will connect and install the new tables onto.
40
- <br/><br/>
41
-
42
- <div class="help" style="border-top:1px solid silver">
43
- <b>Common Database Connection Issues:</b><br/>
44
- - Double check case sensitive values 'User', 'Password' &amp; the 'Database Name' <br/>
45
- - Validate the database and database user exist on this server <br/>
46
- - Check if the database user has the correct permission levels to this database <br/>
47
- - The host 'localhost' may not work on all hosting providers <br/>
48
- - Contact your hosting provider for the exact required parameters <br/>
49
- - See the 'Database Setup Help' section on step 1 for more details<br/>
50
- - Visit the online resources 'Common FAQ page' <br/>
51
- </div>
52
-
53
-
54
- </fieldset>
55
-
56
- <!-- ADVANCED OPTS -->
57
- <fieldset>
58
- <legend><b>Advanced Options</b></legend>
59
- <b>Manual Package Extraction:</b><br/>
60
- This allows you to manually extract the zip archive on your own. This can be useful if your system does not have the ZipArchive support enabled.
61
- <br/><br/>
62
-
63
- <b>Enforce SSL on Admin:</b><br/>
64
- Turn off SSL support for WordPress. This sets FORCE_SSL_ADMIN in your wp-config file to false if true, otherwise it will create the setting if not set.
65
- <br/><br/>
66
-
67
- <b>Enforce SSL on Login:</b><br/>
68
- Turn off SSL support for WordPress Logins. This sets FORCE_SSL_LOGIN in your wp-config file to false if true, otherwise it will create the setting if not set.
69
- <br/><br/>
70
-
71
- <b>Keep Cache Enabled:</b><br/>
72
- Turn off Cache support for WordPress. This sets WP_CACHE in your wp-config file to false if true, otherwise it will create the setting if not set.
73
- <br/><br/>
74
-
75
- <b>Keep Cache Home Path:</b><br/>
76
- This sets WPCACHEHOME in your wp-config file to nothing if true, otherwise nothing is changed.
77
- <br/><br/>
78
-
79
- <b>Fix non-breaking space characters:</b><br/>
80
- The process will remove utf8 characters represented as 'xC2' 'xA0' and replace with a uniform space. Use this option if you find strange question marks in you posts
81
- <br/><br/>
82
-
83
- <b>MySQL Charset &amp; MySQL Collation:</b><br/>
84
- When the database is populated from the SQL script it will use this value as part of its connection. Only change this value if you know what your databases character set should be.
85
- <br/>
86
- </fieldset>
87
- </div>
88
-
89
- <h3>Step 2 - Update</h3>
90
- <div id="dup-help-step1" class="dup-help-page">
91
-
92
- <!-- SETTINGS-->
93
- <fieldset>
94
- <legend><b>Settings</b></legend>
95
- <b>Old Settings:</b><br/>
96
- The URL and Path settings are the original values that the package was created with. These values should not be changed.
97
- <br/><br/>
98
-
99
- <b>New Settings:</b><br/>
100
- These are the new values (URL, Path and Title) you can update for the new location at which your site will be installed at.
101
- <br/>
102
- </fieldset>
103
-
104
- <!-- NEW ADMIN ACCOUNT-->
105
- <fieldset>
106
- <legend><b>New Admin Account</b></legend>
107
- <b>Username:</b><br/>
108
- The new username to create. This will create a new WordPress administrator account. Please note that usernames are not changeable from the within the UI.
109
- <br/><br/>
110
-
111
- <b>Password:</b><br/>
112
- The new password for the user.
113
- <br/>
114
- </fieldset>
115
-
116
- <!-- ADVANCED OPTS -->
117
- <fieldset>
118
- <legend><b>Advanced Options</b></legend>
119
- <b>Site URL:</b><br/>
120
- For details see WordPress <a href="http://codex.wordpress.org/Changing_The_Site_URL" target="_blank">Site URL</a> &amp; <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory" target="_blank">Alternate Directory</a>. If you're not sure about this value then leave it the same as the new settings URL.
121
- <br/><br/>
122
-
123
- <b>Scan Tables:</b><br/>
124
- Select the tables to be updated. This process will update all of the 'Old Settings' with the 'New Settings'. Hold down the 'ctrl key' to select/deselect multiple.
125
- <br/><br/>
126
-
127
- <b>Activate Plugins:</b><br/>
128
- These plug-ins are the plug-ins that were activated when the package was created and represent the plug-ins that will be activated after the install.
129
- <br/><br/>
130
-
131
- <b>Post GUID:</b><br/>
132
- If your moving a site keep this value checked. For more details see the <a href="http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note" target="_blank">notes on GUIDS</a>. Changing values in the posts table GUID column can change RSS readers to evaluate that the posts are new and may show them in feeds again.
133
- <br/><br/>
134
-
135
- <b>Full Search:</b><br/>
136
- Full search forces a scan of every single cell in the database. If it is not checked then only text based columns are searched which makes the update process much faster.
137
- <br/>
138
- </fieldset>
139
-
140
- </div>
141
-
142
- <h3>Step 3 - Test</h3>
143
- <fieldset>
144
- <legend><b>Final Steps</b></legend>
145
-
146
- <b>Resave Permalinks</b><br/>
147
- Re-saving your perma-links will reconfigure your .htaccess file to match the correct path on your server. This step requires logging back into the WordPress administrator.
148
- <br/><br/>
149
-
150
- <b>Delete Installer Files</b><br/>
151
- When you're completed with the installation please delete all installer files. Leaving these files on your server can impose a security risk!
152
- <br/><br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
- <b>Test Entire Site</b><br/>
155
- After the install is complete run through your entire site and test all pages and posts.
156
  <br/><br/>
157
-
158
- <b>View Install Report</b><br/>
159
- The install report is designed to give you a synopsis of the possible errors and warnings that may exist after the installation is completed.
160
- <br/>
161
- </fieldset>
162
- <br/><br/>
163
  </div>
11
  <!-- =========================================
12
  HELP FORM -->
13
  <div id="dup-main-help">
14
+ <div style="text-align:center">For in-depth help please see the <a href="http://lifeinthegrid.com/duplicator-docs" target="_blank">online resources</a></div>
15
+
16
+ <h3>Step 1 - Deploy</h3>
17
+ <div id="dup-help-step1" class="dup-help-page">
18
+ <!-- MYSQL SERVER -->
19
+ <fieldset>
20
+ <legend><b>MySQL Server</b></legend>
21
+
22
+ <b>Action:</b><br/>
23
+ 'Create New' will attempt to create a new database if it does not exist. This option will not work on many hosting providers. If the database does not exist then you will need to login to your control panel and create the database. If 'Connect and Remove All Data' is checked this will DELETE all tables in the database you are connecting to as the Duplicator requires a blank database. Please make sure you have backups of all your data before using an portion of the installer, as this option WILL remove all data. Please contact your server administrator for more details.
24
+ <br/><br/>
25
+
26
+ <b>Host:</b><br/>
27
+ The name of the host server that the database resides on. Many times this will be localhost, however each hosting provider will have it's own naming convention please check with your server administrator. To add a port number just append it to the host i.e. 'localhost:3306'.
28
+ <br/><br/>
29
+
30
+ <b>User:</b><br/>
31
+ The name of a MySQL database server user. This is special account that has privileges to access a database and can read from or write to that database. <i style='font-size:11px'>This is <b>not</b> the same thing as your WordPress administrator account</i>
32
+ <br/><br/>
33
+
34
+ <b>Password:</b><br/>
35
+ The password of the MySQL database server user.
36
+ <br/><br/>
37
+
38
+ <b>Name:</b><br/>
39
+ The name of the database to which this installation will connect and install the new tables onto.
40
+ <br/><br/>
41
+
42
+ <div class="help" style="border-top:1px solid silver">
43
+ <b>Common Database Connection Issues:</b><br/>
44
+ - Double check case sensitive values 'User', 'Password' &amp; the 'Database Name' <br/>
45
+ - Validate the database and database user exist on this server <br/>
46
+ - Check if the database user has the correct permission levels to this database <br/>
47
+ - The host 'localhost' may not work on all hosting providers <br/>
48
+ - Contact your hosting provider for the exact required parameters <br/>
49
+ - See the 'Database Setup Help' section on step 1 for more details<br/>
50
+ - Visit the online resources 'Common FAQ page' <br/>
51
+ </div>
52
+
53
+
54
+ </fieldset>
55
+
56
+ <!-- ADVANCED OPTS -->
57
+ <fieldset>
58
+ <legend><b>Advanced Options</b></legend>
59
+ <b>Manual Package Extraction:</b><br/>
60
+ This allows you to manually extract the zip archive on your own. This can be useful if your system does not have the ZipArchive support enabled.
61
+ <br/><br/>
62
+
63
+ <b>Enforce SSL on Admin:</b><br/>
64
+ Turn off SSL support for WordPress. This sets FORCE_SSL_ADMIN in your wp-config file to false if true, otherwise it will create the setting if not set.
65
+ <br/><br/>
66
+
67
+ <b>Enforce SSL on Login:</b><br/>
68
+ Turn off SSL support for WordPress Logins. This sets FORCE_SSL_LOGIN in your wp-config file to false if true, otherwise it will create the setting if not set.
69
+ <br/><br/>
70
+
71
+ <b>Keep Cache Enabled:</b><br/>
72
+ Turn off Cache support for WordPress. This sets WP_CACHE in your wp-config file to false if true, otherwise it will create the setting if not set.
73
+ <br/><br/>
74
+
75
+ <b>Keep Cache Home Path:</b><br/>
76
+ This sets WPCACHEHOME in your wp-config file to nothing if true, otherwise nothing is changed.
77
+ <br/><br/>
78
+
79
+ <b>Fix non-breaking space characters:</b><br/>
80
+ The process will remove utf8 characters represented as 'xC2' 'xA0' and replace with a uniform space. Use this option if you find strange question marks in you posts
81
+ <br/><br/>
82
+
83
+ <b>MySQL Charset &amp; MySQL Collation:</b><br/>
84
+ When the database is populated from the SQL script it will use this value as part of its connection. Only change this value if you know what your databases character set should be.
85
+ <br/>
86
+ </fieldset>
87
+ </div>
88
+
89
+ <h3>Step 2 - Update</h3>
90
+ <div id="dup-help-step2" class="dup-help-page">
91
+
92
+ <!-- SETTINGS-->
93
+ <fieldset>
94
+ <legend><b>Settings</b></legend>
95
+ <b>Old Settings:</b><br/>
96
+ The URL and Path settings are the original values that the package was created with. These values should not be changed.
97
+ <br/><br/>
98
+
99
+ <b>New Settings:</b><br/>
100
+ These are the new values (URL, Path and Title) you can update for the new location at which your site will be installed at.
101
+ <br/>
102
+ </fieldset>
103
+
104
+ <!-- NEW ADMIN ACCOUNT-->
105
+ <fieldset>
106
+ <legend><b>New Admin Account</b></legend>
107
+ <b>Username:</b><br/>
108
+ The new username to create. This will create a new WordPress administrator account. Please note that usernames are not changeable from the within the UI.
109
+ <br/><br/>
110
+
111
+ <b>Password:</b><br/>
112
+ The new password for the user.
113
+ <br/>
114
+ </fieldset>
115
+
116
+ <!-- ADVANCED OPTS -->
117
+ <fieldset>
118
+ <legend><b>Advanced Options</b></legend>
119
+ <b>Site URL:</b><br/>
120
+ For details see WordPress <a href="http://codex.wordpress.org/Changing_The_Site_URL" target="_blank">Site URL</a> &amp; <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory" target="_blank">Alternate Directory</a>. If you're not sure about this value then leave it the same as the new settings URL.
121
+ <br/><br/>
122
+
123
+ <b>Scan Tables:</b><br/>
124
+ Select the tables to be updated. This process will update all of the 'Old Settings' with the 'New Settings'. Hold down the 'ctrl key' to select/deselect multiple.
125
+ <br/><br/>
126
+
127
+ <b>Activate Plugins:</b><br/>
128
+ These plug-ins are the plug-ins that were activated when the package was created and represent the plug-ins that will be activated after the install.
129
+ <br/><br/>
130
+
131
+ <b>Post GUID:</b><br/>
132
+ If your moving a site keep this value checked. For more details see the <a href="http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note" target="_blank">notes on GUIDS</a>. Changing values in the posts table GUID column can change RSS readers to evaluate that the posts are new and may show them in feeds again.
133
+ <br/><br/>
134
+
135
+ <b>Full Search:</b><br/>
136
+ Full search forces a scan of every single cell in the database. If it is not checked then only text based columns are searched which makes the update process much faster.
137
+ <br/>
138
+ </fieldset>
139
+
140
+ </div>
141
+
142
+ <h3>Step 3 - Test</h3>
143
+ <div id="dup-help-step3" class="dup-help-page">
144
+ <fieldset>
145
+ <legend><b>Final Steps</b></legend>
146
+
147
+ <b>Resave Permalinks</b><br/>
148
+ Re-saving your perma-links will reconfigure your .htaccess file to match the correct path on your server. This step requires logging back into the WordPress administrator.
149
+ <br/><br/>
150
+
151
+ <b>Delete Installer Files</b><br/>
152
+ When you're completed with the installation please delete all installer files. Leaving these files on your server can impose a security risk!
153
+ <br/><br/>
154
+
155
+ <b>Test Entire Site</b><br/>
156
+ After the install is complete run through your entire site and test all pages and posts.
157
+ <br/><br/>
158
+
159
+ <b>View Install Report</b><br/>
160
+ The install report is designed to give you a synopsis of the possible errors and warnings that may exist after the installation is completed.
161
+ <br/>
162
+ </fieldset>
163
+ </div>
164
+
165
+
166
+ <h3>Troubleshooting Tips</h3>
167
+ <div id="troubleshoot" class="dup-help-page">
168
+ <fieldset>
169
+ <legend><b>Quick Overview</b></legend>
170
+
171
+ <div style="padding: 0px 10px 10px 10px;">
172
+ <b>Common Quick Fix Issues:</b>
173
+ <ul>
174
+ <li>Use an <a href='http://lifeinthegrid.com/duplicator-hosts' target='_blank'>approved hosting provider</a></li>
175
+ <li>Validate directory and file permissions (see below)</li>
176
+ <li>Validate web server configuration file (see below)</li>
177
+ <li>Clear your browsers cache</li>
178
+ <li>Deactivate and reactivate all plugins</li>
179
+ <li>Resave a plugins settings if it reports errors</li>
180
+ <li>Make sure your root directory is empty</li>
181
+ </ul>
182
+
183
+ <b>Permissions:</b><br/>
184
+ Not all operating systems are alike. Therefore, when you move a package (zip file) from one location to another the file and directory permissions may not always stick. If this is the case then check your WordPress directories and make sure it's permissions are set to 755. For files make sure the permissions are set to 644 (this does not apply to windows servers). Also pay attention to the owner/group attributes. For a full overview of the correct file changes see the <a href='http://codex.wordpress.org/Hardening_WordPress#File_permissions' target='_blank'>WordPress permissions codex</a>
185
+ <br/><br/>
186
+
187
+ <b>Web server configuration files:</b><br/>
188
+ For Apache web server the root .htaccess file was copied to .htaccess.orig. A new stripped down .htaccess file was created to help simplify access issues. For IIS web server the web.config file was copied to web.config.orig, however no new web.config file was created. If you have not altered this file manually then resaving your permalinks and resaving your plugins should resolve most all changes that were made to the root web configuration file. If your still experiencing issues then open the .orig file and do a compare to see what changes need to be made. <br/><br/><b>Plugin Notes:</b><br/> It's impossible to know how all 3rd party plugins function. The Duplicator attempts to fix the new install URL for settings stored in the WordPress options table. Please validate that all plugins retained there settings after installing. If you experience issues try to bulk deactivate all plugins then bulk reactivate them on your new duplicated site. If you run into issues were a plugin does not retain its data then try to resave the plugins settings.
189
+ <br/><br/>
190
+
191
+ <b>Cache Systems:</b><br/>
192
+ Any type of cache system such as Super Cache, W3 Cache, etc. should be emptied before you create a package. Another alternative is to include the cache directory in the directory exclusion path list found in the options dialog. Including a directory such as \pathtowordpress\wp-content\w3tc\ (the w3 Total Cache directory) will exclude this directory from being packaged. In is highly recommended to always perform a cache empty when you first fire up your new site even if you excluded your cache directory.
193
+ <br/><br/>
194
+
195
+ <b>Trying Again:</b><br/>
196
+ If you need to retry and reinstall this package you can easily run the process again by deleting all files except the installer.php and package file and then browse to the installer.php again.
197
+ <br/><br/>
198
+
199
+ <b>Additional Notes:</b><br/>
200
+ If you have made changes to your PHP files directly this might have an impact on your duplicated site. Be sure all changes made will correspond to the sites new location.
201
+ Only the package (zip file) and the installer.php file should be in the directory where you are installing the site. Please read through our knowledge base before submitting any issues.
202
+ If you have a large log file that needs evaluated please email the file, or attach it to a help ticket.
203
+ <br/><br/>
204
+
205
+ </div>
206
+ </fieldset>
207
+ </div>
208
+
209
+ <div style="text-align:center">For in-depth help please see the <a href="http://lifeinthegrid.com/duplicator-docs" target="_blank">online resources</a></div>
210
 
 
 
211
  <br/><br/>
 
 
 
 
 
 
212
  </div>
installer/build/view.step1.php CHANGED
@@ -26,13 +26,11 @@
26
  $req01a = 'Fail';
27
  }
28
  }
29
- $req01b = ($zip_file_count == 1) ? 'Pass' : 'Fail';
30
- $req01 = ($req01a == 'Pass' && $req01b == 'Pass') ? 'Pass' : 'Fail';
31
- $req02 = (((strtolower(@ini_get('safe_mode')) == 'on')
32
- || (strtolower(@ini_get('safe_mode')) == 'yes')
33
- || (strtolower(@ini_get('safe_mode')) == 'true')
34
- || (ini_get("safe_mode") == 1 ))) ? 'Fail' : 'Pass';
35
- $req03 = function_exists('mysqli_connect') ? 'Pass' : 'Fail';
36
  $php_compare = version_compare(phpversion(), '5.2.17');
37
  $req04 = $php_compare >= 0 ? 'Pass' : 'Fail';
38
  $total_req = ($req01 == 'Pass' && $req02 == 'Pass' && $req03 == 'Pass' && $req04 == 'Pass') ? 'Pass' : 'Fail';
26
  $req01a = 'Fail';
27
  }
28
  }
29
+ $req01b = ($zip_file_count == 1) ? 'Pass' : 'Fail';
30
+ $req01 = ($req01a == 'Pass' && $req01b == 'Pass') ? 'Pass' : 'Fail';
31
+ $safe_ini = strtolower(@ini_get('safe_mode'));
32
+ $req02 = $safe_ini != 'on' || $safe_ini != 'yes' || $safe_ini != 'true' || ini_get("safe_mode") != 1 ? 'Pass' : 'Fail';
33
+ $req03 = function_exists('mysqli_connect') ? 'Pass' : 'Fail';
 
 
34
  $php_compare = version_compare(phpversion(), '5.2.17');
35
  $req04 = $php_compare >= 0 ? 'Pass' : 'Fail';
36
  $total_req = ($req01 == 'Pass' && $req02 == 'Pass' && $req03 == 'Pass' && $req04 == 'Pass') ? 'Pass' : 'Fail';
installer/build/view.step3.php CHANGED
@@ -8,17 +8,7 @@
8
  exit;
9
  }
10
  ?>
11
- <script type="text/javascript">
12
- /** **********************************************
13
- * METHOD: Opens the tips dialog */
14
- Duplicator.dlgTips = function() {
15
- $("#dup-step3-dialog").dialog({
16
- height:600, width:700, modal: true,
17
- position:['center', 150],
18
- buttons: {Close: function() {$(this).dialog( "close" );}}
19
- });
20
- };
21
-
22
  /** **********************************************
23
  * METHOD: Posts to page to remove install files */
24
  Duplicator.removeInstallerFiles = function(package_name) {
@@ -193,59 +183,15 @@ VIEW: STEP 3- INPUT -->
193
 
194
 
195
  </div><br/><br/>
196
-
197
-
198
-
199
 
200
  <div class='dup-step3-connect'>
201
- Please consider <a href='http://lifeinthegrid.com/partner/' target='_blank'>Partnering or a Donation</a>! <br/>
202
- <a href="javascript:void(0)" onclick="Duplicator.dlgTips()">Troubleshoot</a> |
203
  <a href='http://support.lifeinthegrid.com/knowledgebase.php' target='_blank'>FAQs</a> |
204
- <a href='http://lifeinthegrid.com/duplicator' target='_blank'>Support</a>
 
205
  </div><br/>
206
  </form>
207
 
208
-
209
- <!-- =========================================
210
- DIALOG: TROUBLSHOOTING DIALOG -->
211
- <div id="dup-step3-dialog" title="Troubleshooting Tips" style="display:none">
212
- <div style="padding: 0px 10px 10px 10px;">
213
- <b>Common Quick Fix Issues:</b>
214
- <ul>
215
- <li>Use an <a href='http://lifeinthegrid.com/duplicator-hosts' target='_blank'>approved hosting provider</a></li>
216
- <li>Validate directory and file permissions (see below)</li>
217
- <li>Validate web server configuration file (see below)</li>
218
- <li>Clear your browsers cache</li>
219
- <li>Deactivate and reactivate all plugins</li>
220
- <li>Resave a plugins settings if it reports errors</li>
221
- <li>Make sure your root directory is empty</li>
222
- </ul>
223
-
224
- <b>Permissions:</b><br/>
225
- Not all operating systems are alike. Therefore, when you move a package (zip file) from one location to another the file and directory permissions may not always stick. If this is the case then check your WordPress directories and make sure it's permissions are set to 755. For files make sure the permissions are set to 644 (this does not apply to windows servers). Also pay attention to the owner/group attributes. For a full overview of the correct file changes see the <a href='http://codex.wordpress.org/Hardening_WordPress#File_permissions' target='_blank'>WordPress permissions codex</a>
226
- <br/><br/>
227
-
228
- <b>Web server configuration files:</b><br/>
229
- For Apache web server the root .htaccess file was copied to .htaccess.orig. A new stripped down .htaccess file was created to help simplify access issues. For IIS web server the web.config file was copied to web.config.orig, however no new web.config file was created. If you have not altered this file manually then resaving your permalinks and resaving your plugins should resolve most all changes that were made to the root web configuration file. If your still experiencing issues then open the .orig file and do a compare to see what changes need to be made. <br/><br/><b>Plugin Notes:</b><br/> It's impossible to know how all 3rd party plugins function. The Duplicator attempts to fix the new install URL for settings stored in the WordPress options table. Please validate that all plugins retained there settings after installing. If you experience issues try to bulk deactivate all plugins then bulk reactivate them on your new duplicated site. If you run into issues were a plugin does not retain its data then try to resave the plugins settings.
230
- <br/><br/>
231
-
232
- <b>Cache Systems:</b><br/>
233
- Any type of cache system such as Super Cache, W3 Cache, etc. should be emptied before you create a package. Another alternative is to include the cache directory in the directory exclusion path list found in the options dialog. Including a directory such as \pathtowordpress\wp-content\w3tc\ (the w3 Total Cache directory) will exclude this directory from being packaged. In is highly recommended to always perform a cache empty when you first fire up your new site even if you excluded your cache directory.
234
- <br/><br/>
235
-
236
- <b>Trying Again:</b><br/>
237
- If you need to retry and reinstall this package you can easily run the process again by deleting all files except the installer.php and package file and then browse to the installer.php again.
238
- <br/><br/>
239
-
240
- <b>Additional Notes:</b><br/>
241
- If you have made changes to your PHP files directly this might have an impact on your duplicated site. Be sure all changes made will correspond to the sites new location.
242
- Only the package (zip file) and the installer.php file should be in the directory where you are installing the site. Please read through our knowledge base before submitting any issues.
243
- If you have a large log file that needs evaluated please email the file, or attach it to a help ticket.
244
- <br/><br/>
245
-
246
- </div>
247
- </div>
248
-
249
  <script type="text/javascript">
250
  MyViewModel = function() {
251
  this.status = <?php echo urldecode($_POST['json']); ?>;
8
  exit;
9
  }
10
  ?>
11
+ <script type="text/javascript">
 
 
 
 
 
 
 
 
 
 
12
  /** **********************************************
13
  * METHOD: Posts to page to remove install files */
14
  Duplicator.removeInstallerFiles = function(package_name) {
183
 
184
 
185
  </div><br/><br/>
 
 
 
186
 
187
  <div class='dup-step3-connect'>
188
+ <a href="installer.php?help=1#troubleshoot" target="_blank">Troubleshoot</a> |
 
189
  <a href='http://support.lifeinthegrid.com/knowledgebase.php' target='_blank'>FAQs</a> |
190
+ <a href='http://lifeinthegrid.com/duplicator' target='_blank'>Support</a> |
191
+ <a href='http://lifeinthegrid.com/partner/' target='_blank'>Donate</a>
192
  </div><br/>
193
  </form>
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  <script type="text/javascript">
196
  MyViewModel = function() {
197
  this.status = <?php echo urldecode($_POST['json']); ?>;
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Duplicator ===
2
- Contributors: corylamleorg
3
  Donate link: www.lifeinthegrid.com/partner
4
  Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
- Stable tag: 0.5.10
8
  License: GPLv2
9
 
10
  Duplicate, clone, backup, move and transfer an entire site from one location to another.
1
  === Duplicator ===
2
+ Contributors: corylamleorg, bobriley
3
  Donate link: www.lifeinthegrid.com/partner
4
  Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
+ Stable tag: 0.5.12
8
  License: GPLv2
9
 
10
  Duplicate, clone, backup, move and transfer an entire site from one location to another.
views/settings/controller.php CHANGED
@@ -21,16 +21,13 @@ $current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'general';
21
  <?php duplicator_header(__("Settings", 'wpduplicator')) ?>
22
 
23
  <h2 class="nav-tab-wrapper">
24
- <a href="?page=duplicator-settings" class="nav-tab <?php echo ($current_tab == 'general') ? 'nav-tab-active' : '' ?>"> <?php _e('General', 'wpduplicator'); ?></a>
25
- <a href="?page=duplicator-settings&tab=diagnostics" class="nav-tab <?php echo ($current_tab != 'general') ? 'nav-tab-active' : '' ?>"> <?php _e('Diagnostics', 'wpduplicator'); ?></a>
26
  </h2>
27
 
28
  <?php
29
  switch ($current_tab) {
30
  case 'general': include('general.php');
31
  break;
32
- case 'diagnostics': include('diagnostics.php');
33
- break;
34
  }
35
  ?>
36
  </div>
21
  <?php duplicator_header(__("Settings", 'wpduplicator')) ?>
22
 
23
  <h2 class="nav-tab-wrapper">
24
+ <a href="?page=duplicator-settings&tab=general" class="nav-tab <?php echo ($current_tab == 'general') ? 'nav-tab-active' : '' ?>"> <?php _e('General', 'wpduplicator'); ?></a>
 
25
  </h2>
26
 
27
  <?php
28
  switch ($current_tab) {
29
  case 'general': include('general.php');
30
  break;
 
 
31
  }
32
  ?>
33
  </div>
views/settings/general.php CHANGED
@@ -4,6 +4,8 @@ global $wpdb;
4
 
5
  $action_updated = null;
6
  $action_response = __("Settings Saved", 'wpduplicator');
 
 
7
  if (isset($_POST['action']) && $_POST['action'] == 'save') {
8
  //General Tab
9
  //Plugin
@@ -13,9 +15,11 @@ if (isset($_POST['action']) && $_POST['action'] == 'save') {
13
  DUP_Settings::Set('storage_htaccess_off', isset($_POST['storage_htaccess_off']) ? "1" : "0");
14
 
15
  //Package
 
16
  DUP_Settings::Set('package_debug', isset($_POST['package_debug']) ? "1" : "0");
17
  DUP_Settings::Set('package_zip_flush', isset($_POST['package_zip_flush']) ? "1" : "0");
18
- DUP_Settings::Set('package_mysqldump', isset($_POST['package_mysqldump']) ? "1" : "0");
 
19
  DUP_Settings::Set('package_mysqldump_path', trim($_POST['package_mysqldump_path']));
20
 
21
  //WPFront
@@ -32,6 +36,10 @@ $storage_htaccess_off = DUP_Settings::Get('storage_htaccess_off');
32
 
33
  $package_debug = DUP_Settings::Get('package_debug');
34
  $package_zip_flush = DUP_Settings::Get('package_zip_flush');
 
 
 
 
35
  $package_mysqldump = DUP_Settings::Get('package_mysqldump');
36
  $package_mysqldump_path = trim(DUP_Settings::Get('package_mysqldump_path'));
37
 
@@ -40,6 +48,8 @@ $wpfront_ready = apply_filters('wpfront_user_role_editor_duplicator_integration_
40
 
41
  $mysqlDumpPath = DUP_Database::GetMySqlDumpPath();
42
  $mysqlDumpFound = ($mysqlDumpPath) ? true : false;
 
 
43
  ?>
44
 
45
  <style>
@@ -114,6 +124,22 @@ $mysqlDumpFound = ($mysqlDumpPath) ? true : false;
114
  <tr>
115
  <th scope="row"><label><?php _e("Database Build", 'wpduplicator'); ?></label></th>
116
  <td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
  <?php if (!DUP_Util::IsShellExecAvailable()) : ?>
119
  <p class="description">
@@ -124,7 +150,7 @@ $mysqlDumpFound = ($mysqlDumpPath) ? true : false;
124
  ?>
125
  </p>
126
  <?php else : ?>
127
- <input type="checkbox" name="package_mysqldump" id="package_mysqldump" <?php echo ($package_mysqldump) ? 'checked="checked"' : ''; ?> />
128
  <label for="package_mysqldump"><?php _e("Use mysqldump", 'wpduplicator'); ?></label> &nbsp;
129
  <i style="font-size:12px">(<?php _e("recommended for large databases", 'wpduplicator'); ?>)</i> <br/><br/>
130
 
4
 
5
  $action_updated = null;
6
  $action_response = __("Settings Saved", 'wpduplicator');
7
+
8
+ //SAVE RESULTS
9
  if (isset($_POST['action']) && $_POST['action'] == 'save') {
10
  //General Tab
11
  //Plugin
15
  DUP_Settings::Set('storage_htaccess_off', isset($_POST['storage_htaccess_off']) ? "1" : "0");
16
 
17
  //Package
18
+ $enable_mysqldump = isset($_POST['package_dbmode']) && $_POST['package_dbmode'] == 'mysql' ? "1" : "0";
19
  DUP_Settings::Set('package_debug', isset($_POST['package_debug']) ? "1" : "0");
20
  DUP_Settings::Set('package_zip_flush', isset($_POST['package_zip_flush']) ? "1" : "0");
21
+ DUP_Settings::Set('package_mysqldump', $enable_mysqldump ? "1" : "0");
22
+ DUP_Settings::Set('package_phpdump_qrylimit', isset($_POST['package_phpdump_qrylimit']) ? $_POST['package_phpdump_qrylimit'] : "100");
23
  DUP_Settings::Set('package_mysqldump_path', trim($_POST['package_mysqldump_path']));
24
 
25
  //WPFront
36
 
37
  $package_debug = DUP_Settings::Get('package_debug');
38
  $package_zip_flush = DUP_Settings::Get('package_zip_flush');
39
+
40
+ $phpdump_chunkopts = array("20", "100", "500", "1000", "2000");
41
+
42
+ $package_phpdump_qrylimit = DUP_Settings::Get('package_phpdump_qrylimit');
43
  $package_mysqldump = DUP_Settings::Get('package_mysqldump');
44
  $package_mysqldump_path = trim(DUP_Settings::Get('package_mysqldump_path'));
45
 
48
 
49
  $mysqlDumpPath = DUP_Database::GetMySqlDumpPath();
50
  $mysqlDumpFound = ($mysqlDumpPath) ? true : false;
51
+
52
+
53
  ?>
54
 
55
  <style>
124
  <tr>
125
  <th scope="row"><label><?php _e("Database Build", 'wpduplicator'); ?></label></th>
126
  <td>
127
+ <input type="radio" name="package_dbmode" id="package_phpdump" value="php" <?php echo (! $package_mysqldump) ? 'checked="checked"' : ''; ?> />
128
+ <label for="package_phpdump"><?php _e("Use PHP", 'wpduplicator'); ?></label> &nbsp;
129
+
130
+ <div style="margin:5px 0px 0px 25px">
131
+ <label for="package_phpdump_qrylimit"><?php _e("Query Limit Size", 'wpduplicator'); ?></label> &nbsp;
132
+ <select name="package_phpdump_qrylimit" id="package_phpdump_qrylimit">
133
+ <?php
134
+ foreach($phpdump_chunkopts as $value) {
135
+ $selected = ( $package_phpdump_qrylimit == $value ? "selected='selected'" : '' );
136
+ echo "<option {$selected} value='{$value}'>" . number_format($value) . '</option>';
137
+ }
138
+ ?>
139
+ </select>
140
+ <i style="font-size:12px">(<?php _e("higher values speed up build times but uses more memory", 'wpduplicator'); ?>)</i>
141
+
142
+ </div><br/>
143
 
144
  <?php if (!DUP_Util::IsShellExecAvailable()) : ?>
145
  <p class="description">
150
  ?>
151
  </p>
152
  <?php else : ?>
153
+ <input type="radio" name="package_dbmode" value="mysql" id="package_mysqldump" <?php echo ($package_mysqldump) ? 'checked="checked"' : ''; ?> />
154
  <label for="package_mysqldump"><?php _e("Use mysqldump", 'wpduplicator'); ?></label> &nbsp;
155
  <i style="font-size:12px">(<?php _e("recommended for large databases", 'wpduplicator'); ?>)</i> <br/><br/>
156
 
views/tools/cleanup.php CHANGED
@@ -44,20 +44,28 @@
44
  $installer_log = DUPLICATOR_WPROOTPATH . DUPLICATOR_INSTALL_LOG;
45
  $package_name = (isset($_GET['package'])) ? DUPLICATOR_WPROOTPATH . esc_html($_GET['package']) : '';
46
 
47
- $html .= (@unlink($installer_file)) ? "<div class='success'>Successfully removed {$installer_file}</div>" : "<div class='failed'>Does not exsist or unable to remove file: {$installer_file}</div>";
48
- $html .= (@unlink($installer_bak)) ? "<div class='success'>Successfully removed {$installer_bak}</div>" : "<div class='failed'>Does not exsist or unable to remove file: {$installer_bak}</div>";
49
- $html .= (@unlink($installer_sql)) ? "<div class='success'>Successfully removed {$installer_sql}</div>" : "<div class='failed'>Does not exsist or unable to remove file: {$installer_sql}</div>";
50
- $html .= (@unlink($installer_log)) ? "<div class='success'>Successfully removed {$installer_log}</div>" : "<div class='failed'>Does not exsist or unable to remove file: {$installer_log}</div>";
51
 
52
- $path_parts = pathinfo($package_name);
53
- $path_parts = (isset($path_parts['extension'])) ? $path_parts['extension'] : '';
54
- if ($path_parts == "zip" && ! is_dir($package_name)) {
55
- $html .= (@unlink($package_name))
56
- ? "<div class='success'>Successfully removed {$package_name}</div>"
57
- : "<div class='failed'>Does not exsist or unable to remove file: {$package_name}</div>";
 
 
 
 
 
 
 
58
  } else {
59
- $html .= "<div class='failed'>Does not exsist or unable to remove file '{$package_name}'. Validate that an archive file exists.</div>";
60
  }
 
61
  echo $html;
62
  ?>
63
 
44
  $installer_log = DUPLICATOR_WPROOTPATH . DUPLICATOR_INSTALL_LOG;
45
  $package_name = (isset($_GET['package'])) ? DUPLICATOR_WPROOTPATH . esc_html($_GET['package']) : '';
46
 
47
+ $html .= (@unlink($installer_file)) ? "<div class='success'>Successfully removed {$installer_file}</div>" : "<div class='failed'>Does not exist or unable to remove file: {$installer_file}</div>";
48
+ $html .= (@unlink($installer_bak)) ? "<div class='success'>Successfully removed {$installer_bak}</div>" : "<div class='failed'>Does not exist or unable to remove file: {$installer_bak}</div>";
49
+ $html .= (@unlink($installer_sql)) ? "<div class='success'>Successfully removed {$installer_sql}</div>" : "<div class='failed'>Does not exist or unable to remove file: {$installer_sql}</div>";
50
+ $html .= (@unlink($installer_log)) ? "<div class='success'>Successfully removed {$installer_log}</div>" : "<div class='failed'>Does not exist or unable to remove file: {$installer_log}</div>";
51
 
52
+ //No way to know exact name of archive file except from installer.
53
+ //The only place where the package can be remove is from installer
54
+ //So just show a message if removing from plugin.
55
+ if (! empty($package_name) ){
56
+ $path_parts = pathinfo($package_name);
57
+ $path_parts = (isset($path_parts['extension'])) ? $path_parts['extension'] : '';
58
+ if ($path_parts == "zip" && ! is_dir($package_name)) {
59
+ $html .= (@unlink($package_name))
60
+ ? "<div class='success'>Successfully removed {$package_name}</div>"
61
+ : "<div class='failed'>Does not exist or unable to remove archive file.</div>";
62
+ } else {
63
+ $html .= "<div class='failed'>Does not exist or unable to remove archive file. Please validate that an archive file exists.</div>";
64
+ }
65
  } else {
66
+ $html .= '<div>It is <u>recommended</u> to remove your archive file from the root of your WordPress install. This will need to be done manually.</div>';
67
  }
68
+
69
  echo $html;
70
  ?>
71
 
views/tools/controller.php CHANGED
@@ -16,13 +16,16 @@ $current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'logging';
16
  <?php duplicator_header(__("Tools", 'wpduplicator')) ?>
17
 
18
  <h2 class="nav-tab-wrapper">
19
- <a href="?page=duplicator-tools" class="nav-tab <?php echo ($current_tab == 'logging') ? 'nav-tab-active' : '' ?>"> <?php _e('Logging', 'wpduplicator'); ?></a>
20
- <a href="?page=duplicator-tools&tab=cleanup" class="nav-tab <?php echo ($current_tab != 'logging') ? 'nav-tab-active' : '' ?>"> <?php _e('Cleanup', 'wpduplicator'); ?></a>
 
21
  </h2>
22
 
23
  <?php
24
  switch ($current_tab) {
25
  case 'logging': include('logging.php');
 
 
26
  break;
27
  case 'cleanup': include('cleanup.php');
28
  break;
16
  <?php duplicator_header(__("Tools", 'wpduplicator')) ?>
17
 
18
  <h2 class="nav-tab-wrapper">
19
+ <a href="?page=duplicator-tools&tab=logging" class="nav-tab <?php echo ($current_tab == 'logging') ? 'nav-tab-active' : '' ?>"> <?php _e('Logging', 'wpduplicator'); ?></a>
20
+ <a href="?page=duplicator-tools&tab=diagnostics" class="nav-tab <?php echo ($current_tab == 'diagnostics') ? 'nav-tab-active' : '' ?>"> <?php _e('Diagnostics', 'wpduplicator'); ?></a>
21
+ <a href="?page=duplicator-tools&tab=cleanup" class="nav-tab <?php echo ($current_tab == 'cleanup') ? 'nav-tab-active' : '' ?>"> <?php _e('Cleanup', 'wpduplicator'); ?></a>
22
  </h2>
23
 
24
  <?php
25
  switch ($current_tab) {
26
  case 'logging': include('logging.php');
27
+ break;
28
+ case 'diagnostics': include('diagnostics.php');
29
  break;
30
  case 'cleanup': include('cleanup.php');
31
  break;
views/{settings → tools}/diagnostics.php RENAMED
@@ -64,7 +64,7 @@
64
  textarea.dup-opts-read {width:100%; height:40px; font-size:12px}
65
  </style>
66
 
67
- <form id="dup-settings-form" action="<?php echo admin_url( 'admin.php?page=duplicator-settings&tab=diagnostics' ); ?>" method="post">
68
  <?php wp_nonce_field( 'duplicator_settings_page' ); ?>
69
  <input type="hidden" id="dup-settings-form-action" name="action" value="">
70
  <br/>
@@ -89,11 +89,19 @@
89
  <tr>
90
  <td><?php _e("Duplicator Version", 'wpduplicator'); ?></td>
91
  <td><?php echo DUPLICATOR_VERSION ?></td>
92
- </tr>
93
  <tr>
94
  <td><?php _e("Operating System", 'wpduplicator'); ?></td>
95
  <td><?php echo PHP_OS ?></td>
96
- </tr>
 
 
 
 
 
 
 
 
97
  <tr>
98
  <td><?php _e("Web Server", 'wpduplicator'); ?></td>
99
  <td><?php echo $_SERVER['SERVER_SOFTWARE'] ?></td>
64
  textarea.dup-opts-read {width:100%; height:40px; font-size:12px}
65
  </style>
66
 
67
+ <form id="dup-settings-form" action="<?php echo admin_url( 'admin.php?page=duplicator-tools&tab=diagnostics' ); ?>" method="post">
68
  <?php wp_nonce_field( 'duplicator_settings_page' ); ?>
69
  <input type="hidden" id="dup-settings-form-action" name="action" value="">
70
  <br/>
89
  <tr>
90
  <td><?php _e("Duplicator Version", 'wpduplicator'); ?></td>
91
  <td><?php echo DUPLICATOR_VERSION ?></td>
92
+ </tr>
93
  <tr>
94
  <td><?php _e("Operating System", 'wpduplicator'); ?></td>
95
  <td><?php echo PHP_OS ?></td>
96
+ </tr>
97
+ <tr>
98
+ <td><?php _e("Timezone", 'wpduplicator'); ?></td>
99
+ <td><?php echo date_default_timezone_get() ; ?> &nbsp; <small><i>This is a <a href='options-general.php'>WordPress setting</a></i></small></td>
100
+ </tr>
101
+ <tr>
102
+ <td><?php _e("Server Time", 'wpduplicator'); ?></td>
103
+ <td><?php echo date("Y-m-d H:i:s"); ?></td>
104
+ </tr>
105
  <tr>
106
  <td><?php _e("Web Server", 'wpduplicator'); ?></td>
107
  <td><?php echo $_SERVER['SERVER_SOFTWARE'] ?></td>