Duplicator – WordPress Migration Plugin - Version 1.2.8

Version Description

Download this release

Release Info

Developer bobriley
Plugin Icon 128x128 Duplicator – WordPress Migration Plugin
Version 1.2.8
Comparing to
See all releases

Code changes from version 1.2.6 to 1.2.8

assets/css/style.css CHANGED
@@ -52,6 +52,11 @@ div.dup-dlg-confirm-txt {padding:10px 0; font-size:16px}
52
  div.dup-dlg-confirm-btns {position:absolute; bottom:20px; right:20px;}
53
  div.dup-dlg-confirm-progress {display:none}
54
 
 
 
 
 
 
55
 
56
  /*================================================
57
  PARSLEY:Overrides*/
52
  div.dup-dlg-confirm-btns {position:absolute; bottom:20px; right:20px;}
53
  div.dup-dlg-confirm-progress {display:none}
54
 
55
+ /*ADMIN: NOTICES */
56
+ div#dup-global-error-reserved-files p {font-size:14px}
57
+ div#dup-global-error-reserved-files b.pass-msg {color:green; font-size:20px}
58
+ div#dup-global-error-reserved-files p.pass-lnks {line-height:24px; margin:-7px 0 0 5px}
59
+ div#dup-global-error-reserved-files div.pass-msg {padding:5px 0 0 10px; font-size:11px; color:#999; font-style: italic}
60
 
61
  /*================================================
62
  PARSLEY:Overrides*/
assets/js/javascript.php CHANGED
@@ -106,6 +106,22 @@ Duplicator.UI.ToggleMetaBox = function()
106
 
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  //Init
110
  jQuery(document).ready(function($)
111
  {
106
 
107
  }
108
 
109
+ Duplicator.UI.readonly = function(item)
110
+ {
111
+ jQuery(item).attr('readonly', 'true').css({color:'#999'});
112
+ }
113
+
114
+ Duplicator.UI.disable = function(item)
115
+ {
116
+ jQuery(item).attr('disabled', 'true').css({color:'#999'});
117
+ }
118
+
119
+ Duplicator.UI.enable = function(item)
120
+ {
121
+ jQuery(item).removeAttr('disabled').css({color:'#000'});
122
+ jQuery(item).removeAttr('readonly').css({color:'#000'});
123
+ }
124
+
125
  //Init
126
  jQuery(document).ready(function($)
127
  {
classes/package/class.pack.archive.php CHANGED
@@ -6,12 +6,16 @@ require_once (DUPLICATOR_PLUGIN_PATH.'classes/package/class.pack.archive.zip.php
6
  require_once (DUPLICATOR_PLUGIN_PATH.'lib/forceutf8/Encoding.php');
7
 
8
  /**
9
- * Used to create the archive file
10
  *
11
- * @package Duplicator
 
 
 
12
  * @subpackage classes/package
13
  * @copyright (c) 2017, Snapcreek LLC
14
- * @since 1.1.0
 
15
  *
16
  */
17
  class DUP_Archive
@@ -22,6 +26,7 @@ class DUP_Archive
22
  public $FilterDirsAll = array();
23
  public $FilterExtsAll = array();
24
  public $FilterOn;
 
25
  public $File;
26
  public $Format;
27
  public $PackDir;
@@ -38,9 +43,10 @@ class DUP_Archive
38
  */
39
  public function __construct($package)
40
  {
41
- $this->Package = $package;
42
- $this->FilterOn = false;
43
- $this->FilterInfo = new DUP_Archive_Filter_Info();
 
44
  }
45
 
46
  /**
@@ -77,26 +83,6 @@ class DUP_Archive
77
  }
78
  }
79
 
80
- /**
81
- * Gets the filter directory paths as an array
82
- *
83
- * @return array Returns an array of filter directory paths
84
- */
85
- public function getFilterDirAsArray()
86
- {
87
- return array_map('DUP_Util::safePath', explode(";", $this->FilterDirs, -1));
88
- }
89
-
90
- /**
91
- * Gets the filter file extensions as an array
92
- *
93
- * @return array Returns an array of filter file extensions
94
- */
95
- public function getFilterExtsAsArray()
96
- {
97
- return explode(";", $this->FilterExts, -1);
98
- }
99
-
100
  /**
101
  * Builds a list of files and directories to be included in the archive
102
  *
@@ -105,12 +91,28 @@ class DUP_Archive
105
  *
106
  * @return obj Returns a DUP_Archive object
107
  */
108
- public function getScanData()
109
  {
110
- $this->createFilterInfo();
111
- $this->getDirs();
112
- $this->getFiles();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  return $this;
 
 
114
  }
115
 
116
  /**
@@ -135,144 +137,147 @@ class DUP_Archive
135
  $this->FilterExtsAll = array_merge($this->FilterInfo->Exts->Instance, $this->FilterInfo->Exts->Core);
136
  }
137
 
138
- /**
139
- * Builds the directory list and directory filter lists
140
- *
141
- * @return null
142
- */
143
- private function getDirs()
144
  {
145
- $rootPath = DUP_Util::safePath(rtrim(DUPLICATOR_WPROOTPATH, '//'));
146
- $this->Dirs = array();
147
-
148
- //@todo remove after 1.2.2 no reason to include files with root filter
149
- //If the root directory is a filter then we will only need the root files
150
- /*if (in_array($this->PackDir, $this->FilterDirsAll)) {
151
- $this->Dirs[] = $this->PackDir;
152
- } else {
153
- $this->Dirs = $this->dirsToArray($rootPath, $this->FilterDirsAll);
154
- $this->Dirs[] = $this->PackDir;
155
- }*/
156
-
157
- $this->Dirs = $this->dirsToArray($rootPath, $this->FilterDirsAll);
158
- $this->Dirs[] = $this->PackDir;
159
-
160
- //Filter Directories
161
- //Invalid test contains checks for: characters over 250, invlaid characters,
162
- //empty string and directories ending with period (Windows incompatable)
163
  foreach ($this->Dirs as $key => $val) {
164
  $name = basename($val);
165
 
166
- $warn_test = strlen($val) > 250 || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $name)
167
- || trim($name) == "" || (strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.')
168
- || preg_match('/[^\x20-\x7f]/', $name);
169
- if ($warn_test) {
170
- $this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
171
- }
172
-
173
- //UNREADABLE: Directory is unreadable flag it
174
- if (!is_readable($this->Dirs[$key])) {
 
 
 
 
 
 
175
  unset($this->Dirs[$key]);
176
- $this->FilterInfo->Dirs->Unreadable[] = $val;
177
- $this->FilterDirsAll[] = $val;
178
  }
179
  }
180
  }
181
 
182
-
183
- /**
184
- * Get all files and filter out error prone subsets
185
- *
186
- * @return null
187
- */
188
- private function getFiles()
189
  {
190
- foreach ($this->Dirs as $key => $val) {
191
- $files = DUP_Util::listFiles($val);
192
- foreach ($files as $filePath) {
193
- $fileName = basename($filePath);
194
- if (!is_dir($filePath)) {
195
- if (!in_array(@pathinfo($filePath, PATHINFO_EXTENSION), $this->FilterExtsAll)) {
196
- //Unreadable
197
- if (!is_readable($filePath)) {
198
- $this->FilterInfo->Files->Unreadable[] = $filePath;
199
- continue;
200
- }
201
-
202
- $fileSize = @filesize($filePath);
203
- $fileSize = empty($fileSize) ? 0 : $fileSize;
204
- $invalid_test = strlen($filePath) > 250 ||
205
- preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $fileName) ||
206
- trim($fileName) == "";
207
-
208
- if ($invalid_test || preg_match('/[^\x20-\x7f]/', $fileName)) {
209
- $filePath = DUP_Encoding::toUTF8($filePath);
210
- $this->FilterInfo->Files->Warning[] = $filePath;
211
- }
212
- $this->Size += $fileSize;
213
- $this->Files[] = $filePath;
214
-
215
-
216
- if ($fileSize > DUPLICATOR_SCAN_WARNFILESIZE) {
217
- $this->FilterInfo->Files->Size[] = $filePath.' ['.DUP_Util::byteSize($fileSize).']';
218
- }
219
- }
220
- }
221
- }
222
- }
 
 
 
223
  }
224
 
225
-
226
- /**
227
- * Recursive function to get all Directories in a wp install
228
- *
229
- * @param string $path The path of the directory to add to the array
230
- * @param array $filterDirsAll An array of all the filtered directories
231
  *
232
- * NOTE: Older PHP logic which is more stable on older version of PHP
233
- * RecursiveIteratorIterator is problematic on some systems issues include:
234
- * - error 'too many files open' for recursion
235
- * - $file->getExtension() is not reliable as it silently fails at least in php 5.2.9
236
- * - issues with when a file has a permission such as 705 and trying to get info (had to fallback to pathinfo)
237
- * - basic conclusion wait on the SPL libs untill after php 5.4 is a requiremnt
238
- * - inside a tight recursive loop lets remove the utiltiy call DUP_Util::safePath("{$path}/{$file}") and
239
- * squeeze out as much performance as possible
240
  *
241
- * @return null
242
  */
243
- private function dirsToArray($path, $filterDirsAll)
244
  {
245
- $items = array();
246
- $handle = @opendir($path);
247
- if ($handle) {
248
- while (($file = readdir($handle)) !== false) {
249
- if ($file != '.' && $file != '..') {
250
- $fullPath = str_replace("\\", '/', "{$path}/{$file}");
251
-
252
- if (is_dir($fullPath)) {
253
- $addDir = true;
254
-
255
- //Remove path filter directories
256
- foreach ($filterDirsAll as $filterDir) {
257
- $trimmedFilterDir = rtrim($filterDir, '/');
258
-
259
- if ($fullPath == $trimmedFilterDir || strstr($fullPath, $trimmedFilterDir.'/')) {
260
- $addDir = false;
261
- break;
262
- }
263
- }
264
-
265
- if ($addDir) {
266
- $items = array_merge($items, $this->dirsToArray($fullPath, $filterDirsAll));
267
- $items[] = $fullPath;
268
- }
269
- }
270
- }
271
- }
272
- closedir($handle);
273
- }
274
-
275
- return $items;
276
- }
277
- }
278
- ?>
 
 
 
 
 
 
 
 
 
6
  require_once (DUPLICATOR_PLUGIN_PATH.'lib/forceutf8/Encoding.php');
7
 
8
  /**
9
+ * Class for handleing archive setup and build process
10
  *
11
+ * Standard: PSR-2 (almost)
12
+ * @link http://www.php-fig.org/psr/psr-2
13
+ *
14
+ * @package DUP
15
  * @subpackage classes/package
16
  * @copyright (c) 2017, Snapcreek LLC
17
+ * @license https://opensource.org/licenses/GPL-3.0 GNU Public License
18
+ * @since 1.0.0
19
  *
20
  */
21
  class DUP_Archive
26
  public $FilterDirsAll = array();
27
  public $FilterExtsAll = array();
28
  public $FilterOn;
29
+ public $ExportOnlyDB;
30
  public $File;
31
  public $Format;
32
  public $PackDir;
43
  */
44
  public function __construct($package)
45
  {
46
+ $this->Package = $package;
47
+ $this->FilterOn = false;
48
+ $this->ExportOnlyDB = false;
49
+ $this->FilterInfo = new DUP_Archive_Filter_Info();
50
  }
51
 
52
  /**
83
  }
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  /**
87
  * Builds a list of files and directories to be included in the archive
88
  *
91
  *
92
  * @return obj Returns a DUP_Archive object
93
  */
94
+ public function buildScanStats()
95
  {
96
+ $this->createFilterInfo();
97
+
98
+ $rootPath = DUP_Util::safePath(rtrim(DUPLICATOR_WPROOTPATH, '//'));
99
+ $rootPath = (trim($rootPath) == '') ? '/' : $rootPath;
100
+
101
+ //If the root directory is a filter then skip it all
102
+ if (in_array($this->PackDir, $this->FilterDirsAll) || $this->Package->Archive->ExportOnlyDB) {
103
+ $this->Dirs = array();
104
+ } else {
105
+ $this->Dirs[] = $this->PackDir;
106
+ $this->getFileLists($rootPath);
107
+ $this->setDirFilters();
108
+ $this->setFileFilters();
109
+ }
110
+
111
+ $this->FilterDirsAll = array_merge($this->FilterDirsAll, $this->FilterInfo->Dirs->Unreadable);
112
+ $this->FilterFilesAll = array_merge($this->FilterFilesAll, $this->FilterInfo->Files->Unreadable);
113
  return $this;
114
+
115
+
116
  }
117
 
118
  /**
137
  $this->FilterExtsAll = array_merge($this->FilterInfo->Exts->Instance, $this->FilterInfo->Exts->Core);
138
  }
139
 
140
+ /**
141
+ * Get All Directories then filter
142
+ *
143
+ * @return null
144
+ */
145
+ private function setDirFilters()
146
  {
147
+ $this->FilterInfo->Dirs->Warning = array();
148
+ $this->FilterInfo->Dirs->Unreadable = array();
149
+
150
+ //Filter directories invalid test checks for:
151
+ // - characters over 250
152
+ // - invlaid characters
153
+ // - empty string
154
+ // - directories ending with period (Windows incompatable)
 
 
 
 
 
 
 
 
 
 
155
  foreach ($this->Dirs as $key => $val) {
156
  $name = basename($val);
157
 
158
+ //Locate invalid directories and warn
159
+ $invalid_test = strlen($val) > 250
160
+ || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $name)
161
+ || trim($name) == ''
162
+ || (strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.')
163
+ || preg_match('/[^\x20-\x7f]/', $name);
164
+
165
+ if ($invalid_test) {
166
+ $this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
167
+ }
168
+
169
+ //@todo: CJL addEmptyDir works with unreadable dirs, this check maybe unnessary
170
+ //@todo: CJL Move unset logic out of loop
171
+ //Dir is not readble remove and flag
172
+ if (! is_readable($this->Dirs[$key])) {
173
  unset($this->Dirs[$key]);
174
+ $unreadable_dir = DUP_Encoding::toUTF8($val);
175
+ $this->FilterInfo->Dirs->Unreadable[] = $unreadable_dir;
176
  }
177
  }
178
  }
179
 
180
+ /**
181
+ * Get all files and filter out error prone subsets
182
+ *
183
+ * @return null
184
+ */
185
+ private function setFileFilters()
 
186
  {
187
+ //Init for each call to prevent concatination from stored entity objects
188
+ $this->Size = 0;
189
+ $this->FilterInfo->Files->Size = array();
190
+ $this->FilterInfo->Files->Warning = array();
191
+ $this->FilterInfo->Files->Unreadable = array();
192
+
193
+ foreach ($this->Files as $key => $filePath) {
194
+
195
+ $fileName = basename($filePath);
196
+
197
+ //@todo: CJL Move unset logic out of loop
198
+ if (! is_readable($filePath)) {
199
+ unset($this->Files[$key]);
200
+ $this->FilterInfo->Files->Unreadable[] = $filePath;
201
+ continue;
202
+ }
203
+
204
+ $invalid_test = strlen($filePath) > 250
205
+ || preg_match('/(\/|\*|\?|\>|\<|\:|\\|\|)/', $fileName)
206
+ || trim($fileName) == ""
207
+ || preg_match('/[^\x20-\x7f]/', $fileName);
208
+
209
+ if ($invalid_test) {
210
+ $filePath = DUP_Encoding::toUTF8($filePath);
211
+ $this->FilterInfo->Files->Warning[] = $filePath;
212
+ }
213
+
214
+
215
+ $fileSize = @filesize($filePath);
216
+ $fileSize = empty($fileSize) ? 0 : $fileSize;
217
+ $this->Size += $fileSize;
218
+
219
+ if ($fileSize > DUPLICATOR_SCAN_WARNFILESIZE) {
220
+ $this->FilterInfo->Files->Size[] = $filePath.' ['.DUP_Util::byteSize($fileSize).']';
221
+ }
222
+ }
223
  }
224
 
225
+ /**
226
+ * Recursive function to get all directories in a wp install
 
 
 
 
227
  *
228
+ * @notes:
229
+ * Older PHP logic which is more stable on older version of PHP
230
+ * NOTE RecursiveIteratorIterator is problematic on some systems issues include:
231
+ * - error 'too many files open' for recursion
232
+ * - $file->getExtension() is not reliable as it silently fails at least in php 5.2.17
233
+ * - issues with when a file has a permission such as 705 and trying to get info (had to fallback to pathinfo)
234
+ * - basic conclusion wait on the SPL libs untill after php 5.4 is a requiremnt
235
+ * - tight recursive loop use caution for speed
236
  *
237
+ * @return array Returns an array of directories to include in the archive
238
  */
239
+ private function getFileLists($path)
240
  {
241
+ $handle = @opendir($path);
242
+
243
+ if ($handle) {
244
+ while (($file = readdir($handle)) !== false) {
245
+
246
+ if ($file == '.' || $file == '..') {
247
+ continue;
248
+ }
249
+
250
+ $fullPath = str_replace("\\", '/', "{$path}/{$file}");
251
+
252
+ // @todo: Don't leave it like this. Convert into an option on the package to not follow symbolic links
253
+ // if (is_dir($fullPath) && (is_link($fullPath) == false))
254
+ if (is_dir($fullPath)) {
255
+
256
+ $add = true;
257
+ //Remove path filter directories
258
+ foreach ($this->FilterDirsAll as $val) {
259
+ $trimmedFilterDir = rtrim($val, '/');
260
+ if ($fullPath == $trimmedFilterDir || strpos($fullPath, $trimmedFilterDir . '/') !== false) {
261
+ $add = false;
262
+ break;
263
+ }
264
+ }
265
+
266
+ if ($add) {
267
+ $this->getFileLists($fullPath);
268
+ $this->Dirs[] = $fullPath;
269
+ }
270
+ } else {
271
+ // Note: The last clause is present to perform just a filename check
272
+ if ( ! in_array(pathinfo($file, PATHINFO_EXTENSION) , $this->FilterExtsAll)) {
273
+ $this->Files[] = $fullPath;
274
+ }
275
+ }
276
+ }
277
+ closedir($handle);
278
+ }
279
+ return $this->Dirs;
280
+ }
281
+
282
+
283
+ }
classes/package/class.pack.installer.php CHANGED
@@ -153,6 +153,7 @@ class DUP_Installer
153
  //GENERAL
154
  "fwrite_url_old" => get_option('siteurl'),
155
  "fwrite_archive_name" => "{$this->Package->NameHash}_archive.zip",
 
156
  "fwrite_package_notes" => $this->Package->Notes,
157
  "fwrite_secure_name" => $this->Package->NameHash,
158
  "fwrite_url_new" => $this->Package->Installer->OptsURLNew,
@@ -169,6 +170,7 @@ class DUP_Installer
169
  "fwrite_opts_delete" => json_encode($deleteOpts),
170
  "fwrite_blogname" => esc_html(get_option('blogname')),
171
  "fwrite_wproot" => DUPLICATOR_WPROOTPATH,
 
172
  "fwrite_duplicator_version" => DUPLICATOR_VERSION);
173
 
174
  if (file_exists($template) && is_readable($template)) {
153
  //GENERAL
154
  "fwrite_url_old" => get_option('siteurl'),
155
  "fwrite_archive_name" => "{$this->Package->NameHash}_archive.zip",
156
+ "fwrite_archive_onlydb" => $this->Package->Archive->ExportOnlyDB,
157
  "fwrite_package_notes" => $this->Package->Notes,
158
  "fwrite_secure_name" => $this->Package->NameHash,
159
  "fwrite_url_new" => $this->Package->Installer->OptsURLNew,
170
  "fwrite_opts_delete" => json_encode($deleteOpts),
171
  "fwrite_blogname" => esc_html(get_option('blogname')),
172
  "fwrite_wproot" => DUPLICATOR_WPROOTPATH,
173
+ "fwrite_wplogin_url" => wp_login_url(),
174
  "fwrite_duplicator_version" => DUPLICATOR_VERSION);
175
 
176
  if (file_exists($template) && is_readable($template)) {
classes/package/class.pack.php CHANGED
@@ -104,7 +104,7 @@ class DUP_Package
104
  $report['SRV'] = $srv['SRV'];
105
 
106
  //FILES
107
- $this->Archive->getScanData();
108
  $dirCount = count($this->Archive->Dirs);
109
  $fileCount = count($this->Archive->Files);
110
  $fullCount = $dirCount + $fileCount;
@@ -325,6 +325,7 @@ class DUP_Package
325
  $this->Archive->PackDir = rtrim(DUPLICATOR_WPROOTPATH, '/');
326
  $this->Archive->Format = 'ZIP';
327
  $this->Archive->FilterOn = isset($post['filter-on']) ? 1 : 0;
 
328
  $this->Archive->FilterDirs = esc_html($filter_dirs);
329
  $this->Archive->FilterExts = str_replace(array('.', ' '), "", esc_html($filter_exts));
330
  //INSTALLER
@@ -449,6 +450,7 @@ class DUP_Package
449
  }
450
  //Incase unserilaize fails
451
  $obj = (is_object($obj)) ? $obj : new DUP_Package();
 
452
  return $obj;
453
  }
454
 
@@ -503,7 +505,7 @@ class DUP_Package
503
  if ($all) {
504
  $dir = DUPLICATOR_SSDIR_PATH_TMP."/*";
505
  foreach (glob($dir) as $file) {
506
- unlink($file);
507
  }
508
  }
509
  //Remove scan files that are 24 hours old
@@ -511,7 +513,7 @@ class DUP_Package
511
  $dir = DUPLICATOR_SSDIR_PATH_TMP."/*_scan.json";
512
  foreach (glob($dir) as $file) {
513
  if (filemtime($file) <= time() - 86400) {
514
- unlink($file);
515
  }
516
  }
517
  }
@@ -582,7 +584,7 @@ class DUP_Package
582
  $name = basename($file);
583
  if (strstr($name, $this->NameHash)) {
584
  copy($file, "{$newPath}/{$name}");
585
- unlink($file);
586
  }
587
  }
588
  }
104
  $report['SRV'] = $srv['SRV'];
105
 
106
  //FILES
107
+ $this->Archive->buildScanStats();
108
  $dirCount = count($this->Archive->Dirs);
109
  $fileCount = count($this->Archive->Files);
110
  $fullCount = $dirCount + $fileCount;
325
  $this->Archive->PackDir = rtrim(DUPLICATOR_WPROOTPATH, '/');
326
  $this->Archive->Format = 'ZIP';
327
  $this->Archive->FilterOn = isset($post['filter-on']) ? 1 : 0;
328
+ $this->Archive->ExportOnlyDB = isset($post['export-onlydb']) ? 1 : 0;
329
  $this->Archive->FilterDirs = esc_html($filter_dirs);
330
  $this->Archive->FilterExts = str_replace(array('.', ' '), "", esc_html($filter_exts));
331
  //INSTALLER
450
  }
451
  //Incase unserilaize fails
452
  $obj = (is_object($obj)) ? $obj : new DUP_Package();
453
+
454
  return $obj;
455
  }
456
 
505
  if ($all) {
506
  $dir = DUPLICATOR_SSDIR_PATH_TMP."/*";
507
  foreach (glob($dir) as $file) {
508
+ @unlink($file);
509
  }
510
  }
511
  //Remove scan files that are 24 hours old
513
  $dir = DUPLICATOR_SSDIR_PATH_TMP."/*_scan.json";
514
  foreach (glob($dir) as $file) {
515
  if (filemtime($file) <= time() - 86400) {
516
+ @unlink($file);
517
  }
518
  }
519
  }
584
  $name = basename($file);
585
  if (strstr($name, $this->NameHash)) {
586
  copy($file, "{$newPath}/{$name}");
587
+ @unlink($file);
588
  }
589
  }
590
  }
classes/ui/class.ui.notice.php CHANGED
@@ -21,6 +21,7 @@ if (!defined('DUPLICATOR_VERSION')) {
21
  class DUP_UI_Notice
22
  {
23
 
 
24
  /**
25
  * Shows a display message in the wp-admin if any researved files are found
26
  *
@@ -31,21 +32,47 @@ class DUP_UI_Notice
31
  //Show only on Duplicator pages and Dashboard when plugin is active
32
  $dup_active = is_plugin_active('duplicator/duplicator.php');
33
  $dup_perm = current_user_can('manage_options');
34
- if (!$dup_active || !$dup_perm) return;
 
 
 
 
 
35
 
36
  if (DUP_Server::hasInstallerFiles()) {
37
- $screen = get_current_screen();
38
- $on_active_tab = isset($_GET['tab']) && $_GET['tab'] == 'cleanup' ? true : false;
39
-
40
- echo '<div class="error" id="dup-global-error-reserved-files"><p>';
41
- if ($screen->id == 'duplicator_page_duplicator-tools' && $on_active_tab) {
42
- _e('Reserved Duplicator install files have been detected in the root directory. Please delete these reserved files to avoid security issues.', 'duplicator');
43
- } else {
44
- $duplicator_nonce = wp_create_nonce('duplicator_cleanup_page');
45
- _e('Reserved Duplicator install files have been detected in the root directory. Please delete these reserved files to avoid security issues.', 'duplicator');
46
- @printf("<br/><a href='admin.php?page=duplicator-tools&tab=cleanup&_wpnonce=%s'>%s</a>", $duplicator_nonce, __('Take me to the cleanup page!', 'duplicator'));
47
- }
48
- echo "</p></div>";
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
  }
21
  class DUP_UI_Notice
22
  {
23
 
24
+
25
  /**
26
  * Shows a display message in the wp-admin if any researved files are found
27
  *
32
  //Show only on Duplicator pages and Dashboard when plugin is active
33
  $dup_active = is_plugin_active('duplicator/duplicator.php');
34
  $dup_perm = current_user_can('manage_options');
35
+ if (!$dup_active || !$dup_perm)
36
+ return;
37
+
38
+ $screen = get_current_screen();
39
+ if (!isset($screen))
40
+ return;
41
 
42
  if (DUP_Server::hasInstallerFiles()) {
43
+
44
+ $screen = get_current_screen();
45
+ $on_active_tab = isset($_GET['tab']) && $_GET['tab'] == 'cleanup' ? true : false;
46
+ $dup_nonce = wp_create_nonce('duplicator_cleanup_page');
47
+ $msg1 = __('This site has been successfully migrated!', 'duplicator');
48
+ $msg2 = __('Migration Almost Complete!', 'duplicator');
49
+ $msg3 = __('Please complete these final steps:', 'duplicator');
50
+ $msg4 = __('This message will be removed after all installer files are removed. Installer files must be removed to maintain a secure site.<br/>'
51
+ . 'Click the link above or button below to remove all installer files and complete the migration.', 'duplicator');
52
+
53
+ echo '<div class="updated notice" id="dup-global-error-reserved-files"><p>';
54
+
55
+ //On Cleanup Page
56
+ if ($screen->id == 'duplicator_page_duplicator-tools' && $on_active_tab) {
57
+ echo "<b class='pass-msg'><i class='fa fa-check-circle'></i> {$msg1}</b> <br/>";
58
+ echo "{$msg3}";
59
+ echo '<p class="pass-lnks">';
60
+ @printf("1. <a href='https://wordpress.org/support/plugin/duplicator/reviews/?filter=5' target='wporg'>%s</a> <br/> ", __('Optionally, Review Duplicator at WordPress.org...', 'duplicator'));
61
+ @printf("2. <a href='javascript:void(0)' onclick='jQuery(\"#dup-remove-installer-files-btn\").click()'>%s</a><br/>", __('Remove Installation Files Now!', 'duplicator'));
62
+ echo '</p>';
63
+ echo "<div class='pass-msg'>{$msg4}</div>";
64
+
65
+ //All other Pages
66
+ } else {
67
+ echo "<b>{$msg2}</b> <br/>";
68
+ echo '<p class="pass-lnks">';
69
+ _e('Reserved Duplicator installation still exist in the root directory. Please remove these installation files to complete setup and avoid security issues. <br/>', 'duplicator');
70
+ _e('Go to: Duplicator > Tools > Cleanup > and click the "Remove Installation Files" button.', 'duplicator');
71
+ @printf("<br/><a href='admin.php?page=duplicator-tools&tab=cleanup&_wpnonce={$dup_nonce}'>%s</a> <br/>", __('Take me there now!', 'duplicator'));
72
+ echo '</p>';
73
+ }
74
+
75
+ echo "</p></div>";
76
+ }
77
  }
78
  }
classes/utilities/class.u.scancheck.php CHANGED
@@ -134,10 +134,9 @@ class DUP_ScanCheck
134
  */
135
  private function isLink($target)
136
  {
 
137
  if ($this->isWindows) {
138
- if (file_exists($target) && @readlink($target) != $target) {
139
- return true;
140
- }
141
  } elseif (is_link($target)) {
142
  return true;
143
  }
134
  */
135
  private function isLink($target)
136
  {
137
+ //Currently Windows does not support sym-link detection
138
  if ($this->isWindows) {
139
+ return false;
 
 
140
  } elseif (is_link($target)) {
141
  return true;
142
  }
ctrls/ctrl.base.php CHANGED
@@ -1,149 +1,159 @@
1
  <?php
2
-
3
- require_once(DUPLICATOR_PLUGIN_PATH . '/classes/utilities/class.u.php');
4
 
5
  //Enum used to define the various test statues
6
  final class DUP_CTRL_Status
7
  {
8
- const ERROR = -2;
9
- const FAILED = -1;
10
- const UNDEFINED = 0;
11
- const SUCCESS = 1;
12
  }
13
 
14
  /**
15
  * Base class for all controllers
16
  *
17
- * @package Dupicator\ctrls\
 
18
  */
19
  class DUP_CTRL_Base
20
  {
21
  //Represents the name of the Nonce Action
22
  public $Action;
23
-
24
  //The return type valiad options: PHP, JSON-AJAX, JSON
25
- public $ReturnType = 'JSON-AJAX';
26
 
27
- public function SetResponseType($type)
28
  {
29
  $opts = array('PHP', 'JSON-AJAX', 'JSON');
30
- if (!in_array($type, $opts))
31
- {
32
- throw new Exception('The $type param must be one of the following: ' . implode(',', $opts) . ' for the following function [' . __FUNCTION__.']');
33
  }
34
- $this->ReturnType = $type;
35
  }
36
-
37
- public function PostParamMerge($post)
38
  {
39
- $post = is_array($post) ? $post : array();
40
  return array_merge($_POST, $post);
41
  }
42
  }
43
 
44
-
45
-
46
  /**
47
  * A class structer used to report on controller methods
48
  *
49
- * @package Dupicator\ctrls\
 
50
  */
51
  class DUP_CTRL_Report
52
  {
53
  //Properties
54
- public $RunTime;
55
- public $ReturnType;
56
- public $Results;
57
- public $Status;
58
- }
59
 
 
60
 
61
  /**
62
- * A class used format all controller responses in a consitent format
63
- * Every controller response will have a Report and Payload structer
64
- * The Payload is an array of the result response. The Report is used
65
  * report on the overall status of the controller method
66
- *
67
- * @package Dupicator\ctrls\
 
 
 
 
 
 
68
  */
69
  class DUP_CTRL_Result
70
  {
71
  //Properties
72
- public $Report;
73
- public $Payload;
74
-
75
- private $time_start;
76
- private $time_end;
77
  private $CTRL;
78
-
79
- function __construct(DUP_CTRL_Base $CTRL_OBJ)
80
  {
81
  DUP_Util::hasCapability('read');
82
- $this->time_start = $this->microtimeFloat();
83
- $this->CTRL = $CTRL_OBJ;
84
-
85
  //Report Data
86
- $this->Report = new DUP_CTRL_Report();
87
- $this->Report->ReturnType = $CTRL_OBJ->ReturnType;
88
  }
89
-
90
- public function Process($payload, $test = DUP_CTRL_Status::UNDEFINED)
 
 
 
 
 
 
 
 
91
  {
92
- if (is_array($this->Payload))
93
- {
94
- $this->Payload[] = $payload;
95
- $this->Report->Results = count($this->Payload);
96
  } else {
97
- $this->Payload = $payload;
98
- $this->Report->Results = 1;
99
  }
100
-
101
- $this->Report->Status = $test;
102
  $this->getProcessTime();
103
-
104
- switch ($this->CTRL->ReturnType)
105
- {
106
- case 'JSON' :
107
  return json_encode($this);
108
  break;
109
-
110
  case 'PHP' :
111
  return $this;
112
- break;
113
-
114
  default:
115
- if (!headers_sent()) {
116
  header('Content-Type: application/json');
117
  }
118
- return die(json_encode($this));
119
  break;
120
  }
121
  }
122
-
123
- public function ProcessError($exception)
 
 
 
 
 
 
 
124
  {
125
- $payload = array();
126
- $payload['Message'] = $exception->getMessage();
127
- $payload['File'] = $exception->getFile();
128
- $payload['Line'] = $exception->getLine();
129
- $payload['Trace'] = $exception->getTraceAsString();
130
- $this->Process($payload, DUP_CTRL_Status::ERROR);
131
  die(json_encode($this));
132
  }
133
-
134
  private function getProcessTime()
135
  {
136
- $this->time_end = $this->microtimeFloat();
137
- $this->Report->RunTime = $this->time_end - $this->time_start;
138
  }
139
-
140
  private function microtimeFloat()
141
  {
142
  list($usec, $sec) = explode(" ", microtime());
143
- return ((float)$usec + (float)$sec);
144
  }
145
-
146
-
147
-
148
- }
149
- ?>
1
  <?php
2
+ require_once(DUPLICATOR_PLUGIN_PATH.'/classes/utilities/class.u.php');
 
3
 
4
  //Enum used to define the various test statues
5
  final class DUP_CTRL_Status
6
  {
7
+ const ERROR = -2;
8
+ const FAILED = -1;
9
+ const UNDEFINED = 0;
10
+ const SUCCESS = 1;
11
  }
12
 
13
  /**
14
  * Base class for all controllers
15
  *
16
+ * @package Duplicator
17
+ * @subpackage classes/ctrls
18
  */
19
  class DUP_CTRL_Base
20
  {
21
  //Represents the name of the Nonce Action
22
  public $Action;
 
23
  //The return type valiad options: PHP, JSON-AJAX, JSON
24
+ public $returnType = 'JSON-AJAX';
25
 
26
+ public function setResponseType($type)
27
  {
28
  $opts = array('PHP', 'JSON-AJAX', 'JSON');
29
+ if (!in_array($type, $opts)) {
30
+ throw new Exception('The $type param must be one of the following: '.implode(',', $opts).' for the following function ['.__FUNCTION__.']');
 
31
  }
32
+ $this->returnType = $type;
33
  }
34
+
35
+ public function postParamMerge($post)
36
  {
37
+ $post = is_array($post) ? $post : array();
38
  return array_merge($_POST, $post);
39
  }
40
  }
41
 
 
 
42
  /**
43
  * A class structer used to report on controller methods
44
  *
45
+ * @package Duplicator
46
+ * @subpackage classes/ctrls
47
  */
48
  class DUP_CTRL_Report
49
  {
50
  //Properties
51
+ public $runTime;
52
+ public $returnType;
53
+ public $results;
54
+ public $status;
 
55
 
56
+ }
57
 
58
  /**
59
+ * A class used format all controller responses in a consitent format. Every controller response will
60
+ * have a Report and Payload structer. The Payload is an array of the result response. The Report is used
 
61
  * report on the overall status of the controller method
62
+ *
63
+ * Standard: PSR-2
64
+ * @link http://www.php-fig.org/psr/psr-2
65
+ *
66
+ * @package Duplicator
67
+ * @subpackage classes/ctrls
68
+ * @copyright (c) 2017, Snapcreek LLC
69
+ *
70
  */
71
  class DUP_CTRL_Result
72
  {
73
  //Properties
74
+ public $report;
75
+ public $payload;
76
+ private $timeStart;
77
+ private $timeEnd;
 
78
  private $CTRL;
79
+
80
+ function __construct(DUP_CTRL_Base $CTRL_OBJ)
81
  {
82
  DUP_Util::hasCapability('read');
83
+ $this->timeStart = $this->microtimeFloat();
84
+ $this->CTRL = $CTRL_OBJ;
85
+
86
  //Report Data
87
+ $this->report = new DUP_CTRL_Report();
88
+ $this->report->returnType = $CTRL_OBJ->returnType;
89
  }
90
+
91
+ /**
92
+ * Used to process a controller request
93
+ *
94
+ * @param object $payload The response object that will be returned
95
+ * @param enum $test The status of a response
96
+ *
97
+ * @return object || JSON Returns a PHP object or json encoded object
98
+ */
99
+ public function process($payload, $test = DUP_CTRL_Status::UNDEFINED)
100
  {
101
+ if (is_array($this->payload)) {
102
+ $this->payload[] = $payload;
103
+ $this->report->results = count($this->payload);
 
104
  } else {
105
+ $this->payload = $payload;
106
+ $this->report->results = (is_array($payload)) ? count($payload) : 1;
107
  }
108
+
109
+ $this->report->status = $test;
110
  $this->getProcessTime();
111
+
112
+ switch ($this->CTRL->returnType) {
113
+ case 'JSON' :
 
114
  return json_encode($this);
115
  break;
116
+
117
  case 'PHP' :
118
  return $this;
119
+ break;
120
+
121
  default:
122
+ if (!headers_sent()) {
123
  header('Content-Type: application/json');
124
  }
125
+ return die(json_encode($this));
126
  break;
127
  }
128
  }
129
+
130
+ /**
131
+ * Used to process an error response
132
+ *
133
+ * @param object $exception The PHP exception object
134
+ *
135
+ * @return object || JSON Returns a PHP object or json encoded object
136
+ */
137
+ public function processError($exception)
138
  {
139
+ $payload = array();
140
+ $payload['Message'] = $exception->getMessage();
141
+ $payload['File'] = $exception->getFile();
142
+ $payload['Line'] = $exception->getLine();
143
+ $payload['Trace'] = $exception->getTraceAsString();
144
+ $this->process($payload, DUP_CTRL_Status::ERROR);
145
  die(json_encode($this));
146
  }
147
+
148
  private function getProcessTime()
149
  {
150
+ $this->timeEnd = $this->microtimeFloat();
151
+ $this->report->runTime = $this->timeEnd - $this->timeStart;
152
  }
153
+
154
  private function microtimeFloat()
155
  {
156
  list($usec, $sec) = explode(" ", microtime());
157
+ return ((float) $usec + (float) $sec);
158
  }
159
+ }
 
 
 
 
ctrls/ctrl.tools.php CHANGED
@@ -15,7 +15,8 @@ class DUP_CTRL_Tools extends DUP_CTRL_Base
15
  */
16
  function __construct()
17
  {
18
- add_action('wp_ajax_DUP_CTRL_Tools_RunScanValidator', array($this, 'RunScanValidator'));
 
19
  }
20
 
21
  /**
@@ -24,12 +25,12 @@ class DUP_CTRL_Tools extends DUP_CTRL_Base
24
  * @param string $_POST['scan-path'] The path to start scanning from, defaults to DUPLICATOR_WPROOTPATH
25
  * @param bool $_POST['scan-recursive'] Recursivly search the path
26
  *
27
- * @notes: Testing = /wp-admin/admin-ajax.php?action=DUP_CTRL_Tools_RunScanValidator
28
  */
29
- public function RunScanValidator($post)
30
  {
31
  @set_time_limit(0);
32
- $post = $this->PostParamMerge($post);
33
  check_ajax_referer($post['action'], 'nonce');
34
 
35
  $result = new DUP_CTRL_Result($this);
@@ -49,13 +50,56 @@ class DUP_CTRL_Tools extends DUP_CTRL_Base
49
  $test = ($payload->fileCount > 0)
50
  ? DUP_CTRL_Status::SUCCESS
51
  : DUP_CTRL_Status::FAILED;
52
- $result->Process($payload, $test);
53
  }
54
  catch (Exception $exc)
55
  {
56
- $result->ProcessError($exc);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
  }
59
 
60
  }
61
- ?>
15
  */
16
  function __construct()
17
  {
18
+ add_action('wp_ajax_DUP_CTRL_Tools_runScanValidator', array($this, 'runScanValidator'));
19
+ add_action('wp_ajax_DUP_CTRL_Tools_deleteInstallerFiles', array($this, 'deleteInstallerFiles'));
20
  }
21
 
22
  /**
25
  * @param string $_POST['scan-path'] The path to start scanning from, defaults to DUPLICATOR_WPROOTPATH
26
  * @param bool $_POST['scan-recursive'] Recursivly search the path
27
  *
28
+ * @notes: Testing = /wp-admin/admin-ajax.php?action=DUP_CTRL_Tools_runScanValidator
29
  */
30
+ public function runScanValidator($post)
31
  {
32
  @set_time_limit(0);
33
+ $post = $this->postParamMerge($post);
34
  check_ajax_referer($post['action'], 'nonce');
35
 
36
  $result = new DUP_CTRL_Result($this);
50
  $test = ($payload->fileCount > 0)
51
  ? DUP_CTRL_Status::SUCCESS
52
  : DUP_CTRL_Status::FAILED;
53
+ $result->process($payload, $test);
54
  }
55
  catch (Exception $exc)
56
  {
57
+ $result->processError($exc);
58
+ }
59
+ }
60
+
61
+
62
+ /**
63
+ * Removed all reserved installer files names
64
+ *
65
+ * @param string $_POST['archive-name'] The name of the archive file used to create this site
66
+ *
67
+ * @notes: Testing = /wp-admin/admin-ajax.php?action=DUP_CTRL_Tools_deleteInstallerFiles
68
+ */
69
+ public function deleteInstallerFiles($post)
70
+ {
71
+ $post = $this->postParamMerge($post);
72
+ check_ajax_referer($post['action'], 'nonce');
73
+ $result = new DUP_CTRL_Result($this);
74
+ try
75
+ {
76
+ //CONTROLLER LOGIC
77
+ $installer_files = DUP_Server::getInstallerFiles();
78
+ //array_push($installer_files, $package_path);
79
+ foreach($installer_files as $file => $path) {
80
+ if (! is_dir($path)) {
81
+ @chmod($path, 0777);
82
+ $status = (@unlink($path) === false) ? false : true;
83
+ $payload[] = array(
84
+ 'file' => $path,
85
+ 'removed' => $status,
86
+ 'writable' => is_writable($path),
87
+ 'readable' => is_readable($path),
88
+ 'exists' => file_exists($path)
89
+ );
90
+ }
91
+ }
92
+
93
+ //RETURN RESULT
94
+ $test = (in_array(true, $payload['exists']))
95
+ ? DUP_CTRL_Status::FAILED
96
+ : DUP_CTRL_Status::SUCCESS;
97
+ $result->process($payload, $test);
98
+ }
99
+ catch (Exception $exc)
100
+ {
101
+ $result->processError($exc);
102
  }
103
  }
104
 
105
  }
 
ctrls/ctrl.ui.php CHANGED
@@ -38,7 +38,7 @@ class DUP_CTRL_UI extends DUP_CTRL_Base
38
  */
39
  public function SaveViewState($post)
40
  {
41
- $post = $this->PostParamMerge($post);
42
  $result = new DUP_CTRL_Result($this);
43
 
44
  try
@@ -58,11 +58,11 @@ class DUP_CTRL_UI extends DUP_CTRL_Base
58
  $test = ($success)
59
  ? DUP_CTRL_Status::SUCCESS
60
  : DUP_CTRL_Status::FAILED;
61
- return $result->Process($payload, $test);
62
  }
63
  catch (Exception $exc)
64
  {
65
- $result->ProcessError($exc);
66
  }
67
  }
68
 
@@ -89,13 +89,12 @@ class DUP_CTRL_UI extends DUP_CTRL_Base
89
  $test = (count($payload))
90
  ? DUP_CTRL_Status::SUCCESS
91
  : DUP_CTRL_Status::FAILED;
92
- return $result->Process($payload, $test);
93
  }
94
  catch (Exception $exc)
95
  {
96
- $result->ProcessError($exc);
97
  }
98
  }
99
 
100
  }
101
- ?>
38
  */
39
  public function SaveViewState($post)
40
  {
41
+ $post = $this->postParamMerge($post);
42
  $result = new DUP_CTRL_Result($this);
43
 
44
  try
58
  $test = ($success)
59
  ? DUP_CTRL_Status::SUCCESS
60
  : DUP_CTRL_Status::FAILED;
61
+ return $result->process($payload, $test);
62
  }
63
  catch (Exception $exc)
64
  {
65
+ $result->processError($exc);
66
  }
67
  }
68
 
89
  $test = (count($payload))
90
  ? DUP_CTRL_Status::SUCCESS
91
  : DUP_CTRL_Status::FAILED;
92
+ return $result->process($payload, $test);
93
  }
94
  catch (Exception $exc)
95
  {
96
+ $result->processError($exc);
97
  }
98
  }
99
 
100
  }
 
debug/main.php CHANGED
@@ -136,7 +136,7 @@ jQuery(document).ready(function($)
136
  Duplicator.Debug.ProcessResult = function(data, result)
137
  {
138
  UNIT_TEST_COUNTER++;
139
- var status = data.Report.Status || 0;
140
  //console.log(data);
141
 
142
  if (status > 0) {
136
  Duplicator.Debug.ProcessResult = function(data, result)
137
  {
138
  UNIT_TEST_COUNTER++;
139
+ var status = data.report.status || 0;
140
  //console.log(data);
141
 
142
  if (status > 0) {
debug/tst.tools.php CHANGED
@@ -5,8 +5,8 @@
5
  <!-- METHOD TEST -->
6
  <form>
7
  <?php
8
- $CTRL['Title'] = 'DUP_CTRL_Tools_RunScanValidator';
9
- $CTRL['Action'] = 'DUP_CTRL_Tools_RunScanValidator';
10
  $CTRL['Test'] = true;
11
  DUP_DEBUG_TestSetup($CTRL);
12
  ?>
@@ -21,8 +21,8 @@
21
  <!-- METHOD TEST -->
22
  <form>
23
  <?php
24
- $CTRL['Title'] = 'DUP_CTRL_Tools_RunScanValidatorFull';
25
- $CTRL['Action'] = 'DUP_CTRL_Tools_RunScanValidator';
26
  $CTRL['Test'] = true;
27
  DUP_DEBUG_TestSetup($CTRL);
28
  ?>
@@ -33,6 +33,17 @@
33
  <input type="text" name="scan-path" value="<?php echo DUPLICATOR_WPROOTPATH ?>" /> <br/>
34
  </div>
35
  </form>
 
 
 
 
 
 
 
 
 
 
 
36
 
37
 
38
  </div>
5
  <!-- METHOD TEST -->
6
  <form>
7
  <?php
8
+ $CTRL['Title'] = 'DUP_CTRL_Tools_runScanValidator';
9
+ $CTRL['Action'] = 'DUP_CTRL_Tools_runScanValidator';
10
  $CTRL['Test'] = true;
11
  DUP_DEBUG_TestSetup($CTRL);
12
  ?>
21
  <!-- METHOD TEST -->
22
  <form>
23
  <?php
24
+ $CTRL['Title'] = 'DUP_CTRL_Tools_runScanValidatorFull';
25
+ $CTRL['Action'] = 'DUP_CTRL_Tools_runScanValidator';
26
  $CTRL['Test'] = true;
27
  DUP_DEBUG_TestSetup($CTRL);
28
  ?>
33
  <input type="text" name="scan-path" value="<?php echo DUPLICATOR_WPROOTPATH ?>" /> <br/>
34
  </div>
35
  </form>
36
+
37
+ <!-- METHOD TEST -->
38
+ <form>
39
+ <?php
40
+ $CTRL['Title'] = 'DUP_CTRL_Tools_deleteInstallerFiles';
41
+ $CTRL['Action'] = 'DUP_CTRL_Tools_deleteInstallerFiles';
42
+ $CTRL['Test'] = true;
43
+ DUP_DEBUG_TestSetup($CTRL);
44
+ ?>
45
+ <div class="params">No Params</div>
46
+ </form>
47
 
48
 
49
  </div>
define.php CHANGED
@@ -2,7 +2,7 @@
2
  //Prevent directly browsing to the file
3
  if (function_exists('plugin_dir_url'))
4
  {
5
- define('DUPLICATOR_VERSION', '1.2.6');
6
  define('DUPLICATOR_HOMEPAGE', 'http://lifeinthegrid.com/labs/duplicator');
7
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
8
  define('DUPLICATOR_SITE_URL', get_site_url());
2
  //Prevent directly browsing to the file
3
  if (function_exists('plugin_dir_url'))
4
  {
5
+ define('DUPLICATOR_VERSION', '1.2.8');
6
  define('DUPLICATOR_HOMEPAGE', 'http://lifeinthegrid.com/labs/duplicator');
7
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
8
  define('DUPLICATOR_SITE_URL', get_site_url());
duplicator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Duplicator
4
  Plugin URI: http://www.lifeinthegrid.com/duplicator/
5
  Description: Create and transfer a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly.
6
- Version: 1.2.6
7
  Author: Snap Creek
8
  Author URI: http://www.snapcreek.com/duplicator/
9
  Text Domain: duplicator
3
  Plugin Name: Duplicator
4
  Plugin URI: http://www.lifeinthegrid.com/duplicator/
5
  Description: Create and transfer a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly.
6
+ Version: 1.2.8
7
  Author: Snap Creek
8
  Author URI: http://www.snapcreek.com/duplicator/
9
  Text Domain: duplicator
installer/build/assets/inc.css.php CHANGED
@@ -22,7 +22,7 @@
22
  table.dupx-header {border-top-left-radius:5px; border-top-right-radius:5px; width:100%; box-shadow:0 5px 3px -3px #999; background-color:#F1F1F1; font-weight:bold;}
23
  .dupx-header-version {white-space:nowrap; color:#777; font-size:11px; font-style:italic; text-align:right; padding:0 15px 5px 0; line-height:14px; font-weight:normal;}
24
  .dupx-header-version a {color:#555;}
25
- div.dupx-logfile-link {float:right; font-weight:normal; font-size:12px}
26
  div#progress-area {padding:5px; margin:150px 0 0 0px; text-align:center;}
27
  div#ajaxerr-data {padding:5px; height:350px; width:99%; border:1px solid silver; border-radius:5px; background-color:#efefef; font-size:13px; overflow-y:scroll; line-height:24px}
28
 
@@ -65,12 +65,14 @@
65
  div.dlg-serv-info div.hdr {background-color: #dfdfdf; font-weight: bold; margin-top:5px; border-radius: 4px; padding:2px 5px 2px 5px; border: 1px solid silver; font-size: 16px}
66
  div#modal-window div.modal-title {background-color:#D0D0D0}
67
  div#modal-window div.modal-text {padding-top:10px !important}
 
68
 
69
  /* ======================================
70
  STEP 1 VIEW
71
  ====================================== */
72
- table.s1-archive-local td {padding:5px}
73
- table.s1-archive-local td:first-child {font-weight:bold; min-width:50px}
 
74
  div#s1-area-sys-setup {padding:5px 0 0 10px}
75
  div#s1-area-sys-setup div.info-top {text-align:center; font-style:italic; font-size:11px; padding:0 5px 5px 5px}
76
  table.s1-checks-area {width:100%; margin:0; padding:0}
@@ -174,7 +176,6 @@
174
  table.s4-final-step td {padding:5px 15px 5px 5px}
175
  table.s4-final-step td:first-child {white-space:nowrap;}
176
  div.s4-go-back {border-bottom:1px dotted #dfdfdf; border-top:1px dotted #dfdfdf; margin:auto; text-align:center; font-size: 12px}
177
- div.s4-btns-msg {text-align: center; font-size:10px; color:#777; margin:5px 0 15px 0}
178
  a.s4-final-btns {display: block; width:135; padding:5px; line-height: 1.4; background-color:#F1F1F1; border:1px solid silver;
179
  color: #000; box-shadow: 5px 5px 5px -5px #949494; text-decoration: none; text-align: center; border-radius: 4px;
180
  }
22
  table.dupx-header {border-top-left-radius:5px; border-top-right-radius:5px; width:100%; box-shadow:0 5px 3px -3px #999; background-color:#F1F1F1; font-weight:bold;}
23
  .dupx-header-version {white-space:nowrap; color:#777; font-size:11px; font-style:italic; text-align:right; padding:0 15px 5px 0; line-height:14px; font-weight:normal;}
24
  .dupx-header-version a {color:#555;}
25
+ div.dupx-logfile-link {float:right; font-weight:normal; font-size:11px; font-style:italic}
26
  div#progress-area {padding:5px; margin:150px 0 0 0px; text-align:center;}
27
  div#ajaxerr-data {padding:5px; height:350px; width:99%; border:1px solid silver; border-radius:5px; background-color:#efefef; font-size:13px; overflow-y:scroll; line-height:24px}
28
 
65
  div.dlg-serv-info div.hdr {background-color: #dfdfdf; font-weight: bold; margin-top:5px; border-radius: 4px; padding:2px 5px 2px 5px; border: 1px solid silver; font-size: 16px}
66
  div#modal-window div.modal-title {background-color:#D0D0D0}
67
  div#modal-window div.modal-text {padding-top:10px !important}
68
+ div.archive-onlydb {color:#DB4B38; font-weight:normal; position:absolute; top:5px; right:20px; font-style:italic; font-size:11px}
69
 
70
  /* ======================================
71
  STEP 1 VIEW
72
  ====================================== */
73
+ table.s1-archive-local {width:100%}
74
+ table.s1-archive-local td {padding:4px 4px 4px 4px}
75
+ table.s1-archive-local td:first-child {font-weight:bold; width:55px}
76
  div#s1-area-sys-setup {padding:5px 0 0 10px}
77
  div#s1-area-sys-setup div.info-top {text-align:center; font-style:italic; font-size:11px; padding:0 5px 5px 5px}
78
  table.s1-checks-area {width:100%; margin:0; padding:0}
176
  table.s4-final-step td {padding:5px 15px 5px 5px}
177
  table.s4-final-step td:first-child {white-space:nowrap;}
178
  div.s4-go-back {border-bottom:1px dotted #dfdfdf; border-top:1px dotted #dfdfdf; margin:auto; text-align:center; font-size: 12px}
 
179
  a.s4-final-btns {display: block; width:135; padding:5px; line-height: 1.4; background-color:#F1F1F1; border:1px solid silver;
180
  color: #000; box-shadow: 5px 5px 5px -5px #949494; text-decoration: none; text-align: center; border-radius: 4px;
181
  }
installer/build/classes/config/class.conf.srv.php CHANGED
@@ -50,9 +50,8 @@ class DUPX_ServerConfig
50
  *
51
  * @return null
52
  */
53
- public static function setup()
54
  {
55
-
56
  if (!isset($_POST['url_new'])) {
57
  return;
58
  }
@@ -62,8 +61,29 @@ class DUPX_ServerConfig
62
  $newdata = parse_url($_POST['url_new']);
63
  $currpath = DUPX_U::addSlash(isset($currdata['path']) ? $currdata['path'] : "");
64
  $newpath = DUPX_U::addSlash(isset($newdata['path']) ? $newdata['path'] : "");
 
 
 
 
 
 
 
65
 
66
- $tmp_htaccess = <<<HTACCESS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  # BEGIN WordPress
68
  <IfModule mod_rewrite.c>
69
  RewriteEngine On
@@ -75,10 +95,13 @@ RewriteRule . {$newpath}index.php [L]
75
  </IfModule>
76
  # END WordPress
77
  HTACCESS;
 
 
78
 
79
  file_put_contents('.htaccess', $tmp_htaccess);
80
  @chmod('.htaccess', 0644);
81
- DUPX_Log::info("created basic .htaccess file. If using IIS web.config this process will need to be done manually.");
 
82
  }
83
  }
84
  ?>
50
  *
51
  * @return null
52
  */
53
+ public static function setup($dbh)
54
  {
 
55
  if (!isset($_POST['url_new'])) {
56
  return;
57
  }
61
  $newdata = parse_url($_POST['url_new']);
62
  $currpath = DUPX_U::addSlash(isset($currdata['path']) ? $currdata['path'] : "");
63
  $newpath = DUPX_U::addSlash(isset($newdata['path']) ? $newdata['path'] : "");
64
+ $timestamp = date("Y-m-d H:i:s");
65
+ $update_msg = "# This file was updated by Duplicator on {$timestamp}. See .htaccess.orig for the original .htaccess file.\n";
66
+ $update_msg .= "# Please note that other plugins and resources write to this file. If the time-stamp above is different\n";
67
+ $update_msg .= "# than the current time-stamp on the file system then another resource has updated this file.\n";
68
+
69
+ $empty_htaccess = false;
70
+ $query_result = @mysqli_query($dbh, "SELECT option_value FROM `{$GLOBALS['FW_TABLEPREFIX']}options` WHERE option_name = 'permalink_structure' ");
71
 
72
+ //If the permalink is set to Plain then don't update the rewrite rules
73
+ if ($query_result) {
74
+ $row = @mysqli_fetch_array($query_result);
75
+ if ($row != null) {
76
+ $permalink_structure = trim($row[0]);
77
+ $empty_htaccess = empty($permalink_structure);
78
+ }
79
+ }
80
+
81
+ if ($empty_htaccess) {
82
+ $tmp_htaccess = "{$update_msg}";
83
+ DUPX_Log::info("- No permalink structures set creating blank .htaccess file.");
84
+ } else {
85
+ $tmp_htaccess = <<<HTACCESS
86
+ {$update_msg}
87
  # BEGIN WordPress
88
  <IfModule mod_rewrite.c>
89
  RewriteEngine On
95
  </IfModule>
96
  # END WordPress
97
  HTACCESS;
98
+ DUPX_Log::info("- Preparing .htaccess file with basic setup.");
99
+ }
100
 
101
  file_put_contents('.htaccess', $tmp_htaccess);
102
  @chmod('.htaccess', 0644);
103
+ DUPX_Log::info("Basic .htaccess file edit complete. If using IIS web.config this process will need to be done manually.");
104
+
105
  }
106
  }
107
  ?>
installer/build/ctrls/ctrl.step1.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  //POST PARAMS
4
  $_POST['archive_name'] = isset($_POST['archive_name']) ? $_POST['archive_name'] : null;
5
- $_POST['archive_manual'] = (isset($_POST['archive_manual']) && $_POST['archive_manual'] == '1') ? true : false;
6
  $_POST['archive_filetime'] = (isset($_POST['archive_filetime'])) ? $_POST['archive_filetime'] : 'current';
7
 
8
  //LOGGING
@@ -33,20 +33,24 @@ error_reporting(E_ERROR);
33
  //===============================
34
  ($GLOBALS['LOG_FILE_HANDLE'] != false) or DUPX_Log::error(ERR_MAKELOG);
35
 
36
- //ERR_ZIPMANUAL
37
- if ($_POST['archive_manual']) {
38
- if (!file_exists("wp-config.php") && !file_exists("database.sql")) {
39
- DUPX_Log::error(ERR_ZIPMANUAL);
 
 
 
 
 
 
 
 
 
40
  }
41
- } else {
42
- //ERR_CONFIG_FOUND
43
- (!file_exists('wp-config.php'))
44
- or DUPX_Log::error(ERR_CONFIG_FOUND);
45
- //ERR_ZIPNOTFOUND
46
- (is_readable("{$package_path}"))
47
- or DUPX_Log::error(ERR_ZIPNOTFOUND);
48
  }
49
 
 
 
50
  DUPX_Log::info("********************************************************************************");
51
  DUPX_Log::info('* DUPLICATOR-LITE: INSTALL-LOG');
52
  DUPX_Log::info("* VERSION: {$GLOBALS['FW_DUPLICATOR_VERSION']}");
@@ -77,7 +81,7 @@ $log .= "ZIP:\t{$zip_support} (ZipArchive Support)";
77
  DUPX_Log::info($log);
78
 
79
 
80
- if ($_POST['archive_manual']) {
81
  DUPX_Log::info("\n** PACKAGE EXTRACTION IS IN MANUAL MODE ** \n");
82
  } else {
83
  if ($GLOBALS['FW_PACKAGE_NAME'] != $_POST['archive_name']) {
2
 
3
  //POST PARAMS
4
  $_POST['archive_name'] = isset($_POST['archive_name']) ? $_POST['archive_name'] : null;
5
+ $_POST['archive_engine'] = isset($_POST['archive_engine']) ? $_POST['archive_engine'] : 'manual';
6
  $_POST['archive_filetime'] = (isset($_POST['archive_filetime'])) ? $_POST['archive_filetime'] : 'current';
7
 
8
  //LOGGING
33
  //===============================
34
  ($GLOBALS['LOG_FILE_HANDLE'] != false) or DUPX_Log::error(ERR_MAKELOG);
35
 
36
+ if (!$GLOBALS['FW_ARCHIVE_ONLYDB']) {
37
+ //ERR_ZIPMANUAL
38
+ if ($_POST['archive_engine'] == 'manual') {
39
+ if (!file_exists("wp-config.php") && !file_exists("database.sql")) {
40
+ DUPX_Log::error(ERR_ZIPMANUAL);
41
+ }
42
+ } else {
43
+ //ERR_CONFIG_FOUND
44
+ (!file_exists('wp-config.php'))
45
+ or DUPX_Log::error(ERR_CONFIG_FOUND);
46
+ //ERR_ZIPNOTFOUND
47
+ (is_readable("{$package_path}"))
48
+ or DUPX_Log::error(ERR_ZIPNOTFOUND);
49
  }
 
 
 
 
 
 
 
50
  }
51
 
52
+
53
+
54
  DUPX_Log::info("********************************************************************************");
55
  DUPX_Log::info('* DUPLICATOR-LITE: INSTALL-LOG');
56
  DUPX_Log::info("* VERSION: {$GLOBALS['FW_DUPLICATOR_VERSION']}");
81
  DUPX_Log::info($log);
82
 
83
 
84
+ if ($_POST['archive_engine'] == 'manual') {
85
  DUPX_Log::info("\n** PACKAGE EXTRACTION IS IN MANUAL MODE ** \n");
86
  } else {
87
  if ($GLOBALS['FW_PACKAGE_NAME'] != $_POST['archive_name']) {
installer/build/ctrls/ctrl.step3.php CHANGED
@@ -74,8 +74,15 @@ $log .= (isset($_POST['plugins']) && count($_POST['plugins'] > 0))
74
  DUPX_Log::info($log, 2);
75
 
76
  //UPDATE SETTINGS
77
- $serial_plugin_list = (isset($_POST['plugins']) && count($_POST['plugins'] > 0)) ? @serialize($_POST['plugins']) : '';
78
- mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$_POST['blogname']}' WHERE option_name = 'blogname' ");
 
 
 
 
 
 
 
79
  mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$serial_plugin_list}' WHERE option_name = 'active_plugins' ");
80
 
81
  $log = "--------------------------------------\n";
@@ -183,7 +190,7 @@ DUPX_Log::info("====================================\n");
183
  DUPX_WPConfig::updateStandard();
184
  $config_file = DUPX_WPConfig::updateExtended();
185
  DUPX_Log::info("UPDATED WP-CONFIG: {$root_path}/wp-config.php' (if present)");
186
- DUPX_ServerConfig::setup();
187
 
188
 
189
 
74
  DUPX_Log::info($log, 2);
75
 
76
  //UPDATE SETTINGS
77
+ $blog_name = $_POST['blogname'];
78
+ $plugin_list = (isset($_POST['plugins'])) ? $_POST['plugins'] : array();
79
+ // Force Duplicator active so we the security cleanup will be available
80
+ if (!in_array('duplicator/duplicator.php', $plugin_list)) {
81
+ $plugin_list[] = 'duplicator/duplicator.php';
82
+ }
83
+ $serial_plugin_list = @serialize($plugin_list);
84
+
85
+ mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$blog_name}' WHERE option_name = 'blogname' ");
86
  mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$serial_plugin_list}' WHERE option_name = 'active_plugins' ");
87
 
88
  $log = "--------------------------------------\n";
190
  DUPX_WPConfig::updateStandard();
191
  $config_file = DUPX_WPConfig::updateExtended();
192
  DUPX_Log::info("UPDATED WP-CONFIG: {$root_path}/wp-config.php' (if present)");
193
+ DUPX_ServerConfig::setup($dbh);
194
 
195
 
196
 
installer/build/main.installer.php CHANGED
@@ -100,8 +100,10 @@ $GLOBALS['FW_CACHE_WP'] = '%fwrite_cache_wp%';
100
  $GLOBALS['FW_CACHE_PATH'] = '%fwrite_cache_path%';
101
  $GLOBALS['FW_BLOGNAME'] = '%fwrite_blogname%';
102
  $GLOBALS['FW_WPROOT'] = '%fwrite_wproot%';
 
103
  $GLOBALS['FW_OPTS_DELETE'] = json_decode("%fwrite_opts_delete%", true);
104
  $GLOBALS['FW_DUPLICATOR_VERSION'] = '%fwrite_duplicator_version%';
 
105
 
106
  //DATABASE SETUP: all time in seconds
107
  $GLOBALS['DB_MAX_TIME'] = 5000;
@@ -229,10 +231,15 @@ HEADER TEMPLATE: Common header on all steps -->
229
  version: <?php echo $GLOBALS['FW_DUPLICATOR_VERSION'] ?><br/>
230
  &raquo; <a href="javascript:void(0)" onclick="DUPX.showServerInfo()">info</a>
231
  &raquo; <a href="?help=1" target="_blank">help</a>
232
-
233
  </td>
234
  </tr>
235
- </table>
 
 
 
 
 
 
236
 
237
  <!-- =========================================
238
  FORM DATA: Data Steps -->
100
  $GLOBALS['FW_CACHE_PATH'] = '%fwrite_cache_path%';
101
  $GLOBALS['FW_BLOGNAME'] = '%fwrite_blogname%';
102
  $GLOBALS['FW_WPROOT'] = '%fwrite_wproot%';
103
+ $GLOBALS['FW_WPLOGIN_URL'] = '%fwrite_wplogin_url%';
104
  $GLOBALS['FW_OPTS_DELETE'] = json_decode("%fwrite_opts_delete%", true);
105
  $GLOBALS['FW_DUPLICATOR_VERSION'] = '%fwrite_duplicator_version%';
106
+ $GLOBALS['FW_ARCHIVE_ONLYDB'] = '%fwrite_archive_onlydb%';
107
 
108
  //DATABASE SETUP: all time in seconds
109
  $GLOBALS['DB_MAX_TIME'] = 5000;
231
  version: <?php echo $GLOBALS['FW_DUPLICATOR_VERSION'] ?><br/>
232
  &raquo; <a href="javascript:void(0)" onclick="DUPX.showServerInfo()">info</a>
233
  &raquo; <a href="?help=1" target="_blank">help</a>
 
234
  </td>
235
  </tr>
236
+ </table>
237
+
238
+ <?php if ($GLOBALS['FW_ARCHIVE_ONLYDB']) :?>
239
+ <div style="position: relative">
240
+ <div class="archive-onlydb">Database Only Mode</div>
241
+ </div>
242
+ <?php endif; ?>
243
 
244
  <!-- =========================================
245
  FORM DATA: Data Steps -->
installer/build/view.step1.php CHANGED
@@ -2,9 +2,46 @@
2
  //VIEW: STEP 1- INPUT
3
 
4
  //ARCHIVE FILE
5
- $arcCheck = (file_exists($GLOBALS['ARCHIVE_PATH'])) ? 'Pass' : 'Fail';
 
6
  $arcSize = @filesize($GLOBALS['ARCHIVE_PATH']);
7
  $arcSize = is_numeric($arcSize) ? $arcSize : 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  //REQUIRMENTS
10
  $req = array();
@@ -31,11 +68,13 @@ $max_time_warn = (is_numeric($max_time_ini) && $max_time_ini < 31 && $max_time
31
 
32
 
33
  $notice = array();
34
- $notice['01'] = ! file_exists($wpconf_path) ? 'Good' : 'Warn';
35
- $notice['02'] = $scancount <= 40 ? 'Good' : 'Warn';
 
 
36
  $notice['03'] = $fulldays <= 180 ? 'Good' : 'Warn';
37
  $notice['04'] = 'Good'; //Place-holder for future check
38
- $notice['05'] = 'Good'; //Place-holder for future check $GLOBALS['FW_VERSION_OS'] == PHP_OS ? 'Good' : 'Warn';
39
  $notice['06'] = empty($openbase) ? 'Good' : 'Warn';
40
  $notice['07'] = ! $max_time_warn ? 'Good' : 'Warn';
41
  $all_notice = in_array('Warn', $notice) ? 'Warn' : 'Good';
@@ -64,18 +103,53 @@ ARCHIVE
64
  ==================================== -->
65
  <div class="hdr-sub1" id="s1-area-archive-file-link" data-type="toggle" data-target="#s1-area-archive-file">
66
  <a href="javascript:void(0)"><i class="dupx-plus-square"></i> Archive</a>
67
- <div class="<?php echo ($arcCheck == 'Pass') ? 'status-badge-pass' : 'status-badge-fail'; ?>" style="float:right">
68
- <?php echo ($arcCheck == 'Pass') ? 'Pass' : 'Fail'; ?>
69
  </div>
70
  </div>
71
  <div id="s1-area-archive-file" style="display:none">
72
 
73
  <table class="s1-archive-local">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  <tr>
75
  <td>Status:</td>
76
  <td>
77
- <?php if ($arcCheck != 'Fail') : ?>
78
- <span class="dupx-pass">Archive file successfully detected.</span>
79
  <?php else : ?>
80
  <div class="s1-archive-failed-msg">
81
  <b class="dupx-fail">Archive File Not Found!</b><br/>
@@ -104,24 +178,38 @@ ARCHIVE
104
  <?php endif; ?>
105
  </td>
106
  </tr>
107
- <tr>
108
- <td>Size:</td>
109
- <td><?php echo DUPX_U::readableByteSize($arcSize); ;?> </td>
110
- </tr>
111
- <tr>
112
- <td>Name:</td>
113
- <td><?php echo "{$GLOBALS['FW_PACKAGE_NAME']}";?> </td>
114
- </tr>
115
- <tr>
116
- <td>Path:</td>
117
- <td><?php echo "{$GLOBALS['CURRENT_ROOT_PATH']}";?> </td>
118
- </tr>
119
- <tr>
120
- <td>Notes:</td>
121
- <td><?php echo strlen($GLOBALS['FW_PACKAGE_NOTES']) ? "{$GLOBALS['FW_PACKAGE_NOTES']}" : " - no notes - ";?></td>
122
- </tr>
123
- </table>
 
 
 
124
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
  </div>
127
  <br/><br/>
@@ -213,25 +301,42 @@ VALIDATION
213
  </table>
214
  </div>
215
 
216
- <!-- NOTICE 1 -->
217
- <div class="status <?php echo ($notice['01'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo $notice['01']; ?></div>
218
- <div class="title" data-type="toggle" data-target="#s1-notice01">+ Configuration File</div>
219
- <div class="info" id="s1-notice01">
220
- Duplicator works best by placing the installer and archive files into an empty directory. Typically, if a wp-config.php file is found in the extraction
221
- directory it may indicate that your trying to install over an existing WordPress site which can lead to un-intended results. If this is not the case, then
222
- just ignore this notice, but be aware that you will have to remove the wp-config.php file later on in the deployment process.
223
- </div>
 
 
 
 
 
 
 
224
 
225
- <!-- NOTICE 2 -->
226
- <div class="status <?php echo ($notice['02'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo $notice['02']; ?></div>
227
- <div class="title" data-type="toggle" data-target="#s1-notice02">+ Directory Setup</div>
228
- <div class="info" id="s1-notice02">
229
- <b>Deployment Path:</b> <i><?php echo "{$GLOBALS['CURRENT_ROOT_PATH']}"; ?></i>
230
- <br/><br/>
231
- There are currently <?php echo "<b>[{$scancount}]</b>";?> items in the deployment path. These items will be overwritten if they also exist
232
- inside the archive file. The notice is to prevent overwriting an existing site or trying to install on-top of one which
233
- can have un-intended results. <i>This notice shows if it detects more than 40 items.</i>
234
- </div>
 
 
 
 
 
 
 
 
 
 
235
 
236
  <!-- NOTICE 3 -->
237
  <div class="status <?php echo ($notice['03'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo $notice['03']; ?></div>
@@ -318,7 +423,16 @@ OPTIONS
318
  <tr>
319
  <td>Extraction:</td>
320
  <td>
321
- <input type="checkbox" name="archive_manual" id="archive_manual" value="1" /> <label for="archive_manual">Manual package extraction</label><br/>
 
 
 
 
 
 
 
 
 
322
  </td>
323
  </tr>
324
  </table>
@@ -435,7 +549,7 @@ NOTICES
435
  </div>
436
 
437
 
438
- <?php if (! $req_success || $arcCheck == 'Fail') :?>
439
  <div class="s1-err-msg">
440
  <i>
441
  This installation will not be able to proceed until the 'Archive' and 'Validation' sections pass. Please adjust your servers settings or contact your
@@ -502,6 +616,14 @@ Auto Posts to view.step2.php
502
  </form>
503
 
504
  <script>
 
 
 
 
 
 
 
 
505
  /** Performs Ajax post to extract files and create db
506
  * Timeout (10000000 = 166 minutes) */
507
  DUPX.runExtraction = function()
@@ -576,7 +698,7 @@ Auto Posts to view.step2.php
576
  {
577
  DUPX.acceptWarning();
578
  $("*[data-type='toggle']").click(DUPX.toggleClick);
579
- <?php echo ($arcCheck == 'Fail') ? "$('#s1-area-archive-file-link').trigger('click');" : ""; ?>
580
  <?php echo (! $all_success) ? "$('#s1-area-sys-setup-link').trigger('click');" : ""; ?>
581
  })
582
  </script>
2
  //VIEW: STEP 1- INPUT
3
 
4
  //ARCHIVE FILE
5
+ $arcStatus = (file_exists($GLOBALS['ARCHIVE_PATH'])) ? 'Pass' : 'Fail';
6
+ $arcFormat = ($arcStatus == 'Pass') ? 'Pass' : 'StatusFailed';
7
  $arcSize = @filesize($GLOBALS['ARCHIVE_PATH']);
8
  $arcSize = is_numeric($arcSize) ? $arcSize : 0;
9
+ $zip_archive_enabled = class_exists('ZipArchive') ? 'Enabled' : 'Not Enabled';
10
+
11
+ //ARCHIVE FORMAT
12
+ if ($arcStatus) {
13
+ if (class_exists('ZipArchive')){
14
+ $zip = new ZipArchive();
15
+ if($zip->open($GLOBALS['ARCHIVE_PATH']) === TRUE ) {
16
+
17
+ $arcFilePath = basename($GLOBALS['ARCHIVE_PATH']);
18
+ $arcFilePath = substr($arcFilePath, 0, strrpos($arcFilePath, "."));
19
+ $badFiles = array('__MACOSX', $arcFilePath);
20
+ $goodFiles = array('database.sql', 'installer-backup.php');
21
+ $goodFilesFound = true;
22
+ $badFilesFound = false;
23
+
24
+ foreach ($badFiles as $val) {
25
+ if (is_numeric($zip->locateName("{$val}/"))) {
26
+ $badFilesFound = true;
27
+ break;
28
+ }
29
+ }
30
+
31
+ foreach ($goodFiles as $val) {
32
+ if ($zip->locateName($val) !== true) {
33
+ $goodFilesFound = false;
34
+ }
35
+ }
36
+
37
+ $arcFormat = ($goodFilesFound == false && $badFilesFound == true) ? 'Fail' : 'Pass';
38
+ }
39
+ } else {
40
+ $arcFormat = 'NoZipArchive';
41
+ }
42
+ }
43
+
44
+ $all_arc = ($arcStatus == 'Pass' && $arcFormat != 'Fail') ? 'Pass' : 'Fail';
45
 
46
  //REQUIRMENTS
47
  $req = array();
68
 
69
 
70
  $notice = array();
71
+ if (!$GLOBALS['FW_ARCHIVE_ONLYDB']) {
72
+ $notice['01'] = ! file_exists($wpconf_path) ? 'Good' : 'Warn';
73
+ $notice['02'] = $scancount <= 35 ? 'Good' : 'Warn';
74
+ }
75
  $notice['03'] = $fulldays <= 180 ? 'Good' : 'Warn';
76
  $notice['04'] = 'Good'; //Place-holder for future check
77
+ $notice['05'] = 'Good'; //Place-holder for future check
78
  $notice['06'] = empty($openbase) ? 'Good' : 'Warn';
79
  $notice['07'] = ! $max_time_warn ? 'Good' : 'Warn';
80
  $all_notice = in_array('Warn', $notice) ? 'Warn' : 'Good';
103
  ==================================== -->
104
  <div class="hdr-sub1" id="s1-area-archive-file-link" data-type="toggle" data-target="#s1-area-archive-file">
105
  <a href="javascript:void(0)"><i class="dupx-plus-square"></i> Archive</a>
106
+ <div class="<?php echo ($all_arc == 'Pass') ? 'status-badge-pass' : 'status-badge-fail'; ?>" style="float:right">
107
+ <?php echo ($all_arc == 'Pass') ? 'Pass' : 'Fail'; ?>
108
  </div>
109
  </div>
110
  <div id="s1-area-archive-file" style="display:none">
111
 
112
  <table class="s1-archive-local">
113
+ <tr>
114
+ <td colspan="2"><div class="hdr-sub3">Site Details</div></td>
115
+ </tr>
116
+ <tr>
117
+ <td>Site:</td>
118
+ <td><?php echo $GLOBALS['FW_BLOGNAME'];?> </td>
119
+ </tr>
120
+ <tr>
121
+ <td>Notes:</td>
122
+ <td><?php echo strlen($GLOBALS['FW_PACKAGE_NOTES']) ? "{$GLOBALS['FW_PACKAGE_NOTES']}" : " - no notes - ";?></td>
123
+ </tr>
124
+ <?php if ($GLOBALS['FW_ARCHIVE_ONLYDB']) :?>
125
+ <tr>
126
+ <td>Mode:</td>
127
+ <td>Archive only database was enabled during package package creation.</td>
128
+ </tr>
129
+ <?php endif; ?>
130
+ </table>
131
+
132
+ <table class="s1-archive-local">
133
+ <tr>
134
+ <td colspan="2"><div class="hdr-sub3">File Details</div></td>
135
+ </tr>
136
+ <tr>
137
+ <td>Size:</td>
138
+ <td><?php echo DUPX_U::readableByteSize($arcSize); ?> </td>
139
+ </tr>
140
+ <tr>
141
+ <td>Name:</td>
142
+ <td><?php echo "{$GLOBALS['FW_PACKAGE_NAME']}";?> </td>
143
+ </tr>
144
+ <tr>
145
+ <td>Path:</td>
146
+ <td><?php echo "{$GLOBALS['CURRENT_ROOT_PATH']}";?> </td>
147
+ </tr>
148
  <tr>
149
  <td>Status:</td>
150
  <td>
151
+ <?php if ($arcStatus != 'Fail') : ?>
152
+ <span class="dupx-pass">File Found</span>
153
  <?php else : ?>
154
  <div class="s1-archive-failed-msg">
155
  <b class="dupx-fail">Archive File Not Found!</b><br/>
178
  <?php endif; ?>
179
  </td>
180
  </tr>
181
+ <tr>
182
+ <td>Format:</td>
183
+ <td>
184
+ <?php if ($arcFormat == 'Pass') : ?>
185
+ <span class="dupx-pass">Good structure</span>
186
+ <?php elseif ($arcFormat == 'StatusFailed') : ?>
187
+ <span class="dupx-fail">Unable to validate format</span><br/>
188
+ <?php elseif ($arcFormat == 'NoZipArchive') : ?>
189
+ <div class="s1-archive-failed-msg">
190
+ The PHP extraction library <a href="" target="_help">ZipArchive</a> was not found on this server. There are a few options:
191
+ <ol>
192
+ <li>Contact your host to enable the this PHP library. <a href="" target="_help">[more info]</a></li>
193
+ <li>Enable 'Manual package extraction' in the options menu and <a href="" target="_help">Manually extract the archive</a></li>
194
+ </ol>
195
+ </div>
196
+ <?php else : ?>
197
+ <div class="s1-archive-failed-msg">
198
+ <b class="dupx-fail">Invalid Archive Format Detected!</b><br/>
199
+ The archive files contents must be laid out in a specific format. If the format has been changed the install process will error out.
200
+ <br/><br/>
201
 
202
+ This scenario is rare but can happen on some systems during the download and upload process of the zip without a user being aware of
203
+ the issue. Please check the contents of the zip archive and be sure its contents match the layout of your site.
204
+ <br/><br/>
205
+
206
+ Files such as database.sql and wp-config.php should be at the root of the archive. For more details see the FAQ article
207
+ <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-020-q" target="_help">The archive format is changing on my Mac what might be the problem?</a>
208
+ </div>
209
+ <?php endif; ?>
210
+ </td>
211
+ </tr>
212
+ </table>
213
 
214
  </div>
215
  <br/><br/>
301
  </table>
302
  </div>
303
 
304
+ <?php if (!$GLOBALS['FW_ARCHIVE_ONLYDB']) :?>
305
+
306
+ <!-- NOTICE 1 -->
307
+ <div class="status <?php echo ($notice['01'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo $notice['01']; ?></div>
308
+ <div class="title" data-type="toggle" data-target="#s1-notice01">+ Configuration File</div>
309
+ <div class="info" id="s1-notice01">
310
+ Duplicator works best by placing the installer and archive files into an empty directory. If a wp-config.php file is found in the extraction
311
+ directory it might indicate that a pre-existing WordPress site exists which can lead to a bad install.
312
+ <br/><br/>
313
+ <b>Options:</b>
314
+ <ul style="margin-bottom: 0">
315
+ <li>If the archive was already manually extracted then <a href="javascript:void(0)" onclick="DUPX.getManaualArchiveOpt()">[Enable Manual Archive Extraction]</a></li>
316
+ <li>If the wp-config file is not needed then remove it.</li>
317
+ </ul>
318
+ </div>
319
 
320
+ <!-- NOTICE 2 -->
321
+ <div class="status <?php echo ($notice['02'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo $notice['02']; ?></div>
322
+ <div class="title" data-type="toggle" data-target="#s1-notice02">+ Directory Setup</div>
323
+ <div class="info" id="s1-notice02">
324
+ <b>Deployment Path:</b> <i><?php echo "{$GLOBALS['CURRENT_ROOT_PATH']}"; ?></i>
325
+ <br/><br/>
326
+ There are currently <?php echo "<b>[{$scancount}]</b>";?> items in the deployment path. These items will be overwritten if they also exist
327
+ inside the archive file. The notice is to prevent overwriting an existing site or trying to install on-top of one which
328
+ can have un-intended results. <i>This notice shows if it detects more than 40 items.</i>
329
+
330
+ <br/><br/>
331
+ <b>Options:</b>
332
+ <ul style="margin-bottom: 0">
333
+ <li>If the archive was already manually extracted then <a href="javascript:void(0)" onclick="DUPX.getManaualArchiveOpt()">[Enable Manual Archive Extraction]</a></li>
334
+ <li>If the files/directories are not the same as those in the archive then this notice can be ignored.</li>
335
+ <li>Remove the files if they are not needed and refresh this page.</li>
336
+ </ul>
337
+ </div>
338
+
339
+ <?php endif; ?>
340
 
341
  <!-- NOTICE 3 -->
342
  <div class="status <?php echo ($notice['03'] == 'Good') ? 'pass' : 'fail' ?>"><?php echo $notice['03']; ?></div>
423
  <tr>
424
  <td>Extraction:</td>
425
  <td>
426
+
427
+ <select id="archive_engine" name="archive_engine" size="2">
428
+ <option value="manual">Manual Archive Extraction</option>
429
+ <?php
430
+ //ZIP-ARCHIVE
431
+ echo (! $zip_archive_enabled)
432
+ ? '<option disabled="true">PHP ZipArchive (not detected on server)</option>'
433
+ : '<option value="ziparchive" selected="true">PHP ZipArchive</option>';
434
+ ?>
435
+ </select>
436
  </td>
437
  </tr>
438
  </table>
549
  </div>
550
 
551
 
552
+ <?php if (! $req_success || $all_arc == 'Fail') :?>
553
  <div class="s1-err-msg">
554
  <i>
555
  This installation will not be able to proceed until the 'Archive' and 'Validation' sections pass. Please adjust your servers settings or contact your
616
  </form>
617
 
618
  <script>
619
+ DUPX.getManaualArchiveOpt = function ()
620
+ {
621
+ $("html, body").animate({scrollTop: $(document).height()}, 1500);
622
+ $("a[data-target='#s1-area-adv-opts']").find('i').removeClass('dupx-plus-square').addClass('dupx-minus-square');
623
+ $('#s1-area-adv-opts').show(1000);
624
+ $('select#archive_engine').val('manual').focus();
625
+ };
626
+
627
  /** Performs Ajax post to extract files and create db
628
  * Timeout (10000000 = 166 minutes) */
629
  DUPX.runExtraction = function()
698
  {
699
  DUPX.acceptWarning();
700
  $("*[data-type='toggle']").click(DUPX.toggleClick);
701
+ <?php echo ($all_arc == 'Fail') ? "$('#s1-area-archive-file-link').trigger('click');" : ""; ?>
702
  <?php echo (! $all_success) ? "$('#s1-area-sys-setup-link').trigger('click');" : ""; ?>
703
  })
704
  </script>
installer/build/view.step4.php CHANGED
@@ -1,5 +1,12 @@
 
 
 
 
 
 
 
 
1
 
2
- <link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
3
  <script>
4
  /** Posts to page to remove install files */
5
  DUPX.removeInstallerFiles = function()
@@ -10,6 +17,10 @@
10
  window.open(nurl, "_blank");
11
  }
12
  };
 
 
 
 
13
  </script>
14
 
15
 
@@ -28,17 +39,17 @@ VIEW: STEP 4 - INPUT -->
28
  </div>
29
 
30
  <table class="s4-final-step">
31
- <tr>
32
- <td style="width:170px"><a class="s4-final-btns" href='<?php echo rtrim($_POST['url_new'], "/"); ?>/wp-admin/options-permalink.php' target='_blank'> Save Permalinks</a></td>
33
- <td><i>Updates URL rewrite rules in .htaccess (requires login)</i></td>
34
- </tr>
35
- <tr>
36
- <td><a class="s4-final-btns" href='<?php echo rtrim($_POST['url_new'], "/") . '?now=' . $GLOBALS['NOW_DATE']; ?>' target='_blank'>Test Site</a></td>
37
  <td><i>Validate all pages, links images and plugins</i></td>
38
  </tr>
39
  <tr>
40
- <td><a class="s4-final-btns" href="javascript:void(0)" onclick="DUPX.removeInstallerFiles('<?php echo $_POST['archive_name'] ?>')">Security Cleanup</a></td>
41
  <td><i>Validate installer files are removed (requires login)</i></td>
 
 
 
 
42
  </tr>
43
  <tr>
44
  <td><a class="s4-final-btns" href="javascript:void(0)" onclick="$('#dup-step3-install-report').toggle(400)">Show Report</a></td>
@@ -52,14 +63,11 @@ VIEW: STEP 4 - INPUT -->
52
  </tr>
53
  </table><br/>
54
 
55
- <div class="s4-btns-msg">Click buttons above to complete process</div>
56
-
57
  <div class="s4-go-back">
58
  <i>To re-install <a href="javascript:history.go(-3)">start over at step 1</a>.</i><br/>
59
  <i>The .htaccess file was reset. Resave plugins that write to this file.</i>
60
  </div>
61
 
62
-
63
  <!-- ========================
64
  INSTALL REPORT -->
65
  <div id="dup-step3-install-report" style='display:none'>
1
+ <?php
2
+
3
+ $_POST['archive_name'] = isset($_POST['archive_name']) ? $_POST['archive_name'] : '';
4
+ $admin_base = basename($GLOBALS['FW_WPLOGIN_URL']);
5
+ $admin_redirect = rtrim($_POST['url_new'], "/") . "/wp-admin/admin.php?page=duplicator-tools&tab=cleanup&package={$_POST['archive_name']}";
6
+ $admin_redirect = urlencode($admin_redirect);
7
+ $admin_login = rtrim($_POST['url_new'], '/') . "/{$admin_base}?redirect_to={$admin_redirect}";
8
+ ?>
9
 
 
10
  <script>
11
  /** Posts to page to remove install files */
12
  DUPX.removeInstallerFiles = function()
17
  window.open(nurl, "_blank");
18
  }
19
  };
20
+ DUPX.getAdminLogin = function()
21
+ {
22
+ window.open('<?php echo $admin_login; ?>', 'wp-admin');
23
+ };
24
  </script>
25
 
26
 
39
  </div>
40
 
41
  <table class="s4-final-step">
42
+ <!--tr>
43
+ <td><a class="s4-final-btns" href='<?php echo rtrim($_POST['url_new'], "/") . '?now=' . $GLOBALS['NOW_DATE']; ?>' target='_blank'>Test Site</a></td>
 
 
 
 
44
  <td><i>Validate all pages, links images and plugins</i></td>
45
  </tr>
46
  <tr>
47
+ <td><a class="s4-final-btns" href="javascript:void(0)" onclick="DUPX.removeInstallerFiles('<?php echo $_POST['archive_name'] ?>')">Security Cleanup</a></td>
48
  <td><i>Validate installer files are removed (requires login)</i></td>
49
+ </tr-->
50
+ <tr>
51
+ <td><a class="s4-final-btns" href="javascript:void(0)" onclick="DUPX.getAdminLogin()">Site Login</a></td>
52
+ <td><i>Login to the administrator section to finalize the setup</i></td>
53
  </tr>
54
  <tr>
55
  <td><a class="s4-final-btns" href="javascript:void(0)" onclick="$('#dup-step3-install-report').toggle(400)">Show Report</a></td>
63
  </tr>
64
  </table><br/>
65
 
 
 
66
  <div class="s4-go-back">
67
  <i>To re-install <a href="javascript:history.go(-3)">start over at step 1</a>.</i><br/>
68
  <i>The .htaccess file was reset. Resave plugins that write to this file.</i>
69
  </div>
70
 
 
71
  <!-- ========================
72
  INSTALL REPORT -->
73
  <div id="dup-step3-install-report" style='display:none'>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: corylamleorg, bobriley
3
  Donate link: www.lifeinthegrid.com/partner
4
  Tags: migration, backup, restore, move, migrate, duplicate, transfer, clone, automate, copy site
5
  Requires at least: 4.0
6
- Tested up to: 4.7
7
- Stable tag: 1.2.6
8
  License: GPLv2
9
 
10
  WordPress migration and backups are much easier with Duplicator! Clone, backup, move and transfer an entire site from one location to another.
3
  Donate link: www.lifeinthegrid.com/partner
4
  Tags: migration, backup, restore, move, migrate, duplicate, transfer, clone, automate, copy site
5
  Requires at least: 4.0
6
+ Tested up to: 4.8
7
+ Stable tag: 1.2.8
8
  License: GPLv2
9
 
10
  WordPress migration and backups are much easier with Duplicator! Clone, backup, move and transfer an entire site from one location to another.
views/help/about.php CHANGED
@@ -75,9 +75,9 @@ require_once(DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php');
75
  <table style="text-align: center;width:100%; font-size:11px; font-style:italic; margin-top:25px">
76
  <tr>
77
  <td valign="top">
78
- <a href="http://wordpress.org/extend/plugins/duplicator" target="_blank"><img id="dup-img-5stars" src="<?php echo DUPLICATOR_PLUGIN_URL ?>assets/img/5star.png" /></a>
79
  <div style=" font-size: 16px; font-weight: bold">
80
- <a href="http://wordpress.org/extend/plugins/duplicator" target="_blank"><?php _e('Leave 5 Stars', 'duplicator') ?></a>
81
  </div>
82
  </td>
83
  </tr>
75
  <table style="text-align: center;width:100%; font-size:11px; font-style:italic; margin-top:25px">
76
  <tr>
77
  <td valign="top">
78
+ <a href="https://wordpress.org/support/plugin/duplicator/reviews/?filter=5" target="vote-wp"><img id="dup-img-5stars" src="<?php echo DUPLICATOR_PLUGIN_URL ?>assets/img/5star.png" /></a>
79
  <div style=" font-size: 16px; font-weight: bold">
80
+ <a href="https://wordpress.org/support/plugin/duplicator/reviews/?filter=5" target="vote-wp"><?php _e('Leave 5 Stars', 'duplicator') ?></a>
81
  </div>
82
  </td>
83
  </tr>
views/packages/details/detail.php CHANGED
@@ -225,43 +225,55 @@ ARCHIVE -->
225
  <td><?php _e('Build Mode', 'duplicator') ?>: </td>
226
  <td><?php _e('ZipArchive', 'duplicator'); ?></td>
227
  </tr>
228
- <tr>
229
- <td><?php _e('Filters', 'duplicator') ?>: </td>
230
- <td><?php echo $package->Archive->FilterOn == 1 ? 'On' : 'Off'; ?></td>
231
- </tr>
232
- <tr class="sub-item <?php echo $css_file_filter_on ?>">
233
- <td><?php _e('Directories', 'duplicator') ?>: </td>
234
- <td>
235
- <?php
236
- echo strlen($package->Archive->FilterDirs)
237
- ? str_replace(';', '<br/>', $package->Archive->FilterDirs)
238
- : __('- no filters -', 'duplicator');
239
- ?>
240
- </td>
241
- </tr>
242
- <tr class="sub-item <?php echo $css_file_filter_on ?>">
243
- <td><?php _e('Extensions', 'duplicator') ?>: </td>
244
- <td>
245
- <?php
246
- echo isset($package->Archive->FilterExts) && strlen($package->Archive->FilterExts)
247
- ? $package->Archive->FilterExts
248
- : __('- no filters -', 'duplicator');
249
- ?>
250
- </td>
251
- </tr>
252
- <tr class="sub-item <?php echo $css_file_filter_on ?>">
253
- <td><?php _e('Files', 'duplicator') ?>: </td>
254
- <td>
255
- <i>
256
- <?php _e('Available in', 'duplicator') ?>
257
- <a href="https://snapcreek.com/duplicator/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_content=free_file_filters&utm_campaign=duplicator_pro" target="_blank"><?php _e('Professional', 'duplicator');?></a>
258
- </i>
259
- <i class="fa fa-lightbulb-o"
260
- data-tooltip-title="<?php _e('File Filters:', 'duplicator'); ?>"
261
- data-tooltip="<?php _e('File filters allows you to select individual files and add them to an exclusion list that will filter them from the package.', 'duplicator'); ?>">
262
- </i>
263
- </td>
264
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
265
  </table><br/>
266
 
267
  <!-- DATABASE -->
225
  <td><?php _e('Build Mode', 'duplicator') ?>: </td>
226
  <td><?php _e('ZipArchive', 'duplicator'); ?></td>
227
  </tr>
228
+
229
+ <?php if ($package->Archive->ExportOnlyDB) : ?>
230
+ <tr>
231
+ <td><?php _e('Database Mode', 'duplicator') ?>: </td>
232
+ <td>
233
+ <?php
234
+ _e('Archive Database Only Enabled', 'duplicator')
235
+ ?>
236
+ </td>
237
+ </tr>
238
+ <?php else : ?>
239
+ <tr>
240
+ <td><?php _e('Filters', 'duplicator') ?>: </td>
241
+ <td><?php echo $package->Archive->FilterOn == 1 ? 'On' : 'Off'; ?></td>
242
+ </tr>
243
+ <tr class="sub-item <?php echo $css_file_filter_on ?>">
244
+ <td><?php _e('Directories', 'duplicator') ?>: </td>
245
+ <td>
246
+ <?php
247
+ echo strlen($package->Archive->FilterDirs)
248
+ ? str_replace(';', '<br/>', $package->Archive->FilterDirs)
249
+ : __('- no filters -', 'duplicator');
250
+ ?>
251
+ </td>
252
+ </tr>
253
+ <tr class="sub-item <?php echo $css_file_filter_on ?>">
254
+ <td><?php _e('Extensions', 'duplicator') ?>: </td>
255
+ <td>
256
+ <?php
257
+ echo isset($package->Archive->FilterExts) && strlen($package->Archive->FilterExts)
258
+ ? $package->Archive->FilterExts
259
+ : __('- no filters -', 'duplicator');
260
+ ?>
261
+ </td>
262
+ </tr>
263
+ <tr class="sub-item <?php echo $css_file_filter_on ?>">
264
+ <td><?php _e('Files', 'duplicator') ?>: </td>
265
+ <td>
266
+ <i>
267
+ <?php _e('Available in', 'duplicator') ?>
268
+ <a href="https://snapcreek.com/duplicator/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_content=free_file_filters&utm_campaign=duplicator_pro" target="_blank"><?php _e('Professional', 'duplicator');?></a>
269
+ </i>
270
+ <i class="fa fa-lightbulb-o"
271
+ data-tooltip-title="<?php _e('File Filters:', 'duplicator'); ?>"
272
+ data-tooltip="<?php _e('File filters allows you to select individual files and add them to an exclusion list that will filter them from the package.', 'duplicator'); ?>">
273
+ </i>
274
+ </td>
275
+ </tr>
276
+ <?php endif; ?>
277
  </table><br/>
278
 
279
  <!-- DATABASE -->
views/packages/main/new1.inc.form.php CHANGED
@@ -21,7 +21,6 @@
21
  span#dup-archive-filter-db {color:#A62426; display:none}
22
  div#dup-file-filter-items, div#dup-db-filter-items {padding:5px 0;}
23
  div#dup-db-filter-items {font-stretch:ultra-condensed; font-family:Calibri; }
24
- label.dup-enable-filters {display:inline-block; margin:-5px 0 5px 0}
25
  div.dup-quick-links {font-size:11px; float:right; display:inline-block; margin-top:2px; font-style:italic}
26
  div.dup-tabs-opts-help {font-style:italic; font-size:11px; margin:10px 0 0 10px; color:#777}
27
  table#dup-dbtables td {padding:1px 15px 1px 4px}
@@ -30,6 +29,8 @@
30
  div.dup-store-pro img {height:14px; width:14px; vertical-align:text-top}
31
  div.dup-store-pro a {text-decoration:underline}
32
  span.dup-pro-text {font-style:italic; font-size:12px; color:#555; font-style:italic }
 
 
33
 
34
  /*INSTALLER SECTION*/
35
  div.dup-installer-header-1 {font-weight:bold; padding-bottom:2px; width:100%}
@@ -47,7 +48,7 @@
47
  <div>
48
  <label for="package-name"><b><?php _e('Name', 'duplicator') ?>:</b> </label>
49
  <div class="dup-notes-add">
50
- <button class="button button-small" type="button" onclick="jQuery('#dup-notes-area').toggle()"><i class="fa fa-pencil-square-o"></i> <?php _e('Notes', 'duplicator') ?></button>
51
  </div>
52
  <a href="javascript:void(0)" onclick="Duplicator.Pack.ResetName()" title="<?php _e('Create a new default name', 'duplicator') ?>"><i class="fa fa-undo"></i></a> <br/>
53
  <input id="package-name" name="package-name" type="text" value="<?php echo $Package->Name ?>" maxlength="40" data-required="true" data-regexp="^[0-9A-Za-z|_]+$" /> <br/>
@@ -118,7 +119,7 @@ ARCHIVE -->
118
  </div>
119
  <div class="dup-box-panel" id="dup-pack-archive-panel" style="<?php echo $ui_css_archive ?>">
120
  <input type="hidden" name="archive-format" value="ZIP" />
121
-
122
  <!-- NESTED TABS -->
123
  <div data-dup-tabs='true'>
124
  <ul>
@@ -133,70 +134,96 @@ ARCHIVE -->
133
  $uploads = wp_upload_dir();
134
  $upload_dir = DUP_Util::safePath($uploads['basedir']);
135
  ?>
136
- <div class="dup-enable-filters">
 
 
 
 
137
  <input type="checkbox" id="filter-on" name="filter-on" onclick="Duplicator.Pack.ToggleFileFilters()" <?php echo ($Package->Archive->FilterOn) ? "checked='checked'" :""; ?> />
138
- <label for="filter-on"><?php _e("Enable File Filters", 'duplicator') ?></label>
139
  <i class="fa fa-question-circle"
140
  data-tooltip-title="<?php _e("File Filters:", 'duplicator'); ?>"
141
  data-tooltip="<?php _e('File filters allow you to ignore directories and file extensions. When creating a package only include the data you '
142
  . 'want and need. This helps to improve the overall archive build time and keep your backups simple and clean.', 'duplicator'); ?>">
143
  </i>
144
- </div>
145
 
146
- <div id="dup-file-filter-items">
147
- <label for="filter-dirs" title="<?php _e("Separate all filters by semicolon", 'duplicator'); ?>"><?php _e("Directories", 'duplicator') ?>:</label>
148
- <div class='dup-quick-links'>
149
- <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php echo rtrim(DUPLICATOR_WPROOTPATH, '/'); ?>')">[<?php _e("root path", 'duplicator') ?>]</a>
150
- <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php echo rtrim($upload_dir, '/'); ?>')">[<?php _e("wp-uploads", 'duplicator') ?>]</a>
151
- <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php echo DUP_Util::safePath(WP_CONTENT_DIR); ?>/cache')">[<?php _e("cache", 'duplicator') ?>]</a>
152
- <a href="javascript:void(0)" onclick="jQuery('#filter-dirs').val('')"><?php _e("(clear)", 'duplicator') ?></a>
153
- </div>
154
- <textarea name="filter-dirs" id="filter-dirs" placeholder="/full_path/exclude_path1;/full_path/exclude_path2;"><?php echo str_replace(";", ";\n", esc_textarea($Package->Archive->FilterDirs)) ?></textarea><br/>
155
- <label class="no-select" title="<?php _e("Separate all filters by semicolon", 'duplicator'); ?>"><?php _e("File extensions", 'duplicator') ?>:</label>
156
- <div class='dup-quick-links'>
157
- <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludeExts('avi;mov;mp4;mpeg;mpg;swf;wmv;aac;m3u;mp3;mpa;wav;wma')">[<?php _e("media", 'duplicator') ?>]</a>
158
- <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludeExts('zip;rar;tar;gz;bz2;7z')">[<?php _e("archive", 'duplicator') ?>]</a>
159
- <a href="javascript:void(0)" onclick="jQuery('#filter-exts').val('')"><?php _e("(clear)", 'duplicator') ?></a>
160
- </div>
161
- <textarea name="filter-exts" id="filter-exts" placeholder="ext1;ext2;ext3;"><?php echo esc_textarea($Package->Archive->FilterExts); ?></textarea>
162
-
163
- <div class="dup-tabs-opts-help">
164
- <?php _e("The directory paths and extensions above will be be excluded from the archive file if enabled is checked.", 'duplicator'); ?> <br/>
165
- <?php _e("Use the full path for directories and semicolons to separate all items.", 'duplicator'); ?>
166
- </div>
167
- <br/>
168
- <span class="dup-pro-text">
169
- <?php echo sprintf(__('%1$s are available in', 'duplicator'), 'Individual file filters'); ?>
170
- <a href="https://snapcreek.com/duplicator/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_content=free_file_filters&utm_campaign=duplicator_pro" target="_blank"><?php _e('Professional', 'duplicator');?></a>
171
- <i class="fa fa-lightbulb-o"
172
- data-tooltip-title="<?php _e("File Filters:", 'duplicator'); ?>"
173
- data-tooltip="<?php _e('File filters allows you to select individual files and add them to an exclusion list that will filter them from the package.', 'duplicator'); ?>">
174
- </i>
175
- </span>
176
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  </div>
178
 
179
  <!-- TAB2: DATABASE -->
180
- <div>
181
- <div class="dup-enable-filters">
182
- <table>
183
- <tr>
184
- <td colspan="2" style="padding:0 0 10px 0">
185
- <?php _e("Build Mode", 'duplicator') ?>:&nbsp; <a href="?page=duplicator-settings" target="settings"><?php echo $dbbuild_mode; ?></a>
186
- </td>
187
- </tr>
188
- <tr>
189
- <td><input type="checkbox" id="dbfilter-on" name="dbfilter-on" onclick="Duplicator.Pack.ToggleDBFilters()" <?php echo ($Package->Database->FilterOn) ? "checked='checked'" :""; ?> /></td>
190
- <td>
191
- <label for="dbfilter-on"><?php _e("Enable Table Filters", 'duplicator') ?> &nbsp;</label>
192
- <i class="fa fa-question-circle"
193
- data-tooltip-title="<?php _e("Enable Table Filters:", 'duplicator'); ?>"
194
- data-tooltip="<?php _e('Checked tables will not be added to the database script. Excluding certain tables can possibly cause your site or plugins to not work correctly after install!', 'duplicator'); ?>">
195
- </i>
196
- </td>
197
- </tr>
198
- </table>
199
- </div>
200
  <div id="dup-db-filter-items">
201
  <a href="javascript:void(0)" id="dball" onclick="jQuery('#dup-dbtables .checkbox').prop('checked', true).trigger('click');">[ <?php _e('Include All', 'duplicator'); ?> ]</a> &nbsp;
202
  <a href="javascript:void(0)" id="dbnone" onclick="jQuery('#dup-dbtables .checkbox').prop('checked', false).trigger('click');">[ <?php _e('Exclude All', 'duplicator'); ?> ]</a>
@@ -405,6 +432,14 @@ jQuery(document).ready(function ($)
405
  var DUP_NAMEDEFAULT = '<?php echo $default_name ?>';
406
  var DUP_NAMELAST = $('#package-name').val();
407
 
 
 
 
 
 
 
 
 
408
  /* Enable/Disable the file filter elements */
409
  Duplicator.Pack.ToggleFileFilters = function ()
410
  {
@@ -483,5 +518,6 @@ jQuery(document).ready(function ($)
483
  //Init:Toggle OptionTabs
484
  Duplicator.Pack.ToggleFileFilters();
485
  Duplicator.Pack.ToggleDBFilters();
 
486
  });
487
  </script>
21
  span#dup-archive-filter-db {color:#A62426; display:none}
22
  div#dup-file-filter-items, div#dup-db-filter-items {padding:5px 0;}
23
  div#dup-db-filter-items {font-stretch:ultra-condensed; font-family:Calibri; }
 
24
  div.dup-quick-links {font-size:11px; float:right; display:inline-block; margin-top:2px; font-style:italic}
25
  div.dup-tabs-opts-help {font-style:italic; font-size:11px; margin:10px 0 0 10px; color:#777}
26
  table#dup-dbtables td {padding:1px 15px 1px 4px}
29
  div.dup-store-pro img {height:14px; width:14px; vertical-align:text-top}
30
  div.dup-store-pro a {text-decoration:underline}
31
  span.dup-pro-text {font-style:italic; font-size:12px; color:#555; font-style:italic }
32
+ div#dup-exportdb-items-checked, div#dup-exportdb-items-off {min-height:275px; display:none}
33
+ div#dup-exportdb-items-checked {padding: 5px; max-width:650px}
34
 
35
  /*INSTALLER SECTION*/
36
  div.dup-installer-header-1 {font-weight:bold; padding-bottom:2px; width:100%}
48
  <div>
49
  <label for="package-name"><b><?php _e('Name', 'duplicator') ?>:</b> </label>
50
  <div class="dup-notes-add">
51
+ <button class="button button-small" type="button" onclick="jQuery('#dup-notes-area').toggle()" title="<?php _e('Notes', 'duplicator') ?>"><i class="fa fa-pencil-square-o"></i> </button>
52
  </div>
53
  <a href="javascript:void(0)" onclick="Duplicator.Pack.ResetName()" title="<?php _e('Create a new default name', 'duplicator') ?>"><i class="fa fa-undo"></i></a> <br/>
54
  <input id="package-name" name="package-name" type="text" value="<?php echo $Package->Name ?>" maxlength="40" data-required="true" data-regexp="^[0-9A-Za-z|_]+$" /> <br/>
119
  </div>
120
  <div class="dup-box-panel" id="dup-pack-archive-panel" style="<?php echo $ui_css_archive ?>">
121
  <input type="hidden" name="archive-format" value="ZIP" />
122
+
123
  <!-- NESTED TABS -->
124
  <div data-dup-tabs='true'>
125
  <ul>
134
  $uploads = wp_upload_dir();
135
  $upload_dir = DUP_Util::safePath($uploads['basedir']);
136
  ?>
137
+
138
+ <input type="checkbox" id="export-onlydb" name="export-onlydb" onclick="Duplicator.Pack.ExportOnlyDB()" <?php echo ($Package->Archive->ExportOnlyDB) ? "checked='checked'" :""; ?> />
139
+ <label for="export-onlydb"><?php _e('Archive Only the Database', 'duplicator') ?></label>
140
+
141
+ <div id="dup-exportdb-items-off" style="<?php echo ($Package->Archive->ExportOnlyDB) ? 'none' : 'block'; ?>">
142
  <input type="checkbox" id="filter-on" name="filter-on" onclick="Duplicator.Pack.ToggleFileFilters()" <?php echo ($Package->Archive->FilterOn) ? "checked='checked'" :""; ?> />
143
+ <label for="filter-on" id="filter-on-label"><?php _e("Enable File Filters", 'duplicator') ?></label>
144
  <i class="fa fa-question-circle"
145
  data-tooltip-title="<?php _e("File Filters:", 'duplicator'); ?>"
146
  data-tooltip="<?php _e('File filters allow you to ignore directories and file extensions. When creating a package only include the data you '
147
  . 'want and need. This helps to improve the overall archive build time and keep your backups simple and clean.', 'duplicator'); ?>">
148
  </i>
 
149
 
150
+ <div id="dup-file-filter-items">
151
+ <label for="filter-dirs" title="<?php _e("Separate all filters by semicolon", 'duplicator'); ?>"><?php _e("Directories", 'duplicator') ?>:</label>
152
+ <div class='dup-quick-links'>
153
+ <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php echo rtrim(DUPLICATOR_WPROOTPATH, '/'); ?>')">[<?php _e("root path", 'duplicator') ?>]</a>
154
+ <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php echo rtrim($upload_dir, '/'); ?>')">[<?php _e("wp-uploads", 'duplicator') ?>]</a>
155
+ <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php echo DUP_Util::safePath(WP_CONTENT_DIR); ?>/cache')">[<?php _e("cache", 'duplicator') ?>]</a>
156
+ <a href="javascript:void(0)" onclick="jQuery('#filter-dirs').val('')"><?php _e("(clear)", 'duplicator') ?></a>
157
+ </div>
158
+ <textarea name="filter-dirs" id="filter-dirs" placeholder="/full_path/exclude_path1;/full_path/exclude_path2;"><?php echo str_replace(";", ";\n", esc_textarea($Package->Archive->FilterDirs)) ?></textarea><br/>
159
+ <label class="no-select" title="<?php _e("Separate all filters by semicolon", 'duplicator'); ?>"><?php _e("File extensions", 'duplicator') ?>:</label>
160
+ <div class='dup-quick-links'>
161
+ <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludeExts('avi;mov;mp4;mpeg;mpg;swf;wmv;aac;m3u;mp3;mpa;wav;wma')">[<?php _e("media", 'duplicator') ?>]</a>
162
+ <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludeExts('zip;rar;tar;gz;bz2;7z')">[<?php _e("archive", 'duplicator') ?>]</a>
163
+ <a href="javascript:void(0)" onclick="jQuery('#filter-exts').val('')"><?php _e("(clear)", 'duplicator') ?></a>
164
+ </div>
165
+ <textarea name="filter-exts" id="filter-exts" placeholder="ext1;ext2;ext3;"><?php echo esc_textarea($Package->Archive->FilterExts); ?></textarea>
166
+
167
+ <div class="dup-tabs-opts-help">
168
+ <?php _e("The directory paths and extensions above will be be excluded from the archive file if enabled is checked.", 'duplicator'); ?> <br/>
169
+ <?php _e("Use the full path for directories and semicolons to separate all items.", 'duplicator'); ?>
170
+ </div>
171
+ <br/>
172
+ <span class="dup-pro-text">
173
+ <?php echo sprintf(__('%1$s are available in', 'duplicator'), 'Individual file filters'); ?>
174
+ <a href="https://snapcreek.com/duplicator/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_content=free_file_filters&utm_campaign=duplicator_pro" target="_blank"><?php _e('Professional', 'duplicator');?></a>
175
+ <i class="fa fa-lightbulb-o"
176
+ data-tooltip-title="<?php _e("File Filters:", 'duplicator'); ?>"
177
+ data-tooltip="<?php _e('File filters allows you to select individual files and add them to an exclusion list that will filter them from the package.', 'duplicator'); ?>">
178
+ </i>
179
+ </span>
180
+ </div>
181
+ </div>
182
+
183
+ <div id="dup-exportdb-items-checked" style="<?php echo ($Package->Archive->ExportOnlyDB) ? 'block' : 'none'; ?>">
184
+ <?php
185
+ _e("<b>Overview:</b><br/> This advanced option excludes all files from the archive. Only the database and a copy of the installer.php "
186
+ . "will be included in the archive.zip file. The option can be used for backing up and moving only the database. <i>Please note that this option is currently in *Beta*.</i>", 'duplicator');
187
+
188
+ echo '<br/><br/>';
189
+
190
+ _e("<b><i class='fa fa-exclamation-circle'></i> Notice:</b><br/> Installing only the database over an existing site may have unintended consequences. "
191
+ . "Be sure to know the state of your system before installing the database without the associated files. ", 'duplicator');
192
+
193
+ echo '<br/><br/>';
194
+
195
+ _e("For example, if you have WordPress 4.6 on this site and you copy this sites database to a host that has WordPress 4.8 files then the source code of the files "
196
+ . " will not be in sync with the database causing possible errors.", 'duplicator');
197
+
198
+ echo '<br/><br/>';
199
+
200
+ _e("This can also be true of plugins and themes. When moving only the database be sure to know the database will be compatible with ALL source code files."
201
+ . " Please use this advanced feature with caution!", 'duplicator');
202
+ ?>
203
+ <br/><br/>
204
+ </div>
205
+
206
  </div>
207
 
208
  <!-- TAB2: DATABASE -->
209
+ <div>
210
+ <table>
211
+ <tr>
212
+ <td colspan="2" style="padding:0 0 10px 0">
213
+ <?php _e("Build Mode", 'duplicator') ?>:&nbsp; <a href="?page=duplicator-settings" target="settings"><?php echo $dbbuild_mode; ?></a>
214
+ </td>
215
+ </tr>
216
+ <tr>
217
+ <td><input type="checkbox" id="dbfilter-on" name="dbfilter-on" onclick="Duplicator.Pack.ToggleDBFilters()" <?php echo ($Package->Database->FilterOn) ? "checked='checked'" :""; ?> /></td>
218
+ <td>
219
+ <label for="dbfilter-on"><?php _e("Enable Table Filters", 'duplicator') ?> &nbsp;</label>
220
+ <i class="fa fa-question-circle"
221
+ data-tooltip-title="<?php _e("Enable Table Filters:", 'duplicator'); ?>"
222
+ data-tooltip="<?php _e('Checked tables will not be added to the database script. Excluding certain tables can possibly cause your site or plugins to not work correctly after install!', 'duplicator'); ?>">
223
+ </i>
224
+ </td>
225
+ </tr>
226
+ </table>
 
 
227
  <div id="dup-db-filter-items">
228
  <a href="javascript:void(0)" id="dball" onclick="jQuery('#dup-dbtables .checkbox').prop('checked', true).trigger('click');">[ <?php _e('Include All', 'duplicator'); ?> ]</a> &nbsp;
229
  <a href="javascript:void(0)" id="dbnone" onclick="jQuery('#dup-dbtables .checkbox').prop('checked', false).trigger('click');">[ <?php _e('Exclude All', 'duplicator'); ?> ]</a>
432
  var DUP_NAMEDEFAULT = '<?php echo $default_name ?>';
433
  var DUP_NAMELAST = $('#package-name').val();
434
 
435
+ Duplicator.Pack.ExportOnlyDB = function ()
436
+ {
437
+ $('#dup-exportdb-items-off, #dup-exportdb-items-checked').hide();
438
+ $("#export-onlydb").is(':checked')
439
+ ? $('#dup-exportdb-items-checked').show()
440
+ : $('#dup-exportdb-items-off').show();
441
+ };
442
+
443
  /* Enable/Disable the file filter elements */
444
  Duplicator.Pack.ToggleFileFilters = function ()
445
  {
518
  //Init:Toggle OptionTabs
519
  Duplicator.Pack.ToggleFileFilters();
520
  Duplicator.Pack.ToggleDBFilters();
521
+ Duplicator.Pack.ExportOnlyDB();
522
  });
523
  </script>
views/packages/main/new1.setup.php CHANGED
@@ -23,12 +23,12 @@ $default_name = DUP_Package::getDefaultName();
23
 
24
  //View State
25
  $ctrl_ui = new DUP_CTRL_UI();
26
- $ctrl_ui->SetResponseType('PHP');
27
  $data = $ctrl_ui->GetViewStateList();
28
 
29
- $ui_css_storage = (isset($data->Payload['dup-pack-storage-panel']) && $data->Payload['dup-pack-storage-panel']) ? 'display:block' : 'display:none';
30
- $ui_css_archive = (isset($data->Payload['dup-pack-archive-panel']) && $data->Payload['dup-pack-archive-panel']) ? 'display:block' : 'display:none';
31
- $ui_css_installer = (isset($data->Payload['dup-pack-installer-panel']) && $data->Payload['dup-pack-installer-panel']) ? 'display:block' : 'display:none';
32
  $dup_intaller_files = implode(", ", array_keys(DUP_Server::getInstallerFiles()));
33
  $dbbuild_mode = (DUP_Settings::Get('package_mysqldump') && DUP_DB::getMySqlDumpPath()) ? 'mysqldump' : 'PHP';
34
 
23
 
24
  //View State
25
  $ctrl_ui = new DUP_CTRL_UI();
26
+ $ctrl_ui->setResponseType('PHP');
27
  $data = $ctrl_ui->GetViewStateList();
28
 
29
+ $ui_css_storage = (isset($data->payload['dup-pack-storage-panel']) && $data->payload['dup-pack-storage-panel']) ? 'display:block' : 'display:none';
30
+ $ui_css_archive = (isset($data->payload['dup-pack-archive-panel']) && $data->payload['dup-pack-archive-panel']) ? 'display:block' : 'display:none';
31
+ $ui_css_installer = (isset($data->payload['dup-pack-installer-panel']) && $data->payload['dup-pack-installer-panel']) ? 'display:block' : 'display:none';
32
  $dup_intaller_files = implode(", ", array_keys(DUP_Server::getInstallerFiles()));
33
  $dbbuild_mode = (DUP_Settings::Get('package_mysqldump') && DUP_DB::getMySqlDumpPath()) ? 'mysqldump' : 'PHP';
34
 
views/packages/main/new2.scan.php CHANGED
@@ -269,8 +269,10 @@ TOOL BAR: STEPS -->
269
  data-tooltip="<?php _e('The files size represents only the included files before compression is applied. It does not include the size of the database script and in most cases the package size once completed will be smaller than this number.', 'duplicator'); ?>"></i>
270
  <div id="data-arc-size1"></div>
271
  <div class="dup-scan-filter-status">
272
- <?php
273
- if ($Package->Archive->FilterOn) {
 
 
274
  echo '<i class="fa fa-filter"></i> '; _e('Enabled', 'duplicator');
275
  }
276
  ?>
269
  data-tooltip="<?php _e('The files size represents only the included files before compression is applied. It does not include the size of the database script and in most cases the package size once completed will be smaller than this number.', 'duplicator'); ?>"></i>
270
  <div id="data-arc-size1"></div>
271
  <div class="dup-scan-filter-status">
272
+ <?php
273
+ if ($Package->Archive->ExportOnlyDB) {
274
+ echo '<i class="fa fa-filter"></i> '; _e('Database Only', 'duplicator');
275
+ }elseif ($Package->Archive->FilterOn) {
276
  echo '<i class="fa fa-filter"></i> '; _e('Enabled', 'duplicator');
277
  }
278
  ?>
views/packages/main/packages.php CHANGED
@@ -24,6 +24,7 @@
24
  table.dup-pack-table {word-break:break-all;}
25
  table.dup-pack-table th {white-space:nowrap !important;}
26
  table.dup-pack-table td.pack-name {text-overflow:ellipsis; white-space:nowrap}
 
27
  table.dup-pack-table input[name="delete_confirm"] {margin-left:15px}
28
  table.dup-pack-table td.fail {border-left: 4px solid #d54e21;}
29
  table.dup-pack-table td.pass {border-left: 4px solid #2ea2cc;}
@@ -33,14 +34,15 @@
33
  td.error-msg a {color:maroon}
34
  td.error-msg a i {color:maroon}
35
  td.error-msg span {display:inline-block; padding:7px 18px 0px 0px; color:maroon}
36
-
 
37
  </style>
38
 
39
  <form id="form-duplicator" method="post">
40
 
41
- <?php if($statusCount >= 1) : ?>
42
- <div style="font-size:14px; position: absolute; top:15px; right:25px">
43
- <a href="admin.php?page=duplicator-about" style="color:#448B6C"><i><i class="fa fa-handshake-o"></i> <?php _e("Help Promote Duplicator", 'duplicator') ?></i> </a>
44
  </div>
45
  <?php endif; ?>
46
 
@@ -66,7 +68,7 @@ TOOL-BAR -->
66
  </table>
67
 
68
 
69
- <?php if($totalElements == 0) : ?>
70
  <!-- ====================
71
  NO-DATA MESSAGES-->
72
  <table class="widefat dup-pack-table">
@@ -103,15 +105,18 @@ TOOL-BAR -->
103
  <?php
104
  $rowCount = 0;
105
  $totalSize = 0;
 
106
  $rows = $qryResult;
107
  foreach ($rows as $row) {
108
  $Package = unserialize($row['package']);
109
-
 
110
  if (is_object($Package)) {
111
  $pack_name = $Package->Name;
112
  $pack_archive_size = $Package->Archive->Size;
113
  $pack_storeurl = $Package->StoreURL;
114
- $pack_namehash = $Package->NameHash;
 
115
  } else {
116
  $pack_archive_size = 0;
117
  $pack_storeurl = 'unknown';
@@ -133,7 +138,9 @@ TOOL-BAR -->
133
  <td class="pass"><input name="delete_confirm" type="checkbox" id="<?php echo $row['id'] ;?>" /></td>
134
  <td><?php echo DUP_Package::getCreatedDateFormat($row['created'], $ui_create_frmt);?></td>
135
  <td><?php echo DUP_Util::byteSize($pack_archive_size); ?></td>
136
- <td class='pack-name'><?php echo $pack_name ;?></td>
 
 
137
  <td class="get-btns">
138
  <button id="<?php echo "{$uniqueid}_installer.php" ?>" class="button no-select" onclick="Duplicator.Pack.DownloadFile('<?php echo $installfilelink; ?>', this); return false;">
139
  <i class="fa fa-bolt"></i> <?php _e("Installer", 'duplicator') ?>
@@ -235,15 +242,13 @@ jQuery(document).ready(function($)
235
  /* Provides the correct confirmation items when deleting packages */
236
  Duplicator.Pack.ConfirmDelete = function ()
237
  {
238
- if ($("#dup-pack-bulk-actions").val() != "delete")
239
- {
240
  <?php $alert1->showAlert(); ?>
241
  return;
242
  }
243
 
244
  var list = Duplicator.Pack.GetDeleteList();
245
- if (list.length == 0)
246
- {
247
  <?php $alert2->showAlert(); ?>
248
  return;
249
  }
24
  table.dup-pack-table {word-break:break-all;}
25
  table.dup-pack-table th {white-space:nowrap !important;}
26
  table.dup-pack-table td.pack-name {text-overflow:ellipsis; white-space:nowrap}
27
+ table.dup-pack-table td.pack-name sup {font-style:italic;font-size:10px; cursor: pointer }
28
  table.dup-pack-table input[name="delete_confirm"] {margin-left:15px}
29
  table.dup-pack-table td.fail {border-left: 4px solid #d54e21;}
30
  table.dup-pack-table td.pass {border-left: 4px solid #2ea2cc;}
34
  td.error-msg a {color:maroon}
35
  td.error-msg a i {color:maroon}
36
  td.error-msg span {display:inline-block; padding:7px 18px 0px 0px; color:maroon}
37
+ div.dup-vote { position: absolute; top:15px; right:25px; }
38
+ div.dup-vote a { font-size:12px; font-style: italic }
39
  </style>
40
 
41
  <form id="form-duplicator" method="post">
42
 
43
+ <?php if($statusCount >= 2) : ?>
44
+ <div class="dup-vote">
45
+ <a href="https://wordpress.org/support/plugin/duplicator/reviews/?filter=5" target="vote-wp"><?php _e("Rate Duplicator!", 'duplicator') ?></a>
46
  </div>
47
  <?php endif; ?>
48
 
68
  </table>
69
 
70
 
71
+ <?php if($totalElements == 0) : ?>
72
  <!-- ====================
73
  NO-DATA MESSAGES-->
74
  <table class="widefat dup-pack-table">
105
  <?php
106
  $rowCount = 0;
107
  $totalSize = 0;
108
+ $txt_dbonly = __('Database Only', 'duplicator');
109
  $rows = $qryResult;
110
  foreach ($rows as $row) {
111
  $Package = unserialize($row['package']);
112
+ $pack_dbonly = false;
113
+
114
  if (is_object($Package)) {
115
  $pack_name = $Package->Name;
116
  $pack_archive_size = $Package->Archive->Size;
117
  $pack_storeurl = $Package->StoreURL;
118
+ $pack_namehash = $Package->NameHash;
119
+ $pack_dbonly = $Package->Archive->ExportOnlyDB;
120
  } else {
121
  $pack_archive_size = 0;
122
  $pack_storeurl = 'unknown';
138
  <td class="pass"><input name="delete_confirm" type="checkbox" id="<?php echo $row['id'] ;?>" /></td>
139
  <td><?php echo DUP_Package::getCreatedDateFormat($row['created'], $ui_create_frmt);?></td>
140
  <td><?php echo DUP_Util::byteSize($pack_archive_size); ?></td>
141
+ <td class='pack-name'>
142
+ <?php echo ($pack_dbonly) ? "{$pack_name} <sup title='{$txt_dbonly}'>DB</sup>" : $pack_name ; ?>
143
+ </td>
144
  <td class="get-btns">
145
  <button id="<?php echo "{$uniqueid}_installer.php" ?>" class="button no-select" onclick="Duplicator.Pack.DownloadFile('<?php echo $installfilelink; ?>', this); return false;">
146
  <i class="fa fa-bolt"></i> <?php _e("Installer", 'duplicator') ?>
242
  /* Provides the correct confirmation items when deleting packages */
243
  Duplicator.Pack.ConfirmDelete = function ()
244
  {
245
+ if ($("#dup-pack-bulk-actions").val() != "delete") {
 
246
  <?php $alert1->showAlert(); ?>
247
  return;
248
  }
249
 
250
  var list = Duplicator.Pack.GetDeleteList();
251
+ if (list.length == 0) {
 
252
  <?php $alert2->showAlert(); ?>
253
  return;
254
  }
views/tools/cleanup.php CHANGED
@@ -1,31 +1,21 @@
1
  <?php
2
- require_once(DUPLICATOR_PLUGIN_PATH . '/assets/js/javascript.php');
3
- require_once(DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php');
4
-
5
- $nonce = wp_create_nonce('duplicator_cleanup_page');
6
  $_GET['action'] = isset($_GET['action']) ? $_GET['action'] : 'display';
7
 
8
- if(isset($_GET['action']))
9
- {
10
- if(($_GET['action'] == 'installer') || ($_GET['action'] == 'legacy') || ($_GET['action'] == 'tmp-cache'))
11
- {
12
  $verify_nonce = $_REQUEST['_wpnonce'];
13
- if ( ! wp_verify_nonce( $verify_nonce, 'duplicator_cleanup_page' ) )
14
- {
15
  exit; // Get out of here bad nounce!
16
  }
17
- }
18
  }
19
-
20
-
21
- $txt_found = __('File Found', 'duplicator');
22
- $txt_not_found = __('File Removed', 'duplicator');
23
- $installer_files = DUP_Server::getInstallerFiles();
24
-
25
  switch ($_GET['action']) {
26
  case 'installer' :
27
  $action_response = __('Installer file cleanup ran!', 'duplicator');
28
- $css_hide_msg = 'div.error {display:none}';
29
  break;
30
  case 'legacy':
31
  DUP_Settings::LegacyClean();
@@ -37,16 +27,25 @@
37
  break;
38
  }
39
 
 
 
 
 
 
 
 
 
 
40
  ?>
41
 
42
- <style type="text/css">
43
  <?php echo isset($css_hide_msg) ? $css_hide_msg : ''; ?>
44
  div.success {color:#4A8254}
45
  div.failed {color:red}
46
  table.dup-reset-opts td:first-child {font-weight: bold}
47
  table.dup-reset-opts td {padding:10px}
48
  form#dup-settings-form {padding: 0px 10px 0px 10px}
49
- a.dup-fixed-btn {min-width: 150px; text-align: center}
50
  div#dup-tools-delete-moreinfo {display: none; padding: 5px 0 0 20px; border:1px solid silver; background-color: #fff; border-radius: 5px; padding:10px; margin:5px; width:750px }
51
  </style>
52
 
@@ -54,109 +53,93 @@
54
 
55
  <?php if ($_GET['action'] != 'display') : ?>
56
  <div id="message" class="updated below-h2">
57
- <p><?php echo $action_response; ?></p>
58
  <?php if ( $_GET['action'] == 'installer') : ?>
59
  <?php
60
  $html = "";
61
 
62
- $package_name = (isset($_GET['package'])) ? DUPLICATOR_WPROOTPATH . esc_html($_GET['package']) : '';
63
- foreach($installer_files as $file => $path)
64
- {
65
- @unlink($path);
66
  echo (file_exists($path))
67
  ? "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$path} </div>"
68
- : "<div class='success'> <i class='fa fa-check'></i> {$txt_not_found} - {$path} </div>";
69
  }
70
 
71
  //No way to know exact name of archive file except from installer.
72
- //The only place where the package can be remove is from installer
73
  //So just show a message if removing from plugin.
74
- if (! empty($package_name) )
75
- {
76
- $path_parts = pathinfo($package_name);
77
- $path_parts = (isset($path_parts['extension'])) ? $path_parts['extension'] : '';
78
- if ($path_parts == "zip" && ! is_dir($package_name))
79
- {
80
- $lang1 = __('Successfully removed', 'duplicator');
81
- $lang2 = __('Does not exist or unable to remove archive file.', 'duplicator');
82
- $html .= (@unlink($package_name))
83
- ? "<div class='success'>{$lang1} {$package_name}</div>"
84
- : "<div class='failed'>{$lang2}</div>";
85
  }
86
- else
87
- {
88
- $lang = __('Does not exist or unable to remove archive file. Please validate that an archive file exists.', 'duplicator');
89
- $html .= "<div class='failed'>{$lang}</div>";
90
- }
91
- } else {
92
- $lang = __('It is recommended to remove your archive file from the root of your WordPress install. This will need to be done manually', 'duplicator');
93
- $html .= "<br/><div>{$lang}</div>";
94
  }
 
95
  echo $html;
96
- ?>
97
 
98
- <i><br/>
99
- <?php _e('If the installer files did not successfully get removed, then you WILL need to remove them manually', 'duplicator')?>. <br/>
100
- <?php _e('Please remove all installer files to avoid leaving open security issues on your server', 'duplicator')?>. <br/><br/>
101
- </i>
 
 
 
 
102
 
103
  <?php endif; ?>
104
  </div>
105
  <?php endif; ?>
106
 
107
 
108
- <h2><?php _e('Data Cleanup', 'duplicator')?><hr size="1"/></h2>
109
  <table class="dup-reset-opts">
110
  <tr style="vertical-align:text-top">
111
  <td>
112
- <a class="button button-small dup-fixed-btn" href="?page=duplicator-tools&tab=cleanup&action=installer&_wpnonce=<?php echo $nonce; ?>">
113
- <?php _e("Delete Reserved Files", 'duplicator'); ?>
114
- </a>
115
  </td>
116
  <td>
117
  <?php _e("Removes all reserved installer files.", 'duplicator'); ?>
118
- <a href="javascript:void(0)" onclick="jQuery('#dup-tools-delete-moreinfo').toggle()">[<?php _e("more info", 'duplicator'); ?>]</a>
119
- <br/>
120
  <div id="dup-tools-delete-moreinfo">
121
  <?php
122
- _e("Clicking on the 'Delete Reserved Files' button will remove the following reserved files. These files are typically from a previous Duplicator install. "
123
- . "If you are unsure of the source, please validate the files. These files should never be left on production systems for security reasons. "
124
- . "Below is a list of all the reserved files used by Duplicator. Please be sure these are removed from your server.", 'duplicator');
125
  echo "<br/><br/>";
126
 
127
- foreach($installer_files as $file => $path)
128
- {
129
  echo (file_exists($path))
130
- ? "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$file} </div>"
131
- : "<div class='success'> <i class='fa fa-check'></i> {$txt_not_found} - {$file} </div>";
132
  }
 
 
133
  ?>
134
  </div>
135
  </td>
136
  </tr>
137
  <tr>
138
- <td><a class="button button-small dup-fixed-btn" href="javascript:void(0)" onclick="Duplicator.Tools.ConfirmDeleteLegacy()"><?php _e("Delete Legacy Data", 'duplicator'); ?></a></td>
139
- <td><?php _e("Removes all legacy data and settings prior to version", 'duplicator'); ?> [<?php echo DUPLICATOR_VERSION ?>].</td>
140
- </tr>
141
- <tr>
142
- <td><a class="button button-small dup-fixed-btn" href="javascript:void(0)" onclick="Duplicator.Tools.ConfirmClearBuildCache()"><?php _e("Clear Build Cache", 'duplicator'); ?></a></td>
143
  <td><?php _e("Removes all build data from:", 'duplicator'); ?> [<?php echo DUPLICATOR_SSDIR_PATH_TMP ?>].</td>
144
  </tr>
145
  </table>
146
  </form>
147
 
148
- <!-- ==========================================
149
- THICK-BOX DIALOGS: -->
150
  <?php
151
- $msg = __('This action will remove all legacy settings prior to version %1$s. ', 'duplicator');
152
- $msg .= __('Legacy settings are only needed if you plan to migrate back to an older version of this plugin.', 'duplicator');
153
-
154
- $confirm1 = new DUP_UI_Dialog();
155
- $confirm1->title = __('Delete Packages?', 'duplicator');
156
- $confirm1->message = sprintf(__($msg, 'duplicator'), DUPLICATOR_VERSION);
157
- $confirm1->jscallback = 'Duplicator.Tools.DeleteLegacy()';
158
- $confirm1->initConfirm();
159
-
160
  $confirm2 = new DUP_UI_Dialog();
161
  $confirm2->title = __('Clear Build Cache?', 'duplicator');
162
  $confirm2->message = __('This process will remove all build cache files. Be sure no packages are currently building or else they will be cancelled.', 'duplicator');
@@ -164,21 +147,33 @@ THICK-BOX DIALOGS: -->
164
  $confirm2->initConfirm();
165
  ?>
166
 
167
- <script>
168
- jQuery(document).ready(function($)
169
  {
170
- Duplicator.Tools.ConfirmDeleteLegacy = function ()
171
- {
172
- <?php $confirm1->showConfirm(); ?>
173
- }
 
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
- Duplicator.Tools.DeleteLegacy = function ()
177
- {
178
- window.location = '?page=duplicator-tools&tab=cleanup&action=legacy&_wpnonce=<?php echo $nonce; ?>';
179
- }
180
-
181
-
182
  Duplicator.Tools.ConfirmClearBuildCache = function ()
183
  {
184
  <?php $confirm2->showConfirm(); ?>
@@ -188,6 +183,6 @@ jQuery(document).ready(function($)
188
  {
189
  window.location = '?page=duplicator-tools&tab=cleanup&action=tmp-cache&_wpnonce=<?php echo $nonce; ?>';
190
  }
191
- })
192
  </script>
193
 
1
  <?php
2
+ $nonce = wp_create_nonce('duplicator_cleanup_page');
3
+ $ajax_nonce = wp_create_nonce('DUP_CTRL_Tools_deleteInstallerFiles');
 
 
4
  $_GET['action'] = isset($_GET['action']) ? $_GET['action'] : 'display';
5
 
6
+ if (isset($_GET['action'])) {
7
+ if (($_GET['action'] == 'installer') || ($_GET['action'] == 'legacy') || ($_GET['action'] == 'tmp-cache')) {
 
 
8
  $verify_nonce = $_REQUEST['_wpnonce'];
9
+ if (!wp_verify_nonce($verify_nonce, 'duplicator_cleanup_page')) {
 
10
  exit; // Get out of here bad nounce!
11
  }
12
+ }
13
  }
14
+
 
 
 
 
 
15
  switch ($_GET['action']) {
16
  case 'installer' :
17
  $action_response = __('Installer file cleanup ran!', 'duplicator');
18
+ $css_hide_msg = 'div.error {display:none}';
19
  break;
20
  case 'legacy':
21
  DUP_Settings::LegacyClean();
27
  break;
28
  }
29
 
30
+ $installer_files = DUP_Server::getInstallerFiles();
31
+ $package_name = (isset($_GET['package'])) ? esc_html($_GET['package']) : '';
32
+ $package_path = (isset($_GET['package'])) ? DUPLICATOR_WPROOTPATH . esc_html($_GET['package']) : '';
33
+
34
+ $txt_found = __('File Found', 'duplicator');
35
+ $txt_removed = __('File Removed', 'duplicator');
36
+ $txt_archive_msg = __("<b>Archive File:</b> The archive file has a unique hashed name when downloaded. Leaving the archive file on your server does not impose a security"
37
+ . " risk if the file was not renamed. It is still recommended to remove the archive file after install,"
38
+ . " especially if it was renamed.", 'duplicator');
39
  ?>
40
 
41
+ <style>
42
  <?php echo isset($css_hide_msg) ? $css_hide_msg : ''; ?>
43
  div.success {color:#4A8254}
44
  div.failed {color:red}
45
  table.dup-reset-opts td:first-child {font-weight: bold}
46
  table.dup-reset-opts td {padding:10px}
47
  form#dup-settings-form {padding: 0px 10px 0px 10px}
48
+ button.dup-fixed-btn {min-width: 150px; text-align: center}
49
  div#dup-tools-delete-moreinfo {display: none; padding: 5px 0 0 20px; border:1px solid silver; background-color: #fff; border-radius: 5px; padding:10px; margin:5px; width:750px }
50
  </style>
51
 
53
 
54
  <?php if ($_GET['action'] != 'display') : ?>
55
  <div id="message" class="updated below-h2">
56
+ <p><b><?php echo $action_response; ?></b></p>
57
  <?php if ( $_GET['action'] == 'installer') : ?>
58
  <?php
59
  $html = "";
60
 
61
+ //REMOVE CORE INSTALLER FILES
62
+ $installer_files = DUP_Server::getInstallerFiles();
63
+ foreach ($installer_files as $file => $path) {
64
+ @unlink($path);
65
  echo (file_exists($path))
66
  ? "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$path} </div>"
67
+ : "<div class='success'> <i class='fa fa-check'></i> {$txt_removed} - {$path} </div>";
68
  }
69
 
70
  //No way to know exact name of archive file except from installer.
71
+ //The only place where the package can be removed is from installer
72
  //So just show a message if removing from plugin.
73
+ if (file_exists($package_path)) {
74
+ $path_parts = pathinfo($package_name);
75
+ $path_parts = (isset($path_parts['extension'])) ? $path_parts['extension'] : '';
76
+ if ($path_parts == "zip" && !is_dir($package_path)) {
77
+ $html .= (@unlink($package_path))
78
+ ? "<div class='success'><i class='fa fa-check'></i> {$txt_removed} - {$package_path}</div>"
79
+ : "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$package_path}</div>";
 
 
 
 
80
  }
 
 
 
 
 
 
 
 
81
  }
82
+
83
  echo $html;
84
+ ?><br/>
85
 
86
+ <div style="font-style: italic; max-width:900px">
87
+ <b><?php _e('Security Notes', 'duplicator')?>:</b>
88
+ <?php _e('If the installer files do not successfully get removed with this action, then they WILL need to be removed manually through your hosts control panel, '
89
+ . ' file system or FTP. Please remove all installer files listed above to avoid leaving open security issues on your server.', 'duplicator')?>
90
+ <br/><br/>
91
+ <?php echo $txt_archive_msg; ?>
92
+ <br/><br/>
93
+ </div>
94
 
95
  <?php endif; ?>
96
  </div>
97
  <?php endif; ?>
98
 
99
 
100
+ <h2><?php _e('Data Cleanup', 'duplicator')?></h2><hr size="1"/>
101
  <table class="dup-reset-opts">
102
  <tr style="vertical-align:text-top">
103
  <td>
104
+ <button id="dup-remove-installer-files-btn" type="button" class="button button-small dup-fixed-btn" onclick="Duplicator.Tools.deleteInstallerFiles();">
105
+ <?php _e("Remove Installation Files", 'duplicator'); ?>
106
+ </button>
107
  </td>
108
  <td>
109
  <?php _e("Removes all reserved installer files.", 'duplicator'); ?>
110
+ <a href="javascript:void(0)" onclick="jQuery('#dup-tools-delete-moreinfo').toggle()">[<?php _e("more info", 'duplicator'); ?>]</a><br/>
111
+
112
  <div id="dup-tools-delete-moreinfo">
113
  <?php
114
+ _e("Clicking on the 'Remove Installation Files' button will remove the files used by Duplicator to install this site. "
115
+ . "These files should not be left on production systems for security reasons.", 'duplicator');
 
116
  echo "<br/><br/>";
117
 
118
+ foreach($installer_files as $file => $path) {
 
119
  echo (file_exists($path))
120
+ ? "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$file}</div>"
121
+ : "<div class='success'><i class='fa fa-check'></i> {$txt_removed} - {$file}</div>";
122
  }
123
+ echo "<br/>";
124
+ echo $txt_archive_msg;
125
  ?>
126
  </div>
127
  </td>
128
  </tr>
129
  <tr>
130
+ <td>
131
+ <button type="button" class="button button-small dup-fixed-btn" onclick="Duplicator.Tools.ConfirmClearBuildCache()">
132
+ <?php _e("Clear Build Cache", 'duplicator'); ?>
133
+ </button>
134
+ </td>
135
  <td><?php _e("Removes all build data from:", 'duplicator'); ?> [<?php echo DUPLICATOR_SSDIR_PATH_TMP ?>].</td>
136
  </tr>
137
  </table>
138
  </form>
139
 
140
+ <!-- ================
141
+ THICK-BOX DIALOG: -->
142
  <?php
 
 
 
 
 
 
 
 
 
143
  $confirm2 = new DUP_UI_Dialog();
144
  $confirm2->title = __('Clear Build Cache?', 'duplicator');
145
  $confirm2->message = __('This process will remove all build cache files. Be sure no packages are currently building or else they will be cancelled.', 'duplicator');
147
  $confirm2->initConfirm();
148
  ?>
149
 
150
+ <script>
151
+ Duplicator.Tools.deleteInstallerFiles = function()
152
  {
153
+ var data = {
154
+ action: 'DUP_CTRL_Tools_deleteInstallerFiles',
155
+ nonce: '<?php echo $ajax_nonce; ?>',
156
+ 'archive-name': '<?php echo $package_name; ?>'
157
+ };
158
 
159
+ jQuery.ajax({
160
+ type: "POST",
161
+ url: ajaxurl,
162
+ dataType: "json",
163
+ data: data,
164
+ complete: function() {
165
+ <?php
166
+ $url = "?page=duplicator-tools&tab=cleanup&action=installer&_wpnonce={$nonce}&package={$package_name}";
167
+ echo "window.location = '{$url}';";
168
+ ?>
169
+ },
170
+ error: function(data) {console.log(data)},
171
+ done: function(data) {console.log(data)}
172
+ });
173
+ }
174
 
175
+ jQuery(document).ready(function($)
176
+ {
 
 
 
 
177
  Duplicator.Tools.ConfirmClearBuildCache = function ()
178
  {
179
  <?php $confirm2->showConfirm(); ?>
183
  {
184
  window.location = '?page=duplicator-tools&tab=cleanup&action=tmp-cache&_wpnonce=<?php echo $nonce; ?>';
185
  }
186
+ });
187
  </script>
188
 
views/tools/controller.php CHANGED
@@ -26,7 +26,7 @@ $current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'logging';
26
  break;
27
  case 'diagnostics': include('diagnostics/main.php');
28
  break;
29
- case 'cleanup': include('cleanup.php');
30
  break;
31
  }
32
  ?>
26
  break;
27
  case 'diagnostics': include('diagnostics/main.php');
28
  break;
29
+ case 'cleanup': include('cleanup.php');
30
  break;
31
  }
32
  ?>
views/tools/diagnostics/inc.validator.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  $scan_run = (isset($_POST['action']) && $_POST['action'] == 'duplicator_recursion') ? true :false;
3
- $ajax_nonce = wp_create_nonce('DUP_CTRL_Tools_RunScanValidator');
4
  ?>
5
 
6
  <style>
@@ -14,7 +14,7 @@ THICK-BOX DIALOGS: -->
14
  $confirm1->title = __('Run Validator', 'duplicator');
15
  $confirm1->message = __('This will run the scan validation check. This may take several minutes. Do you want to Continue?', 'duplicator');
16
  $confirm1->progressOn = false;
17
- $confirm1->jscallback = 'Duplicator.Tools.RunScanValidator()';
18
  $confirm1->initConfirm();
19
  ?>
20
 
@@ -88,11 +88,11 @@ jQuery(document).ready(function($)
88
  }
89
 
90
 
91
- //Run request to: admin-ajax.php?action=DUP_CTRL_Tools_RunScanValidator
92
- Duplicator.Tools.RunScanValidator = function()
93
  {
94
  tb_remove();
95
- var data = {action : 'DUP_CTRL_Tools_RunScanValidator', nonce: '<?php echo $ajax_nonce; ?>', 'scan-recursive': true};
96
 
97
  $('#hb-result').html('<?php _e("Scanning Enviroment... This may take a few minutes.", "duplicator"); ?>');
98
  $('#scan-run-btn').html('<i class="fa fa-circle-o-notch fa-spin fa-fw"></i> Running Please Wait...');
1
  <?php
2
  $scan_run = (isset($_POST['action']) && $_POST['action'] == 'duplicator_recursion') ? true :false;
3
+ $ajax_nonce = wp_create_nonce('DUP_CTRL_Tools_runScanValidator');
4
  ?>
5
 
6
  <style>
14
  $confirm1->title = __('Run Validator', 'duplicator');
15
  $confirm1->message = __('This will run the scan validation check. This may take several minutes. Do you want to Continue?', 'duplicator');
16
  $confirm1->progressOn = false;
17
+ $confirm1->jscallback = 'Duplicator.Tools.runScanValidator()';
18
  $confirm1->initConfirm();
19
  ?>
20
 
88
  }
89
 
90
 
91
+ //Run request to: admin-ajax.php?action=DUP_CTRL_Tools_runScanValidator
92
+ Duplicator.Tools.runScanValidator = function()
93
  {
94
  tb_remove();
95
+ var data = {action : 'DUP_CTRL_Tools_runScanValidator', nonce: '<?php echo $ajax_nonce; ?>', 'scan-recursive': true};
96
 
97
  $('#hb-result').html('<?php _e("Scanning Enviroment... This may take a few minutes.", "duplicator"); ?>');
98
  $('#scan-run-btn').html('<i class="fa fa-circle-o-notch fa-spin fa-fw"></i> Running Please Wait...');
views/tools/diagnostics/main.php CHANGED
@@ -10,11 +10,11 @@
10
  $action_response = null;
11
 
12
  $ctrl_ui = new DUP_CTRL_UI();
13
- $ctrl_ui->SetResponseType('PHP');
14
  $data = $ctrl_ui->GetViewStateList();
15
 
16
- $ui_css_srv_panel = (isset($data->Payload['dup-settings-diag-srv-panel']) && $data->Payload['dup-settings-diag-srv-panel']) ? 'display:block' : 'display:none';
17
- $ui_css_opts_panel = (isset($data->Payload['dup-settings-diag-opts-panel']) && $data->Payload['dup-settings-diag-opts-panel']) ? 'display:block' : 'display:none';
18
 
19
 
20
  //POST BACK
10
  $action_response = null;
11
 
12
  $ctrl_ui = new DUP_CTRL_UI();
13
+ $ctrl_ui->setResponseType('PHP');
14
  $data = $ctrl_ui->GetViewStateList();
15
 
16
+ $ui_css_srv_panel = (isset($data->payload['dup-settings-diag-srv-panel']) && $data->payload['dup-settings-diag-srv-panel']) ? 'display:block' : 'display:none';
17
+ $ui_css_opts_panel = (isset($data->payload['dup-settings-diag-opts-panel']) && $data->payload['dup-settings-diag-opts-panel']) ? 'display:block' : 'display:none';
18
 
19
 
20
  //POST BACK