Duplicator – WordPress Migration Plugin - Version 1.2.46

Version Description

Download this release

Release Info

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

Code changes from version 1.2.44 to 1.2.46

classes/class.server.php CHANGED
@@ -151,11 +151,16 @@ class DUP_Server
151
  {
152
  $files = self::getInstallerFiles();
153
  foreach ($files as $file => $path) {
154
- if (file_exists($path)) return true;
 
 
 
 
 
155
  }
156
  return false;
157
  }
158
-
159
  /**
160
  * Gets a list of all the installer files by name and full path
161
  *
@@ -163,13 +168,16 @@ class DUP_Server
163
  */
164
  public static function getInstallerFiles()
165
  {
 
 
166
  // Files: installer.php, installer-backup.php, installer-data.sql, installer-log.txt, database.sql
167
  return array(
168
  DUPLICATOR_INSTALL_PHP => DUPLICATOR_WPROOTPATH.DUPLICATOR_INSTALL_PHP,
169
  DUPLICATOR_INSTALL_BAK => DUPLICATOR_WPROOTPATH.DUPLICATOR_INSTALL_BAK,
170
- DUPLICATOR_INSTALL_SQL => DUPLICATOR_WPROOTPATH.DUPLICATOR_INSTALL_SQL,
171
- DUPLICATOR_INSTALL_LOG => DUPLICATOR_WPROOTPATH.DUPLICATOR_INSTALL_LOG,
172
- DUPLICATOR_INSTALL_DB => DUPLICATOR_WPROOTPATH.DUPLICATOR_INSTALL_DB
 
173
  );
174
  }
175
 
151
  {
152
  $files = self::getInstallerFiles();
153
  foreach ($files as $file => $path) {
154
+ if (false !== stripos($file, '[hash]')) {
155
+ $glob_files = glob($path);
156
+ if (!empty($glob_files)) {
157
+ return true;
158
+ }
159
+ } elseif (file_exists($path)) return true;
160
  }
161
  return false;
162
  }
163
+
164
  /**
165
  * Gets a list of all the installer files by name and full path
166
  *
168
  */
169
  public static function getInstallerFiles()
170
  {
171
+ // alphanumeric 7 time, then -(dash), then 8 digits
172
+ $hashPattern = '[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]';
173
  // Files: installer.php, installer-backup.php, installer-data.sql, installer-log.txt, database.sql
174
  return array(
175
  DUPLICATOR_INSTALL_PHP => DUPLICATOR_WPROOTPATH.DUPLICATOR_INSTALL_PHP,
176
  DUPLICATOR_INSTALL_BAK => DUPLICATOR_WPROOTPATH.DUPLICATOR_INSTALL_BAK,
177
+
178
+ 'dup-installer-data__[HASH].sql' => DUPLICATOR_WPROOTPATH . 'dup-installer-data__'.$hashPattern.'.sql',
179
+ 'dup-database__[HASH].sql' => DUPLICATOR_WPROOTPATH . 'dup-database__'.$hashPattern.'.sql',
180
+ 'dup-installer-log_[HASH].txt' => DUPLICATOR_WPROOTPATH . 'dup-installer-log__'.$hashPattern.'.txt',
181
  );
182
  }
183
 
classes/package/class.pack.archive.zip.php CHANGED
@@ -66,11 +66,12 @@ class DUP_Zip extends DUP_Archive
66
  DUP_Log::Info("STATS:\tDirs ".self::$scanReport->ARC->DirCount." | Files ".self::$scanReport->ARC->FileCount);
67
 
68
  //ADD SQL
69
- $isSQLInZip = self::$zipArchive->addFile(self::$sqlPath, "database.sql");
 
70
  if ($isSQLInZip) {
71
  DUP_Log::Info("SQL ADDED: ".basename(self::$sqlPath));
72
  } else {
73
- DUP_Log::Error("Unable to add database.sql to archive.", "SQL File Path [".self::$sqlath."]");
74
  }
75
  self::$zipArchive->close();
76
  self::$zipArchive->open(self::$zipPath, ZipArchive::CREATE);
66
  DUP_Log::Info("STATS:\tDirs ".self::$scanReport->ARC->DirCount." | Files ".self::$scanReport->ARC->FileCount);
67
 
68
  //ADD SQL
69
+ $sqlArkFilePath = $archive->Package->getSqlArkFilePath();
70
+ $isSQLInZip = self::$zipArchive->addFile(self::$sqlPath, $sqlArkFilePath);
71
  if ($isSQLInZip) {
72
  DUP_Log::Info("SQL ADDED: ".basename(self::$sqlPath));
73
  } else {
74
+ DUP_Log::Error("Unable to add ".$sqlArkFilePath." to archive.", "SQL File Path [".self::$sqlath."]");
75
  }
76
  self::$zipArchive->close();
77
  self::$zipArchive->open(self::$zipPath, ZipArchive::CREATE);
classes/package/class.pack.installer.php CHANGED
@@ -137,7 +137,7 @@ class DUP_Installer
137
 
138
  global $wpdb;
139
 
140
- DUP_Log::Info("Preping for use");
141
  $installer = DUP_Util::safePath(DUPLICATOR_SSDIR_PATH_TMP)."/{$this->Package->NameHash}_installer.php";
142
 
143
  //Option values to delete at install time
@@ -174,8 +174,10 @@ class DUP_Installer
174
  "fwrite_opts_delete" => json_encode($deleteOpts),
175
  "fwrite_blogname" => esc_html(get_option('blogname')),
176
  "fwrite_wproot" => DUPLICATOR_WPROOTPATH,
177
- "fwrite_wplogin_url" => wp_login_url(),
178
- "fwrite_duplicator_version" => DUPLICATOR_VERSION);
 
 
179
 
180
  if (file_exists($template) && is_readable($template)) {
181
  $err_msg = "ERROR: Unable to read/write installer. \nERROR INFO: Check permission/owner on file and parent folder.\nInstaller File = <{$installer}>";
137
 
138
  global $wpdb;
139
 
140
+ DUP_Log::Info("Preparing for use");
141
  $installer = DUP_Util::safePath(DUPLICATOR_SSDIR_PATH_TMP)."/{$this->Package->NameHash}_installer.php";
142
 
143
  //Option values to delete at install time
174
  "fwrite_opts_delete" => json_encode($deleteOpts),
175
  "fwrite_blogname" => esc_html(get_option('blogname')),
176
  "fwrite_wproot" => DUPLICATOR_WPROOTPATH,
177
+ "fwrite_wplogin_url" => wp_login_url(),
178
+ "package_hash" => $this->Package->getPackageHash(),
179
+ "fwrite_duplicator_version" => DUPLICATOR_VERSION
180
+ );
181
 
182
  if (file_exists($template) && is_readable($template)) {
183
  $err_msg = "ERROR: Unable to read/write installer. \nERROR INFO: Check permission/owner on file and parent folder.\nInstaller File = <{$installer}>";
classes/package/class.pack.php CHANGED
@@ -423,15 +423,16 @@ class DUP_Package
423
  */
424
  public function makeHash()
425
  {
426
- try {
427
- if (function_exists('random_bytes') && DUP_Util::$on_php_53_plus) {
428
- return bin2hex(random_bytes(8)).mt_rand(1000, 9999).date("ymdHis");
429
- } else {
430
- return DUP_Util::GUIDv4();
431
- }
432
- } catch (Exception $exc) {
433
- return DUP_Util::GUIDv4();
434
- }
 
435
  }
436
 
437
  /**
@@ -595,8 +596,29 @@ class DUP_Package
595
  }
596
  }
597
 
 
 
 
 
 
 
 
 
 
 
 
 
598
 
599
-
600
-
 
 
 
 
 
 
 
 
 
601
  }
602
  ?>
423
  */
424
  public function makeHash()
425
  {
426
+ // IMPORTANT! Be VERY careful in changing this format - the FTP delete logic requires 3 segments with the last segment to be the date in YmdHis format.
427
+ try {
428
+ if (function_exists('random_bytes') && DUP_Util::PHP53()) {
429
+ return bin2hex(random_bytes(8)) . mt_rand(1000, 9999) . '_' . date("YmdHis");
430
+ } else {
431
+ return strtolower(md5(uniqid(rand(), true))) . '_' . date("YmdHis");
432
+ }
433
+ } catch (Exception $exc) {
434
+ return strtolower(md5(uniqid(rand(), true))) . '_' . date("YmdHis");
435
+ }
436
  }
437
 
438
  /**
596
  }
597
  }
598
 
599
+ /**
600
+ * Get package hash
601
+ *
602
+ * @return string package hash
603
+ */
604
+ public function getPackageHash() {
605
+ $hashParts = explode('_', $this->Hash);
606
+ $firstPart = substr($hashParts[0], 0, 7);
607
+ $secondPart = substr($hashParts[1], -8);
608
+ $packageHash = $firstPart.'-'.$secondPart;
609
+ return $packageHash;
610
+ }
611
 
612
+ /**
613
+ * Provides the full sql file path in archive
614
+ *
615
+ * @return the full sql file path in archive
616
+ */
617
+ public function getSqlArkFilePath()
618
+ {
619
+ $packageHash = $this->getPackageHash();
620
+ $sqlArkFilePath = 'dup-database__'.$packageHash.'.sql';
621
+ return $sqlArkFilePath;
622
+ }
623
  }
624
  ?>
classes/ui/class.ui.notice.php CHANGED
@@ -37,7 +37,8 @@ class DUP_UI_Notice
37
  if (!isset($screen))
38
  return;
39
 
40
- if (DUP_Server::hasInstallerFiles()) {
 
41
 
42
  $on_active_tab = isset($_GET['section'])? $_GET['section']: '';
43
  echo '<div class="updated notice-success" id="dup-global-error-reserved-files"><p>';
@@ -52,6 +53,7 @@ class DUP_UI_Notice
52
  }
53
 
54
  //On Tools > Cleanup Page
 
55
  if ($screen->id == 'duplicator_page_duplicator-tools' && ($on_active_tab == "info" || $on_active_tab == '') ) {
56
 
57
  $title = __('This site has been successfully migrated!', 'duplicator');
37
  if (!isset($screen))
38
  return;
39
 
40
+ $is_installer_cleanup_req = ($screen->id == 'duplicator_page_duplicator-tools' && isset($_GET['action']) && $_GET['action'] == 'installer');
41
+ if (DUP_Server::hasInstallerFiles() && !$is_installer_cleanup_req) {
42
 
43
  $on_active_tab = isset($_GET['section'])? $_GET['section']: '';
44
  echo '<div class="updated notice-success" id="dup-global-error-reserved-files"><p>';
53
  }
54
 
55
  //On Tools > Cleanup Page
56
+
57
  if ($screen->id == 'duplicator_page_duplicator-tools' && ($on_active_tab == "info" || $on_active_tab == '') ) {
58
 
59
  $title = __('This site has been successfully migrated!', 'duplicator');
classes/utilities/class.u.php CHANGED
@@ -604,65 +604,6 @@ class DUP_Util
604
  return $filepath;
605
  }
606
 
607
-
608
- /**
609
- * Returns a GUIDv4 string
610
- *
611
- * Uses the best cryptographically secure method
612
- * for all supported platforms with fallback to an older,
613
- * less secure version.
614
- *
615
- * @param bool $trim Trim '}{' curly
616
- * @param bool $nodash Remove the dashes from the GUID
617
- * @param bool $grail Add a 'G' to the end for status
618
- *
619
- * @return string
620
- */
621
- public static function GUIDv4($trim = true, $nodash = true, $gtrail = true)
622
- {
623
- // Windows
624
- if (function_exists('com_create_guid') === true) {
625
- if ($trim === true) {
626
- $guidv4 = trim(com_create_guid(), '{}');
627
- } else {
628
- $guidv4 = com_create_guid();
629
- }
630
-
631
- //Linux
632
- } elseif (function_exists('openssl_random_pseudo_bytes') === true) {
633
- $data = openssl_random_pseudo_bytes(16);
634
- $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
635
- $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
636
- $guidv4 = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
637
-
638
- // Fallback (PHP 4.2+)
639
- } else {
640
-
641
- mt_srand((double) microtime() * 10000);
642
- $charid = strtolower(md5(uniqid(rand(), true)));
643
- $hyphen = chr(45); // "-"
644
- $lbrace = $trim ? "" : chr(123); // "{"
645
- $rbrace = $trim ? "" : chr(125); // "}"
646
- $guidv4 = $lbrace.
647
- substr($charid, 0, 8).$hyphen.
648
- substr($charid, 8, 4).$hyphen.
649
- substr($charid, 12, 4).$hyphen.
650
- substr($charid, 16, 4).$hyphen.
651
- substr($charid, 20, 12).
652
- $rbrace;
653
- }
654
-
655
- if ($nodash) {
656
- $guidv4 = str_replace('-', '', $guidv4);
657
- }
658
-
659
- if ($gtrail) {
660
- $guidv4 = $guidv4.'G';
661
- }
662
-
663
- return $guidv4;
664
- }
665
-
666
  /**
667
  * Returns an array of the WordPress core tables.
668
  *
@@ -740,5 +681,15 @@ class DUP_Util
740
 
741
  return false;
742
  }
 
 
 
 
 
 
 
 
 
 
743
  }
744
  DUP_Util::init();
604
  return $filepath;
605
  }
606
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
  /**
608
  * Returns an array of the WordPress core tables.
609
  *
681
 
682
  return false;
683
  }
684
+
685
+ /**
686
+ * Is the server PHP 5.3 or better
687
+ *
688
+ * @return bool Returns true if the server PHP 5.3 or better
689
+ */
690
+ public static function PHP53()
691
+ {
692
+ return version_compare(PHP_VERSION, '5.3.2', '>=');
693
+ }
694
  }
695
  DUP_Util::init();
ctrls/ctrl.tools.php CHANGED
@@ -16,7 +16,6 @@ class DUP_CTRL_Tools extends DUP_CTRL_Base
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
  /**
@@ -57,50 +56,4 @@ class DUP_CTRL_Tools extends DUP_CTRL_Base
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
- $payload = array();
75
- try
76
- {
77
- //CONTROLLER LOGIC
78
- $installer_files = DUP_Server::getInstallerFiles();
79
- //array_push($installer_files, $package_path);
80
- foreach($installer_files as $file => $path) {
81
- if (! is_dir($path)) {
82
- @chmod($path, 0777);
83
- $status = (@unlink($path) === false) ? false : true;
84
- $payload[] = array(
85
- 'file' => $path,
86
- 'removed' => $status,
87
- 'writable' => is_writable($path),
88
- 'readable' => is_readable($path),
89
- 'exists' => file_exists($path)
90
- );
91
- }
92
- }
93
-
94
- //RETURN RESULT
95
- $test = (in_array(true, $payload['exists']))
96
- ? DUP_CTRL_Status::FAILED
97
- : DUP_CTRL_Status::SUCCESS;
98
- $result->process($payload, $test);
99
- }
100
- catch (Exception $exc)
101
- {
102
- $result->processError($exc);
103
- }
104
- }
105
-
106
  }
16
  function __construct()
17
  {
18
  add_action('wp_ajax_DUP_CTRL_Tools_runScanValidator', array($this, 'runScanValidator'));
 
19
  }
20
 
21
  /**
56
  $result->processError($exc);
57
  }
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
debug/tst.tools.php CHANGED
@@ -34,16 +34,5 @@
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>
34
  </div>
35
  </form>
36
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  </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.44');
6
  define('DUPLICATOR_HOMEPAGE', 'https://snapcreek.com/duplicator/duplicator-free/');
7
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
8
  define('DUPLICATOR_SITE_URL', get_site_url());
@@ -26,10 +26,6 @@ if (function_exists('plugin_dir_url'))
26
  define('DUPLICATOR_SSDIR_URL', DUPLICATOR_SITE_URL . "/" . DUPLICATOR_SSDIR_NAME);
27
  define('DUPLICATOR_INSTALL_PHP', 'installer.php');
28
  define('DUPLICATOR_INSTALL_BAK', 'installer-backup.php');
29
- define('DUPLICATOR_INSTALL_SQL', 'installer-data.sql');
30
- define('DUPLICATOR_INSTALL_LOG', 'installer-log.txt');
31
- define('DUPLICATOR_INSTALL_DB', 'database.sql');
32
-
33
 
34
  //GENERAL CONSTRAINTS
35
  define('DUPLICATOR_PHP_MAX_MEMORY', '2048M');
2
  //Prevent directly browsing to the file
3
  if (function_exists('plugin_dir_url'))
4
  {
5
+ define('DUPLICATOR_VERSION', '1.2.46');
6
  define('DUPLICATOR_HOMEPAGE', 'https://snapcreek.com/duplicator/duplicator-free/');
7
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
8
  define('DUPLICATOR_SITE_URL', get_site_url());
26
  define('DUPLICATOR_SSDIR_URL', DUPLICATOR_SITE_URL . "/" . DUPLICATOR_SSDIR_NAME);
27
  define('DUPLICATOR_INSTALL_PHP', 'installer.php');
28
  define('DUPLICATOR_INSTALL_BAK', 'installer-backup.php');
 
 
 
 
29
 
30
  //GENERAL CONSTRAINTS
31
  define('DUPLICATOR_PHP_MAX_MEMORY', '2048M');
duplicator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Duplicator
4
  Plugin URI: https://snapcreek.com/duplicator/duplicator-free/
5
  Description: Migrate and backup a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly.
6
- Version: 1.2.44
7
  Author: Snap Creek
8
  Author URI: http://www.snapcreek.com/duplicator/
9
  Text Domain: duplicator
3
  Plugin Name: Duplicator
4
  Plugin URI: https://snapcreek.com/duplicator/duplicator-free/
5
  Description: Migrate and backup a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly.
6
+ Version: 1.2.46
7
  Author: Snap Creek
8
  Author URI: http://www.snapcreek.com/duplicator/
9
  Text Domain: duplicator
installer/build/classes/class.logging.php CHANGED
@@ -4,8 +4,8 @@ define('ERR_CONFIG_FOUND', 'A wp-config.php already exists in this location. T
4
  define('ERR_ZIPNOTFOUND', 'The packaged zip file was not found. Be sure the zip package is in the same directory as the installer file and as the correct permissions. If you are trying to reinstall a package you can copy the package from the "' . DUPLICATOR_SSDIR_NAME . '" directory back up to your root which is the same location as your installer.php file.');
5
  define('ERR_ZIPOPEN', 'Failed to open zip archive file. Please be sure the archive is completely downloaded before running the installer. Try to extract the archive manually to make sure the file is not corrupted.');
6
  define('ERR_ZIPEXTRACTION', 'Errors extracting zip file. Portions or part of the zip archive did not extract correctly. Try to extract the archive manually with a client side program like unzip/win-zip/winrar or your hosts cPanel to make sure the file is not corrupted. If the file extracts correctly then there is an invalid file or directory that PHP is unable to extract. This can happen if your moving from one operating system to another where certain naming conventions work on one environment and not another. <br/><br/> <b>Workarounds:</b> <br/> 1. Create a new package and be sure to exclude any directories that have invalid names or files in them. This warning will be displayed on the scan results under "Name Checks". <br/> 2. Manually extract the zip file with a client side program or your hosts cPanel. Then under options in step 1 of this installer check the "Manual Archive Extraction" option and perform the install.');
7
- define('ERR_ZIPMANUAL', 'When choosing manual package extraction, the contents of the package must already be extracted and the wp-config.php and database.sql files must be present in the same directory as the installer.php for the process to continue. Please manually extract the package into the current directory before continuing in manual extraction mode. Also validate that the wp-config.php and database.sql files are present.');
8
- define('ERR_MAKELOG', 'PHP is having issues writing to the log file <b>' . DUPX_U::setSafePath($GLOBALS['CURRENT_ROOT_PATH']) . '\installer-log.txt .</b> In order for the Duplicator to proceed validate your owner/group and permission settings for PHP on this path. Try temporarily setting you permissions to 777 to see if the issue gets resolved. If you are on a shared hosting environment please contact your hosting company and tell them you are getting errors writing files to the path above when using PHP.');
9
  define('ERR_ZIPARCHIVE', 'In order to extract the archive.zip file the PHP ZipArchive module must be installed. Please read the FAQ for more details. You can still install this package but you will need to check the Manual package extraction checkbox found in the Advanced Options. Please read the online user guide for details in performing a manual package extraction.');
10
  define('ERR_MYSQLI_SUPPORT', 'In order to complete an install the mysqli extension for PHP is required. If you are on a hosted server please contact your host and request that mysqli be enabled. For more information visit: http://php.net/manual/en/mysqli.installation.php');
11
  define('ERR_DBCONNECT', 'DATABASE CONNECTION FAILED!<br/>');
@@ -16,7 +16,7 @@ define('ERR_DBCREATE', 'The database "%s" does not exists.<br/> Change mode t
16
  define('ERR_DBEMPTY', 'The database "%s" has "%s" tables. The Duplicator only works with an EMPTY database. Enable the action "Connect and Remove All Data" radio button to remove all tables and or create a new database. Some hosting providers do not allow table removal from scripts. In this case you will need to login to your hosting providers control panel and remove the tables manually. Please contact your hosting provider for further details. Always backup all your data before proceeding!');
17
  define('ERR_TESTDB_UTF8', 'UTF8 Characters were detected as part of the database connection string. If your connection fails be sure to update the MySQL my.ini configuration file setting to support UTF8 characters by enabling this option [character_set_server=utf8] and restarting the database server.');
18
  define('ERR_TESTDB_VERSION_INFO', 'If the current version detected is below 5.5.3 (release on April 8th 2010) then support for utf8mb4 tables will not work. The utf8mb4 format is only supported in MySQL server 5.5.3+. It is highly recommended to upgrade your version of MySQL server on this server to be more compatible with recent releases of WordPress and avoid issues with install errors.');
19
- define('ERR_TESTDB_VERSION_COMPAT', 'In order to avoid database incompatibility issues make sure the database versions between the build and installer servers are as close as possible. If the package was created on a newer database version than where it is being installed then you might run into issues.<br/><br/> It is best to make sure the server where the installer is running has the same or higher version number than where it was built. If the major and minor version are the same or close for example [5.7 to 5.6], then the migration should work without issues. A version pair of [5.7 to 5.1] is more likely to cause issues unless you have a very simple setup. If the versions are too far apart work with your hosting provider to upgrade the MySQL engine on this server.<br/><br/> <b>MariaDB:</b> If a version of 10.N.N shows then the database distribution is a MariaDB flavor of MySQL. While the distributions are very close there are some subtle differences. Some operating systems will report the version such as "5.5.5-10.1.21-MariaDB" showing the correlation of both. Please visit the online <a href="https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/" target="_blank">MariaDB versus MySQL - Compatibility</a> page for more details.<br/><br/> Please note these messages are simply notices. It is highly recommended that you continue with the install process and closely monitor the installer-log.txt file along with the install report found on step 3 of the installer. Be sure to look for any notices/warnings/errors in these locations to validate the install process did not detect any errors. If any issues are found please visit the FAQ pages and see the question <a href="https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=database_incompatibility#faq-installer-260-q" target="_blank">What if I get database errors or general warnings on the install report?</a>.');
20
 
21
  /**
22
  * Class used to log information to the installer-log.txt file
4
  define('ERR_ZIPNOTFOUND', 'The packaged zip file was not found. Be sure the zip package is in the same directory as the installer file and as the correct permissions. If you are trying to reinstall a package you can copy the package from the "' . DUPLICATOR_SSDIR_NAME . '" directory back up to your root which is the same location as your installer.php file.');
5
  define('ERR_ZIPOPEN', 'Failed to open zip archive file. Please be sure the archive is completely downloaded before running the installer. Try to extract the archive manually to make sure the file is not corrupted.');
6
  define('ERR_ZIPEXTRACTION', 'Errors extracting zip file. Portions or part of the zip archive did not extract correctly. Try to extract the archive manually with a client side program like unzip/win-zip/winrar or your hosts cPanel to make sure the file is not corrupted. If the file extracts correctly then there is an invalid file or directory that PHP is unable to extract. This can happen if your moving from one operating system to another where certain naming conventions work on one environment and not another. <br/><br/> <b>Workarounds:</b> <br/> 1. Create a new package and be sure to exclude any directories that have invalid names or files in them. This warning will be displayed on the scan results under "Name Checks". <br/> 2. Manually extract the zip file with a client side program or your hosts cPanel. Then under options in step 1 of this installer check the "Manual Archive Extraction" option and perform the install.');
7
+ define('ERR_ZIPMANUAL', "When choosing manual package extraction, the contents of the package must already be extracted and the wp-config.php and dup-database__{$GLOBALS['PACKAGE_HASH']}.sql files must be present in the same directory as the installer.php for the process to continue. Please manually extract the package into the current directory before continuing in manual extraction mode. Also validate that the wp-config.php and dup-database__{$GLOBALS['PACKAGE_HASH']}.sql files are present.");
8
+ define('ERR_MAKELOG', 'PHP is having issues writing to the log file <b>' . DUPX_U::setSafePath($GLOBALS['CURRENT_ROOT_PATH']) . '\".$GLOBALS["LOG_FILE_NAME"]." .</b> In order for the Duplicator to proceed validate your owner/group and permission settings for PHP on this path. Try temporarily setting you permissions to 777 to see if the issue gets resolved. If you are on a shared hosting environment please contact your hosting company and tell them you are getting errors writing files to the path above when using PHP.');
9
  define('ERR_ZIPARCHIVE', 'In order to extract the archive.zip file the PHP ZipArchive module must be installed. Please read the FAQ for more details. You can still install this package but you will need to check the Manual package extraction checkbox found in the Advanced Options. Please read the online user guide for details in performing a manual package extraction.');
10
  define('ERR_MYSQLI_SUPPORT', 'In order to complete an install the mysqli extension for PHP is required. If you are on a hosted server please contact your host and request that mysqli be enabled. For more information visit: http://php.net/manual/en/mysqli.installation.php');
11
  define('ERR_DBCONNECT', 'DATABASE CONNECTION FAILED!<br/>');
16
  define('ERR_DBEMPTY', 'The database "%s" has "%s" tables. The Duplicator only works with an EMPTY database. Enable the action "Connect and Remove All Data" radio button to remove all tables and or create a new database. Some hosting providers do not allow table removal from scripts. In this case you will need to login to your hosting providers control panel and remove the tables manually. Please contact your hosting provider for further details. Always backup all your data before proceeding!');
17
  define('ERR_TESTDB_UTF8', 'UTF8 Characters were detected as part of the database connection string. If your connection fails be sure to update the MySQL my.ini configuration file setting to support UTF8 characters by enabling this option [character_set_server=utf8] and restarting the database server.');
18
  define('ERR_TESTDB_VERSION_INFO', 'If the current version detected is below 5.5.3 (release on April 8th 2010) then support for utf8mb4 tables will not work. The utf8mb4 format is only supported in MySQL server 5.5.3+. It is highly recommended to upgrade your version of MySQL server on this server to be more compatible with recent releases of WordPress and avoid issues with install errors.');
19
+ define('ERR_TESTDB_VERSION_COMPAT', 'In order to avoid database incompatibility issues make sure the database versions between the build and installer servers are as close as possible. If the package was created on a newer database version than where it is being installed then you might run into issues.<br/><br/> It is best to make sure the server where the installer is running has the same or higher version number than where it was built. If the major and minor version are the same or close for example [5.7 to 5.6], then the migration should work without issues. A version pair of [5.7 to 5.1] is more likely to cause issues unless you have a very simple setup. If the versions are too far apart work with your hosting provider to upgrade the MySQL engine on this server.<br/><br/> <b>MariaDB:</b> If a version of 10.N.N shows then the database distribution is a MariaDB flavor of MySQL. While the distributions are very close there are some subtle differences. Some operating systems will report the version such as "5.5.5-10.1.21-MariaDB" showing the correlation of both. Please visit the online <a href="https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/" target="_blank">MariaDB versus MySQL - Compatibility</a> page for more details.<br/><br/> Please note these messages are simply notices. It is highly recommended that you continue with the install process and closely monitor the <?php echo $GLOBALS["LOG_FILE_NAME"];?> file along with the install report found on step 3 of the installer. Be sure to look for any notices/warnings/errors in these locations to validate the install process did not detect any errors. If any issues are found please visit the FAQ pages and see the question <a href="https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=database_incompatibility#faq-installer-260-q" target="_blank">What if I get database errors or general warnings on the install report?</a>.');
20
 
21
  /**
22
  * Class used to log information to the installer-log.txt file
installer/build/ctrls/ctrl.step1.php CHANGED
@@ -37,7 +37,7 @@ error_reporting(E_ERROR);
37
  if (!$GLOBALS['FW_ARCHIVE_ONLYDB']) {
38
  //ERR_ZIPMANUAL
39
  if ($_POST['archive_engine'] == 'manual') {
40
- if (!file_exists("wp-config.php") && !file_exists("database.sql")) {
41
  DUPX_Log::error(ERR_ZIPMANUAL);
42
  }
43
  } else {
37
  if (!$GLOBALS['FW_ARCHIVE_ONLYDB']) {
38
  //ERR_ZIPMANUAL
39
  if ($_POST['archive_engine'] == 'manual') {
40
+ if (!file_exists("wp-config.php") && !file_exists("dup-database__{$GLOBALS['PACKAGE_HASH']}.sql")) {
41
  DUPX_Log::error(ERR_ZIPMANUAL);
42
  }
43
  } else {
installer/build/ctrls/ctrl.step2.php CHANGED
@@ -183,7 +183,7 @@ DUPX_Log::info($log, 2);
183
  $log = '';
184
  $faq_url = $GLOBALS['FAQ_URL'];
185
  $utm_prefix = '?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=';
186
- $db_file_size = filesize('database.sql');
187
  $php_mem = $GLOBALS['PHP_MEMORY_LIMIT'];
188
  $php_mem_range = DUPX_U::getBytes($GLOBALS['PHP_MEMORY_LIMIT']);
189
  $php_mem_range = $php_mem_range == null ? 0 : $php_mem_range - 5000000; //5 MB Buffer
@@ -195,23 +195,23 @@ if ($db_file_size >= $php_mem_range && $php_mem_range != 0)
195
  $db_file_size = DUPX_U::readableByteSize($db_file_size);
196
  $msg = "\nWARNING: The database script is '{$db_file_size}' in size. The PHP memory allocation is set\n";
197
  $msg .= "at '{$php_mem}'. There is a high possibility that the installer script will fail with\n";
198
- $msg .= "a memory allocation error when trying to load the database.sql file. It is\n";
199
  $msg .= "recommended to increase the 'memory_limit' setting in the php.ini config file.\n";
200
  $msg .= "see: {$faq_url}{$utm_prefix}inst_step2_lgdbscript#faq-trouble-056-q \n";
201
  DUPX_Log::info($msg);
202
  }
203
 
204
- @chmod("{$root_path}/database.sql", 0777);
205
- $sql_file = file_get_contents('database.sql', true);
206
 
207
  //ERROR: Reading database.sql file
208
  if ($sql_file === FALSE || strlen($sql_file) < 10)
209
  {
210
- $msg = "<b>Unable to read the database.sql file from the archive. Please check these items:</b> <br/>";
211
  $msg .= "1. Validate permissions and/or group-owner rights on these items: <br/>";
212
- $msg .= " - File: database.sql <br/> - Directory: [{$root_path}] <br/>";
213
  $msg .= "<i>see: <a href='{$faq_url}{$utm_prefix}inst_step2_dbperms#faq-trouble-055-q' target='_blank'>{$faq_url}#faq-trouble-055-q</a></i> <br/>";
214
- $msg .= "2. Validate the database.sql file exists and is in the root of the archive.zip file <br/>";
215
  $msg .= "<i>see: <a href='{$faq_url}{$utm_prefix}inst_step2_sqlroot#faq-installer-020-q' target='_blank'>{$faq_url}#faq-installer-020-q</a></i> <br/>";
216
  DUPX_Log::error($msg);
217
  }
@@ -275,9 +275,9 @@ if($_POST['dbcollatefb']){
275
  //WARNING: Create installer-data.sql failed
276
  if ($sql_file_copy_status === FALSE || filesize($sql_result_file_path) == 0 || !is_readable($sql_result_file_path))
277
  {
278
- $sql_file_size = DUPX_U::readableByteSize(filesize('database.sql'));
279
- $msg = "\nWARNING: Unable to properly copy database.sql ({$sql_file_size}) to {$GLOBALS['SQL_FILE_NAME']}. Please check these items:\n";
280
- $msg .= "- Validate permissions and/or group-owner rights on database.sql and directory [{$root_path}] \n";
281
  $msg .= "- see: {$faq_url}{$utm_prefix}inst_step2_copydbsql#faq-trouble-055-q \n";
282
  DUPX_Log::info($msg);
283
  }
@@ -314,7 +314,7 @@ $dbvar_maxtime = is_null($dbvar_maxtime) ? 300 : $dbvar_maxtime;
314
  $dbvar_maxpacks = is_null($dbvar_maxpacks) ? 1048576 : $dbvar_maxpacks;
315
  $dbvar_sqlmode = empty($dbvar_sqlmode) ? 'NOT_SET' : $dbvar_sqlmode;
316
  $dbvar_version = DUPX_DB::getVersion($dbh);
317
- $sql_file_size1 = DUPX_U::readableByteSize(@filesize("database.sql"));
318
  $sql_file_size2 = DUPX_U::readableByteSize(@filesize("{$GLOBALS['SQL_FILE_NAME']}"));
319
  $db_collatefb = isset($_POST['dbcollatefb']) ? 'On' : 'Off';
320
 
@@ -323,7 +323,7 @@ DUPX_Log::info("--------------------------------------");
323
  DUPX_Log::info("DATABASE ENVIRONMENT");
324
  DUPX_Log::info("--------------------------------------");
325
  DUPX_Log::info("MYSQL VERSION:\tThis Server: {$dbvar_version} -- Build Server: {$GLOBALS['FW_VERSION_DB']}");
326
- DUPX_Log::info("FILE SIZE:\tdatabase.sql ({$sql_file_size1}) - installer-data.sql ({$sql_file_size2})");
327
  DUPX_Log::info("TIMEOUT:\t{$dbvar_maxtime}");
328
  DUPX_Log::info("MAXPACK:\t{$dbvar_maxpacks}");
329
  DUPX_Log::info("SQLMODE:\t{$dbvar_sqlmode}");
@@ -434,8 +434,8 @@ if ($result = mysqli_query($dbh, "SHOW TABLES")) {
434
  }
435
 
436
  if ($dbtable_count == 0) {
437
- DUPX_Log::error("No tables where created during step 2 of the install. Please review the <a href='installer-log.txt' target='install_log'>installer-log.txt</a> file for
438
- ERROR messages. You may have to manually run the installer-data.sql with a tool like phpmyadmin to validate the data input. If you have enabled compatibility mode
439
  during the package creation process then the database server version your using may not be compatible with this script.\n");
440
  }
441
 
183
  $log = '';
184
  $faq_url = $GLOBALS['FAQ_URL'];
185
  $utm_prefix = '?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=';
186
+ $db_file_size = filesize("dup-database__{$GLOBALS['PACKAGE_HASH']}.sql");
187
  $php_mem = $GLOBALS['PHP_MEMORY_LIMIT'];
188
  $php_mem_range = DUPX_U::getBytes($GLOBALS['PHP_MEMORY_LIMIT']);
189
  $php_mem_range = $php_mem_range == null ? 0 : $php_mem_range - 5000000; //5 MB Buffer
195
  $db_file_size = DUPX_U::readableByteSize($db_file_size);
196
  $msg = "\nWARNING: The database script is '{$db_file_size}' in size. The PHP memory allocation is set\n";
197
  $msg .= "at '{$php_mem}'. There is a high possibility that the installer script will fail with\n";
198
+ $msg .= "a memory allocation error when trying to load the dup-database__{$GLOBALS['PACKAGE_HASH']}.sql file. It is\n";
199
  $msg .= "recommended to increase the 'memory_limit' setting in the php.ini config file.\n";
200
  $msg .= "see: {$faq_url}{$utm_prefix}inst_step2_lgdbscript#faq-trouble-056-q \n";
201
  DUPX_Log::info($msg);
202
  }
203
 
204
+ @chmod("{$root_path}/dup-database__{$GLOBALS['PACKAGE_HASH']}.sql", 0777);
205
+ $sql_file = file_get_contents("dup-database__{$GLOBALS['PACKAGE_HASH']}.sql", true);
206
 
207
  //ERROR: Reading database.sql file
208
  if ($sql_file === FALSE || strlen($sql_file) < 10)
209
  {
210
+ $msg = "<b>Unable to read the dup-database__{$GLOBALS['PACKAGE_HASH']}.sql file from the archive. Please check these items:</b> <br/>";
211
  $msg .= "1. Validate permissions and/or group-owner rights on these items: <br/>";
212
+ $msg .= " - File: dup-database__{$GLOBALS['PACKAGE_HASH']}.sql <br/> - Directory: [{$root_path}] <br/>";
213
  $msg .= "<i>see: <a href='{$faq_url}{$utm_prefix}inst_step2_dbperms#faq-trouble-055-q' target='_blank'>{$faq_url}#faq-trouble-055-q</a></i> <br/>";
214
+ $msg .= "2. Validate the dup-database__{$GLOBALS['PACKAGE_HASH']}.sql file exists and is in the root of the archive.zip file <br/>";
215
  $msg .= "<i>see: <a href='{$faq_url}{$utm_prefix}inst_step2_sqlroot#faq-installer-020-q' target='_blank'>{$faq_url}#faq-installer-020-q</a></i> <br/>";
216
  DUPX_Log::error($msg);
217
  }
275
  //WARNING: Create installer-data.sql failed
276
  if ($sql_file_copy_status === FALSE || filesize($sql_result_file_path) == 0 || !is_readable($sql_result_file_path))
277
  {
278
+ $sql_file_size = DUPX_U::readableByteSize(filesize("dup-database__{$GLOBALS['PACKAGE_HASH']}.sql"));
279
+ $msg = "\nWARNING: Unable to properly copy dup-database__{$GLOBALS['PACKAGE_HASH']}.sql ({$sql_file_size}) to {$GLOBALS['SQL_FILE_NAME']}. Please check these items:\n";
280
+ $msg .= "- Validate permissions and/or group-owner rights on dup-database__{$GLOBALS['PACKAGE_HASH']}.sql and directory [{$root_path}] \n";
281
  $msg .= "- see: {$faq_url}{$utm_prefix}inst_step2_copydbsql#faq-trouble-055-q \n";
282
  DUPX_Log::info($msg);
283
  }
314
  $dbvar_maxpacks = is_null($dbvar_maxpacks) ? 1048576 : $dbvar_maxpacks;
315
  $dbvar_sqlmode = empty($dbvar_sqlmode) ? 'NOT_SET' : $dbvar_sqlmode;
316
  $dbvar_version = DUPX_DB::getVersion($dbh);
317
+ $sql_file_size1 = DUPX_U::readableByteSize(@filesize("dup-database__{$GLOBALS['PACKAGE_HASH']}.sql"));
318
  $sql_file_size2 = DUPX_U::readableByteSize(@filesize("{$GLOBALS['SQL_FILE_NAME']}"));
319
  $db_collatefb = isset($_POST['dbcollatefb']) ? 'On' : 'Off';
320
 
323
  DUPX_Log::info("DATABASE ENVIRONMENT");
324
  DUPX_Log::info("--------------------------------------");
325
  DUPX_Log::info("MYSQL VERSION:\tThis Server: {$dbvar_version} -- Build Server: {$GLOBALS['FW_VERSION_DB']}");
326
+ DUPX_Log::info("FILE SIZE:\tdup-database__{$GLOBALS['PACKAGE_HASH']}.sql ({$sql_file_size1}) - dup-installer-data__{$GLOBALS['PACKAGE_HASH']}.sql ({$sql_file_size2})");
327
  DUPX_Log::info("TIMEOUT:\t{$dbvar_maxtime}");
328
  DUPX_Log::info("MAXPACK:\t{$dbvar_maxpacks}");
329
  DUPX_Log::info("SQLMODE:\t{$dbvar_sqlmode}");
434
  }
435
 
436
  if ($dbtable_count == 0) {
437
+ DUPX_Log::error("No tables where created during step 2 of the install. Please review the <a href='".$GLOBALS["LOG_FILE_NAME"]."' target='install_log'>".$GLOBALS["LOG_FILE_NAME"]."</a> file for
438
+ ERROR messages. You may have to manually run the installer-data__{$GLOBALS['PACKAGE_HASH']}.sql with a tool like phpmyadmin to validate the data input. If you have enabled compatibility mode
439
  during the package creation process then the database server version your using may not be compatible with this script.\n");
440
  }
441
 
installer/build/ctrls/ctrl.step3.php CHANGED
@@ -33,9 +33,15 @@ $_POST['retain_config'] = (isset($_POST['retain_config']) && $_POST['retain_conf
33
  $_POST['exe_safe_mode'] = isset($_POST['exe_safe_mode']) ? $_POST['exe_safe_mode'] : 0;
34
 
35
 
 
 
 
 
 
 
 
 
36
 
37
- //MYSQL CONNECTION
38
- $dbh = DUPX_DB::connect($_POST['dbhost'], $_POST['dbuser'], html_entity_decode($_POST['dbpass']), $_POST['dbname'], $_POST['dbport']);
39
  $charset_server = @mysqli_character_set_name($dbh);
40
  @mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}");
41
  DUPX_DB::setCharset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
33
  $_POST['exe_safe_mode'] = isset($_POST['exe_safe_mode']) ? $_POST['exe_safe_mode'] : 0;
34
 
35
 
36
+ //MYSQL CONNECTION: If inputs are bad then die
37
+ $dbh = DUPX_DB::connect($_POST['dbhost'], $_POST['dbuser'], html_entity_decode($_POST['dbpass']), $_POST['dbname'], $_POST['dbport']);
38
+ $dbConnError = (mysqli_connect_error()) ? 'Error: '.mysqli_connect_error() : 'Unable to Connect';
39
+ if (!$dbh) {
40
+ $msg = "Unable to connect with the following parameters: <br/> <b>HOST:</b> {$_POST['dbhost']}<br/> <b>DATABASE:</b> {$_POST['dbname']}<br/>";
41
+ $msg .= "<b>Connection Error:</b> {$dbConnError}";
42
+ DUPX_Log::error($msg);
43
+ }
44
 
 
 
45
  $charset_server = @mysqli_character_set_name($dbh);
46
  @mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}");
47
  DUPX_DB::setCharset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
installer/build/main.installer.php CHANGED
@@ -111,6 +111,7 @@ $GLOBALS['FW_WPLOGIN_URL'] = '%fwrite_wplogin_url%';
111
  $GLOBALS['FW_OPTS_DELETE'] = json_decode("%fwrite_opts_delete%", true);
112
  $GLOBALS['FW_DUPLICATOR_VERSION'] = '%fwrite_duplicator_version%';
113
  $GLOBALS['FW_ARCHIVE_ONLYDB'] = '%fwrite_archive_onlydb%';
 
114
 
115
  //DATABASE SETUP: all time in seconds
116
  $GLOBALS['DB_MAX_TIME'] = 5000;
@@ -166,8 +167,9 @@ $_POST['dbcharset'] = isset($_POST['dbcharset']) ? trim($_POST['dbcharset']) :
166
  $_POST['dbcollate'] = isset($_POST['dbcollate']) ? trim($_POST['dbcollate']) : $GLOBALS['DBCOLLATE_DEFAULT'];
167
 
168
  //GLOBALS
169
- $GLOBALS['SQL_FILE_NAME'] = "installer-data.sql";
170
- $GLOBALS['LOG_FILE_NAME'] = "installer-log.txt";
 
171
  $GLOBALS['LOGGING'] = isset($_POST['logging']) ? $_POST['logging'] : 1;
172
  $GLOBALS['CURRENT_ROOT_PATH'] = dirname(__FILE__);
173
  $GLOBALS['CHOWN_ROOT_PATH'] = @chmod("{$GLOBALS['CURRENT_ROOT_PATH']}", 0755);
111
  $GLOBALS['FW_OPTS_DELETE'] = json_decode("%fwrite_opts_delete%", true);
112
  $GLOBALS['FW_DUPLICATOR_VERSION'] = '%fwrite_duplicator_version%';
113
  $GLOBALS['FW_ARCHIVE_ONLYDB'] = '%fwrite_archive_onlydb%';
114
+ $GLOBALS['PACKAGE_HASH'] = '%package_hash%';
115
 
116
  //DATABASE SETUP: all time in seconds
117
  $GLOBALS['DB_MAX_TIME'] = 5000;
167
  $_POST['dbcollate'] = isset($_POST['dbcollate']) ? trim($_POST['dbcollate']) : $GLOBALS['DBCOLLATE_DEFAULT'];
168
 
169
  //GLOBALS
170
+ // Constants which are dependent on the $GLOBALS['DUPX_AC']
171
+ $GLOBALS['SQL_FILE_NAME'] = "dup-installer-data__{$GLOBALS['PACKAGE_HASH']}.sql";
172
+ $GLOBALS['LOG_FILE_NAME'] = "dup-installer-log__{$GLOBALS['PACKAGE_HASH']}.txt";
173
  $GLOBALS['LOGGING'] = isset($_POST['logging']) ? $_POST['logging'] : 1;
174
  $GLOBALS['CURRENT_ROOT_PATH'] = dirname(__FILE__);
175
  $GLOBALS['CHOWN_ROOT_PATH'] = @chmod("{$GLOBALS['CURRENT_ROOT_PATH']}", 0755);
installer/build/view.help.php CHANGED
@@ -222,7 +222,7 @@ STEP 1
222
  <tr>
223
  <td>Logging</td>
224
  <td>
225
- The level of detail that will be sent to the log file (installer-log.txt). The recommend setting for most installs should be 'Light'.
226
  Note if you use Debug the amount of data written can be very large. Debug is only recommended for support.
227
  </td>
228
  </tr>
@@ -540,13 +540,14 @@ STEP 4
540
  When completed with the installation please delete all installation files. Leaving these files on your server can impose a security risk! You can remove
541
  all the security files by logging into your WordPress admin and following the remove notification links. Be sure all these files are removed. Optionally
542
  it is also recommended to remove the archive.zip file.
 
543
  <ul>
544
  <li>installer.php</li>
545
- <li>installer-data.sql</li>
546
  <li>installer-backup.php</li>
547
- <li>installer-log.txt</li>
548
- <li>database.sql</li>
549
- <li>[a-hash-code]_archive.zip <small>(optional)</small></li>
 
550
  </ul>
551
  <br/><br/>
552
 
222
  <tr>
223
  <td>Logging</td>
224
  <td>
225
+ The level of detail that will be sent to the log file (<?php echo $GLOBALS["LOG_FILE_NAME"];?>). The recommend setting for most installs should be 'Light'.
226
  Note if you use Debug the amount of data written can be very large. Debug is only recommended for support.
227
  </td>
228
  </tr>
540
  When completed with the installation please delete all installation files. Leaving these files on your server can impose a security risk! You can remove
541
  all the security files by logging into your WordPress admin and following the remove notification links. Be sure all these files are removed. Optionally
542
  it is also recommended to remove the archive.zip file.
543
+ <!-- Do not display hash codes anywhere in UI. -->
544
  <ul>
545
  <li>installer.php</li>
 
546
  <li>installer-backup.php</li>
547
+ <li>dup-installer-data_[HASH].sql</li>
548
+ <li>dup-database_[HASH].sql</li>
549
+ <li>dup-installer-log_[HASH].txt</li>
550
+ <li>[HASH]_archive.zip</li>
551
  </ul>
552
  <br/><br/>
553
 
installer/build/view.step1.php CHANGED
@@ -23,7 +23,7 @@ if ($arcStatus) {
23
  //until further reports are discovered, removed on 04-06-2018
24
  //$badFiles = array('__MACOSX', $arcFilePath);
25
  $badFiles = array('', $arcFilePath);
26
- $goodFiles = array('database.sql', 'installer-backup.php');
27
  $goodFilesFound = true;
28
  $badFilesFound = false;
29
 
@@ -223,7 +223,7 @@ ARCHIVE
223
  the issue. Please check the contents of the zip archive and be sure its contents match the layout of your site.
224
  <br/><br/>
225
 
226
- Files such as database.sql and wp-config.php should be at the root of the archive. For more details see the FAQ article
227
  <a href="https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=invalid_ar_fmt#faq-installer-020-q" target="_help">The archive format is changing on my Mac what might be the problem?</a>
228
  </div>
229
  <?php endif; ?>
@@ -558,10 +558,10 @@ NOTICES
558
  <b>After Install:</b> When you are done with the installation you must remove these files/directories:
559
  <ul>
560
  <li>installer.php</li>
561
- <li>installer-data.sql</li>
562
  <li>installer-backup.php</li>
563
- <li>installer-log.txt</li>
564
- <li>database.sql</li>
565
  </ul>
566
 
567
  These files contain sensitive information and should not remain on a production system for system integrity and security protection.
@@ -622,7 +622,7 @@ Auto Posts to view.step2.php
622
  ========================================= -->
623
  <form id='s1-result-form' method="post" class="content-form" style="display:none">
624
 
625
- <div class="dupx-logfile-link"><a href="installer-log.txt" target="install_log">installer-log.txt</a></div>
626
  <div class="hdr-main">
627
  Step <span class="step">1</span> of 4: Deployment
628
  </div>
@@ -653,7 +653,7 @@ Auto Posts to view.step2.php
653
  <div id="ajaxerr-area" style="display:none">
654
  <p>Please try again an issue has occurred.</p>
655
  <div style="padding: 0px 10px 10px 0px;">
656
- <div id="ajaxerr-data">An unknown issue has occurred with the file and database set up process. Please see the installer-log.txt file for more details.</div>
657
  <div style="text-align:center; margin:10px auto 0px auto">
658
  <input type="button" class="default-btn" onclick="DUPX.hideErrorResult()" value="&laquo; Try Again" /><br/><br/>
659
  <i style='font-size:11px'>See online help for more details at <a href='https://snapcreek.com/ticket?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=inst_ajaxerr_ticket' target='_blank'>snapcreek.com</a></i>
@@ -713,7 +713,7 @@ Auto Posts to view.step2.php
713
  status += "<b>Status:</b> " + xhr.statusText + "<br/>";
714
  status += "<b>Response:</b> " + xhr.responseText + "";
715
  status += "<hr/><b>Additional Troubleshooting Tips:</b><br/>";
716
- status += "- Check the <a href='installer-log.txt' target='install_log'>installer-log.txt</a> file for warnings or errors.<br/>";
717
  status += "- Check the web server and PHP error logs. <br/>";
718
  status += "- For timeout issues visit the <a href='https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=inst_ajaxextract_tofaq#faq-trouble-100-q' target='_blank'>Timeout FAQ Section</a><br/>";
719
  $('#ajaxerr-data').html(status);
23
  //until further reports are discovered, removed on 04-06-2018
24
  //$badFiles = array('__MACOSX', $arcFilePath);
25
  $badFiles = array('', $arcFilePath);
26
+ $goodFiles = array("dup-database__{$GLOBALS['PACKAGE_HASH']}.sql", 'installer-backup.php');
27
  $goodFilesFound = true;
28
  $badFilesFound = false;
29
 
223
  the issue. Please check the contents of the zip archive and be sure its contents match the layout of your site.
224
  <br/><br/>
225
 
226
+ Files such as dup-database__<?php echo $GLOBALS['PACKAGE_HASH'];?>.sql and wp-config.php should be at the root of the archive. For more details see the FAQ article
227
  <a href="https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=invalid_ar_fmt#faq-installer-020-q" target="_help">The archive format is changing on my Mac what might be the problem?</a>
228
  </div>
229
  <?php endif; ?>
558
  <b>After Install:</b> When you are done with the installation you must remove these files/directories:
559
  <ul>
560
  <li>installer.php</li>
561
+ <li>dup-installer-data__<?php echo $GLOBALS['PACKAGE_HASH'];?>.sql</li>
562
  <li>installer-backup.php</li>
563
+ <li></li>
564
+ <li>dup-database__<?php echo $GLOBALS['PACKAGE_HASH'];?>.sql</li>
565
  </ul>
566
 
567
  These files contain sensitive information and should not remain on a production system for system integrity and security protection.
622
  ========================================= -->
623
  <form id='s1-result-form' method="post" class="content-form" style="display:none">
624
 
625
+ <div class="dupx-logfile-link"><a href="<?php echo $GLOBALS["LOG_FILE_NAME"];?>" target="install_log">installer-log.txt</a></div>
626
  <div class="hdr-main">
627
  Step <span class="step">1</span> of 4: Deployment
628
  </div>
653
  <div id="ajaxerr-area" style="display:none">
654
  <p>Please try again an issue has occurred.</p>
655
  <div style="padding: 0px 10px 10px 0px;">
656
+ <div id="ajaxerr-data">An unknown issue has occurred with the file and database set up process. Please see the <?php echo $GLOBALS["LOG_FILE_NAME"];?> file for more details.</div>
657
  <div style="text-align:center; margin:10px auto 0px auto">
658
  <input type="button" class="default-btn" onclick="DUPX.hideErrorResult()" value="&laquo; Try Again" /><br/><br/>
659
  <i style='font-size:11px'>See online help for more details at <a href='https://snapcreek.com/ticket?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=inst_ajaxerr_ticket' target='_blank'>snapcreek.com</a></i>
713
  status += "<b>Status:</b> " + xhr.statusText + "<br/>";
714
  status += "<b>Response:</b> " + xhr.responseText + "";
715
  status += "<hr/><b>Additional Troubleshooting Tips:</b><br/>";
716
+ status += "- Check the <a href='<?php echo $GLOBALS["LOG_FILE_NAME"];?>' target='install_log'><?php echo $GLOBALS["LOG_FILE_NAME"];?></a> file for warnings or errors.<br/>";
717
  status += "- Check the web server and PHP error logs. <br/>";
718
  status += "- For timeout issues visit the <a href='https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=inst_ajaxextract_tofaq#faq-trouble-100-q' target='_blank'>Timeout FAQ Section</a><br/>";
719
  $('#ajaxerr-data').html(status);
installer/build/view.step2.php CHANGED
@@ -13,7 +13,7 @@ VIEW: STEP 2- INPUT -->
13
  <input type="hidden" name="logging" id="logging" value="<?php echo $_POST['logging'] ?>" />
14
  <input type="hidden" name="secure-pass" value="<?php echo $_POST['secure-pass']; ?>" />
15
 
16
- <div class="dupx-logfile-link"><a href="installer-log.txt?now=<?php echo $GLOBALS['NOW_DATE'] ?>" target="install_log">installer-log.txt</a></div>
17
  <div class="hdr-main">
18
  Step <span class="step">2</span> of 4: Install Database
19
  </div>
@@ -183,7 +183,7 @@ Auto Posts to view.step3.php
183
  ========================================= -->
184
  <form id='s2-result-form' method="post" class="content-form" style="display:none">
185
 
186
- <div class="dupx-logfile-link"><a href="installer-log.txt" target="install_log">installer-log.txt</a></div>
187
  <div class="hdr-main">
188
  Step <span class="step">2</span> of 4: Install Database
189
  </div>
13
  <input type="hidden" name="logging" id="logging" value="<?php echo $_POST['logging'] ?>" />
14
  <input type="hidden" name="secure-pass" value="<?php echo $_POST['secure-pass']; ?>" />
15
 
16
+ <div class="dupx-logfile-link"><a href="<?php echo $GLOBALS["LOG_FILE_NAME"];?>?now=<?php echo $GLOBALS['NOW_DATE'] ?>" target="install_log">installer-log.txt</a></div>
17
  <div class="hdr-main">
18
  Step <span class="step">2</span> of 4: Install Database
19
  </div>
183
  ========================================= -->
184
  <form id='s2-result-form' method="post" class="content-form" style="display:none">
185
 
186
+ <div class="dupx-logfile-link"><a href="<?php echo $GLOBALS["LOG_FILE_NAME"];?>" target="install_log">installer-log.txt</a></div>
187
  <div class="hdr-main">
188
  Step <span class="step">2</span> of 4: Install Database
189
  </div>
installer/build/view.step3.php CHANGED
@@ -32,7 +32,7 @@ VIEW: STEP 3- INPUT -->
32
  <input type="hidden" name="exe_safe_mode" id="exe-safe-mode" value="<?php echo $_POST['exe_safe_mode'] ?>" />
33
  <input type="hidden" name="secure-pass" value="<?php echo $_POST['secure-pass']; ?>" />
34
 
35
- <div class="dupx-logfile-link"><a href="installer-log.txt?now=<?php echo $GLOBALS['NOW_DATE'] ?>" target="install_log">installer-log.txt</a></div>
36
  <div class="hdr-main">
37
  Step <span class="step">3</span> of 4: Update Data
38
  </div>
@@ -186,7 +186,7 @@ VIEW: STEP 3 - AJAX RESULT
186
  ========================================= -->
187
  <form id='s3-result-form' method="post" class="content-form" style="display:none">
188
 
189
- <div class="dupx-logfile-link"><a href="installer-log.txt" target="install_log">installer-log.txt</a></div>
190
  <div class="hdr-main">
191
  Step <span class="step">3</span> of 4: Update Data
192
  </div>
@@ -268,7 +268,7 @@ DUPX.runUpdate = function()
268
  status += "<b>Status:</b> " + xhr.statusText + "<br/>";
269
  status += "<b>Response:</b> " + xhr.responseText + "";
270
  status += "<hr/><b>Additional Troubleshooting Tips:</b><br/>";
271
- status += "- Check the <a href='installer-log.txt' target='install_log'>installer-log.txt</a> file for warnings or errors.<br/>";
272
  status += "- Check the web server and PHP error logs. <br/>";
273
  status += "- For timeout issues visit the <a href='https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=inst_step3_ajax_rundepl#faq-trouble-100-q' target='_blank'>Timeout FAQ Section</a><br/>";
274
  $('#ajaxerr-data').html(status);
32
  <input type="hidden" name="exe_safe_mode" id="exe-safe-mode" value="<?php echo $_POST['exe_safe_mode'] ?>" />
33
  <input type="hidden" name="secure-pass" value="<?php echo $_POST['secure-pass']; ?>" />
34
 
35
+ <div class="dupx-logfile-link"><a href="<?php echo $GLOBALS["LOG_FILE_NAME"];?>?now=<?php echo $GLOBALS['NOW_DATE'] ?>" target="install_log">installer-log.txt</a></div>
36
  <div class="hdr-main">
37
  Step <span class="step">3</span> of 4: Update Data
38
  </div>
186
  ========================================= -->
187
  <form id='s3-result-form' method="post" class="content-form" style="display:none">
188
 
189
+ <div class="dupx-logfile-link"><a href="<?php echo $GLOBALS["LOG_FILE_NAME"];?>" target="install_log">installer-log.txt</a></div>
190
  <div class="hdr-main">
191
  Step <span class="step">3</span> of 4: Update Data
192
  </div>
268
  status += "<b>Status:</b> " + xhr.statusText + "<br/>";
269
  status += "<b>Response:</b> " + xhr.responseText + "";
270
  status += "<hr/><b>Additional Troubleshooting Tips:</b><br/>";
271
+ status += "- Check the <a href='<?php echo $GLOBALS["LOG_FILE_NAME"];?>' target='install_log'>installer-log.txt</a> file for warnings or errors.<br/>";
272
  status += "- Check the web server and PHP error logs. <br/>";
273
  status += "- For timeout issues visit the <a href='https://snapcreek.com/duplicator/docs/faqs-tech/?utm_source=duplicator_free&utm_medium=wordpress_plugin&utm_campaign=problem_resolution&utm_content=inst_step3_ajax_rundepl#faq-trouble-100-q' target='_blank'>Timeout FAQ Section</a><br/>";
274
  $('#ajaxerr-data').html(status);
installer/build/view.step4.php CHANGED
@@ -26,7 +26,7 @@ DUPX.getAdminLogin = function() {
26
  VIEW: STEP 4 - INPUT -->
27
  <form id='s4-input-form' method="post" class="content-form" style="line-height:20px">
28
  <input type="hidden" name="url_new" id="url_new" value="<?php echo $url_new_rtrim; ?>" />
29
- <div class="dupx-logfile-link"><a href="installer-log.txt?now=<?php echo $GLOBALS['NOW_DATE'] ?>" target="install_log">installer-log.txt</a></div>
30
 
31
  <div class="hdr-main">
32
  Step <span class="step">4</span> of 4: Test Site
@@ -132,7 +132,7 @@ VIEW: STEP 4 - INPUT -->
132
  <div class="s4-err-title">STEP 2 - INSTALL NOTICES:</div>
133
  <b data-bind="with: status.step2">ERRORS (<span data-bind="text: query_errs"></span>)</b><br/>
134
  <div class="info-error">
135
- Queries that error during the deploy step are logged to the <a href="installer-log.txt" target="dpro-installer">install-log.txt</a> file and
136
  and marked with an **ERROR** status. If you experience a few errors (under 5), in many cases they can be ignored as long as your site is working correctly.
137
  However if you see a large amount of errors or you experience an issue with your site then the error messages in the log file will need to be investigated.
138
  <br/><br/>
26
  VIEW: STEP 4 - INPUT -->
27
  <form id='s4-input-form' method="post" class="content-form" style="line-height:20px">
28
  <input type="hidden" name="url_new" id="url_new" value="<?php echo $url_new_rtrim; ?>" />
29
+ <div class="dupx-logfile-link"><a href="<?php echo $GLOBALS["LOG_FILE_NAME"];?>?now=<?php echo $GLOBALS['NOW_DATE'] ?>" target="install_log">installer-log.txt</a></div>
30
 
31
  <div class="hdr-main">
32
  Step <span class="step">4</span> of 4: Test Site
132
  <div class="s4-err-title">STEP 2 - INSTALL NOTICES:</div>
133
  <b data-bind="with: status.step2">ERRORS (<span data-bind="text: query_errs"></span>)</b><br/>
134
  <div class="info-error">
135
+ Queries that error during the deploy step are logged to the <a href="<?php echo $GLOBALS["LOG_FILE_NAME"];?>" target="dpro-installer">install-log.txt</a> file and
136
  and marked with an **ERROR** status. If you experience a few errors (under 5), in many cases they can be ignored as long as your site is working correctly.
137
  However if you see a large amount of errors or you experience an issue with your site then the error messages in the log file will need to be investigated.
138
  <br/><br/>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: migration, backup, restore, move, migrate, duplicate, transfer, clone, aut
4
  Requires at least: 4.0
5
  Tested up to: 4.9
6
  Requires PHP: 5.2.17
7
- Stable tag: 1.2.44
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.
4
  Requires at least: 4.0
5
  Tested up to: 4.9
6
  Requires PHP: 5.2.17
7
+ Stable tag: 1.2.46
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/packages/main/s1.setup1.php CHANGED
@@ -1,274 +1,274 @@
1
- <?php
2
-
3
- global $wpdb;
4
-
5
- //POST BACK: Rest Button
6
- if (isset($_POST['action'])) {
7
- $action_result = DUP_Settings::DeleteWPOption($_POST['action']);
8
- switch ($_POST['action'])
9
- {
10
- case 'duplicator_package_active' :
11
- $action_result = DUP_Settings::DeleteWPOption($_POST['action']);
12
- $action_response = __('Package settings have been reset.', 'duplicator');
13
- break;
14
- }
15
- }
16
-
17
- DUP_Util::initSnapshotDirectory();
18
-
19
- $Package = DUP_Package::getActive();
20
- $dup_tests = array();
21
- $dup_tests = DUP_Server::getRequirements();
22
-
23
- //View State
24
- $ctrl_ui = new DUP_CTRL_UI();
25
- $ctrl_ui->setResponseType('PHP');
26
- $data = $ctrl_ui->GetViewStateList();
27
-
28
- $ui_css_storage = (isset($data->payload['dup-pack-storage-panel']) && $data->payload['dup-pack-storage-panel']) ? 'display:block' : 'display:none';
29
- $ui_css_archive = (isset($data->payload['dup-pack-archive-panel']) && $data->payload['dup-pack-archive-panel']) ? 'display:block' : 'display:none';
30
- $ui_css_installer = (isset($data->payload['dup-pack-installer-panel']) && $data->payload['dup-pack-installer-panel']) ? 'display:block' : 'display:none';
31
- $dup_intaller_files = implode(", ", array_keys(DUP_Server::getInstallerFiles()));
32
- $dbbuild_mode = (DUP_Settings::Get('package_mysqldump') && DUP_DB::getMySqlDumpPath()) ? 'mysqldump' : 'PHP';
33
-
34
- //="No Selection", 1="Try Again", 2="Two-Part Install"
35
- $retry_state = isset($_GET['retry']) ? $_GET['retry'] : 0;
36
- ?>
37
-
38
- <style>
39
- /* REQUIREMENTS*/
40
- div.dup-sys-section {margin:1px 0px 5px 0px}
41
- div.dup-sys-title {display:inline-block; width:250px; padding:1px; }
42
- div.dup-sys-title div {display:inline-block;float:right; }
43
- div.dup-sys-info {display:none; max-width: 98%; margin:4px 4px 12px 4px}
44
- div.dup-sys-pass {display:inline-block; color:green;}
45
- div.dup-sys-fail {display:inline-block; color:#AF0000;}
46
- div.dup-sys-contact {padding:5px 0px 0px 10px; font-size:11px; font-style:italic}
47
- span.dup-toggle {float:left; margin:0 2px 2px 0; }
48
- table.dup-sys-info-results td:first-child {width:200px}
49
- </style>
50
-
51
-
52
- <!-- ============================
53
- TOOL BAR: STEPS -->
54
- <table id="dup-toolbar">
55
- <tr valign="top">
56
- <td style="white-space: nowrap">
57
- <div id="dup-wiz">
58
- <div id="dup-wiz-steps">
59
- <div class="active-step"><a>1-<?php _e('Setup', 'duplicator'); ?></a></div>
60
- <div><a>2-<?php _e('Scan', 'duplicator'); ?> </a></div>
61
- <div><a>3-<?php _e('Build', 'duplicator'); ?> </a></div>
62
- </div>
63
- <div id="dup-wiz-title">
64
- <?php _e('Step 1: Package Setup', 'duplicator'); ?>
65
- </div>
66
- </div>
67
- </td>
68
- <td>
69
- <a href="?page=duplicator" class="add-new-h2"><i class="fa fa-archive"></i> <?php _e("Packages", 'duplicator'); ?></a>
70
- <span> <?php _e("Create New", 'duplicator'); ?></span>
71
- </td>
72
- </tr>
73
- </table>
74
- <hr class="dup-toolbar-line">
75
-
76
- <?php if (!empty($action_response)) : ?>
77
- <div id="message" class="notice notice-success is-dismissible"><p><?php echo $action_response; ?></p></div>
78
- <?php endif; ?>
79
-
80
- <!-- ============================
81
- SYSTEM REQUIREMENTS -->
82
- <?php if (! $dup_tests['Success'] || $dup_tests['Warning']) : ?>
83
- <div class="dup-box">
84
- <div class="dup-box-title">
85
- <?php
86
- _e("Requirements:", 'duplicator');
87
- echo ($dup_tests['Success']) ? ' <div class="dup-sys-pass">Pass</div>' : ' <div class="dup-sys-fail">Fail</div>';
88
- ?>
89
- <div class="dup-box-arrow"></div>
90
- </div>
91
-
92
- <div class="dup-box-panel">
93
-
94
- <div class="dup-sys-section">
95
- <i><?php _e("System requirements must pass for the Duplicator to work properly. Click each link for details.", 'duplicator'); ?></i>
96
- </div>
97
-
98
- <!-- PHP SUPPORT -->
99
- <div class='dup-sys-req'>
100
- <div class='dup-sys-title'>
101
- <a><?php _e('PHP Support', 'duplicator'); ?></a>
102
- <div><?php echo $dup_tests['PHP']['ALL']; ?></div>
103
- </div>
104
- <div class="dup-sys-info dup-info-box">
105
- <table class="dup-sys-info-results">
106
- <tr>
107
- <td><?php printf("%s [%s]", __("PHP Version", 'duplicator'), phpversion()); ?></td>
108
- <td><?php echo $dup_tests['PHP']['VERSION'] ?></td>
109
- </tr>
110
- <tr>
111
- <td><?php _e('Zip Archive Enabled', 'duplicator'); ?></td>
112
- <td><?php echo $dup_tests['PHP']['ZIP'] ?></td>
113
- </tr>
114
- <tr>
115
- <td><?php _e('Safe Mode Off', 'duplicator'); ?></td>
116
- <td><?php echo $dup_tests['PHP']['SAFE_MODE'] ?></td>
117
- </tr>
118
- <tr>
119
- <td><?php _e('Function', 'duplicator'); ?> <a href="http://php.net/manual/en/function.file-get-contents.php" target="_blank">file_get_contents</a></td>
120
- <td><?php echo $dup_tests['PHP']['FUNC_1'] ?></td>
121
- </tr>
122
- <tr>
123
- <td><?php _e('Function', 'duplicator'); ?> <a href="http://php.net/manual/en/function.file-put-contents.php" target="_blank">file_put_contents</a></td>
124
- <td><?php echo $dup_tests['PHP']['FUNC_2'] ?></td>
125
- </tr>
126
- <tr>
127
- <td><?php _e('Function', 'duplicator'); ?> <a href="http://php.net/manual/en/mbstring.installation.php" target="_blank">mb_strlen</a></td>
128
- <td><?php echo $dup_tests['PHP']['FUNC_3'] ?></td>
129
- </tr>
130
- </table>
131
- <small>
132
- <?php _e("PHP versions 5.2.9+ or higher is required. For compression to work the ZipArchive extension for PHP is required. Safe Mode should be set to 'Off' in you php.ini file and is deprecated as of PHP 5.3.0. For any issues in this section please contact your hosting provider or server administrator. For additional information see our online documentation.", 'duplicator'); ?>
133
- </small>
134
- </div>
135
- </div>
136
-
137
- <!-- PERMISSIONS -->
138
- <div class='dup-sys-req'>
139
- <div class='dup-sys-title'>
140
- <a><?php _e('Required Paths', 'duplicator'); ?></a>
141
- <div>
142
- <?php
143
- if ($dup_tests['IO']['ALL']) {
144
- echo ($dup_tests['IO']['WPROOT'] == 'Warn') ? 'Warn' : 'Pass';
145
- } else {
146
- echo 'Fail';
147
- }
148
- ?>
149
- </div>
150
- </div>
151
- <div class="dup-sys-info dup-info-box">
152
- <?php
153
- printf("<b>%s</b> &nbsp; [%s] <br/>", $dup_tests['IO']['SSDIR'], DUPLICATOR_SSDIR_PATH);
154
- printf("<b>%s</b> &nbsp; [%s] <br/>", $dup_tests['IO']['SSTMP'], DUPLICATOR_SSDIR_PATH_TMP);
155
- printf("<b>%s</b> &nbsp; [%s] <br/>", $dup_tests['IO']['WPROOT'], DUPLICATOR_WPROOTPATH);
156
- ?>
157
- <div style="font-size:11px; padding-top: 3px">
158
- <?php
159
- if ($dup_tests['IO']['WPROOT'] == 'Warn') {
160
- echo sprintf( __('If the root WordPress path is not writable by PHP on some systems this can cause issues.', 'duplicator'), DUPLICATOR_WPROOTPATH);
161
- echo '<br/>';
162
- }
163
- _e("If Duplicator does not have enough permissions then you will need to manually create the paths above. &nbsp; ", 'duplicator');
164
- ?>
165
- </div>
166
- </div>
167
- </div>
168
-
169
- <!-- SERVER SUPPORT -->
170
- <div class='dup-sys-req'>
171
- <div class='dup-sys-title'>
172
- <a><?php _e('Server Support', 'duplicator'); ?></a>
173
- <div><?php echo $dup_tests['SRV']['ALL']; ?></div>
174
- </div>
175
- <div class="dup-sys-info dup-info-box">
176
- <table class="dup-sys-info-results">
177
- <tr>
178
- <td><?php printf("%s [%s]", __("MySQL Version", 'duplicator'), DUP_DB::getVersion()); ?></td>
179
- <td><?php echo $dup_tests['SRV']['MYSQL_VER'] ?></td>
180
- </tr>
181
- <tr>
182
- <td><?php printf("%s", __("MySQLi Support", 'duplicator')); ?></td>
183
- <td><?php echo $dup_tests['SRV']['MYSQLi'] ?></td>
184
- </tr>
185
- </table>
186
- <small>
187
- <?php
188
- _e("MySQL version 5.0+ or better is required and the PHP MySQLi extension (note the trailing 'i') is also required. Contact your server administrator and request that mysqli extension and MySQL Server 5.0+ be installed.", 'duplicator');
189
- echo "&nbsp;<i><a href='http://php.net/manual/en/mysqli.installation.php' target='_blank'>[" . __('more info', 'duplicator') . "]</a></i>";
190
- ?>
191
- </small>
192
- </div>
193
- </div>
194
-
195
- <!-- RESERVED FILES -->
196
- <div class='dup-sys-req'>
197
- <div class='dup-sys-title'>
198
- <a><?php _e('Reserved Files', 'duplicator'); ?></a> <div><?php echo $dup_tests['RES']['INSTALL']; ?></div>
199
- </div>
200
- <div class="dup-sys-info dup-info-box">
201
- <?php if ($dup_tests['RES']['INSTALL'] == 'Pass') : ?>
202
- <?php
203
- _e("None of the reserved files where found from a previous install. This means you are clear to create a new package.", 'duplicator');
204
- echo " [{$dup_intaller_files}]";
205
- ?>
206
- <?php else:
207
- $duplicator_nonce = wp_create_nonce('duplicator_cleanup_page');
208
- ?>
209
- <form method="post" action="admin.php?page=duplicator-tools&tab=diagnostics&section=info&action=installer&_wpnonce=<?php echo $duplicator_nonce; ?>">
210
- <b><?php _e('WordPress Root Path:', 'duplicator'); ?></b> <?php echo DUPLICATOR_WPROOTPATH; ?><br/>
211
- <?php _e("A reserved file(s) was found in the WordPress root directory. Reserved file names include [{$dup_intaller_files}]. To archive your data correctly please remove any of these files from your WordPress root directory. Then try creating your package again.", 'duplicator'); ?>
212
- <br/><input type='submit' class='button button-small' value='<?php _e('Remove Files Now', 'duplicator') ?>' style='font-size:10px; margin-top:5px;' />
213
- </form>
214
- <?php endif; ?>
215
- </div>
216
- </div>
217
-
218
- <!-- ONLINE SUPPORT -->
219
- <div class="dup-sys-contact">
220
- <?php
221
- printf("%s <a href='admin.php?page=duplicator-help'>[%s]</a>", __("For additional help please see the ", 'duplicator'), __("help page", 'duplicator'));
222
- ?>
223
- </div>
224
-
225
- </div>
226
- </div><br/>
227
- <?php endif; ?>
228
-
229
-
230
- <!-- ============================
231
- FORM PACKAGE OPTIONS -->
232
- <div style="padding:5px 5px 2px 5px">
233
- <?php include('s1.setup2.php'); ?>
234
- </div>
235
-
236
- <!-- CACHE PROTECTION: If the back-button is used from the scanner page then we need to
237
- refresh page in-case any filters where set while on the scanner page -->
238
- <form id="cache_detection">
239
- <input type="hidden" id="cache_state" name="cache_state" value="" />
240
- </form>
241
-
242
- <script>
243
- jQuery(document).ready(function ($)
244
- {
245
- Duplicator.Pack.checkPageCache = function()
246
- {
247
- var $state = $('#cache_state');
248
- if( $state.val() == "" ) {
249
- $state.val("fresh-load");
250
- } else {
251
- $state.val("cached");
252
- <?php
253
- $redirect = admin_url('admin.php?page=duplicator&tab=new1');
254
- echo "window.location.href = '{$redirect}'";
255
- ?>
256
- }
257
- }
258
-
259
- //INIT
260
- Duplicator.Pack.checkPageCache();
261
-
262
- //Toogle for system requirment detial links
263
- $('.dup-sys-title a').each(function () {
264
- $(this).attr('href', 'javascript:void(0)');
265
- $(this).click({selector: '.dup-sys-info'}, Duplicator.Pack.ToggleSystemDetails);
266
- $(this).prepend("<span class='ui-icon ui-icon-triangle-1-e dup-toggle' />");
267
- });
268
-
269
- //Color code Pass/Fail/Warn items
270
- $('.dup-sys-title div').each(function () {
271
- $(this).addClass(($(this).text() == 'Pass') ? 'dup-sys-pass' : 'dup-sys-fail');
272
- });
273
- });
274
  </script>
1
+ <?php
2
+
3
+ global $wpdb;
4
+
5
+ //POST BACK: Rest Button
6
+ if (isset($_POST['action'])) {
7
+ $action_result = DUP_Settings::DeleteWPOption($_POST['action']);
8
+ switch ($_POST['action'])
9
+ {
10
+ case 'duplicator_package_active' :
11
+ $action_result = DUP_Settings::DeleteWPOption($_POST['action']);
12
+ $action_response = __('Package settings have been reset.', 'duplicator');
13
+ break;
14
+ }
15
+ }
16
+
17
+ DUP_Util::initSnapshotDirectory();
18
+
19
+ $Package = DUP_Package::getActive();
20
+ $dup_tests = array();
21
+ $dup_tests = DUP_Server::getRequirements();
22
+
23
+ //View State
24
+ $ctrl_ui = new DUP_CTRL_UI();
25
+ $ctrl_ui->setResponseType('PHP');
26
+ $data = $ctrl_ui->GetViewStateList();
27
+
28
+ $ui_css_storage = (isset($data->payload['dup-pack-storage-panel']) && $data->payload['dup-pack-storage-panel']) ? 'display:block' : 'display:none';
29
+ $ui_css_archive = (isset($data->payload['dup-pack-archive-panel']) && $data->payload['dup-pack-archive-panel']) ? 'display:block' : 'display:none';
30
+ $ui_css_installer = (isset($data->payload['dup-pack-installer-panel']) && $data->payload['dup-pack-installer-panel']) ? 'display:block' : 'display:none';
31
+ $dup_intaller_files = implode(", ", array_keys(DUP_Server::getInstallerFiles()));
32
+ $dbbuild_mode = (DUP_Settings::Get('package_mysqldump') && DUP_DB::getMySqlDumpPath()) ? 'mysqldump' : 'PHP';
33
+
34
+ //="No Selection", 1="Try Again", 2="Two-Part Install"
35
+ $retry_state = isset($_GET['retry']) ? $_GET['retry'] : 0;
36
+ ?>
37
+
38
+ <style>
39
+ /* REQUIREMENTS*/
40
+ div.dup-sys-section {margin:1px 0px 5px 0px}
41
+ div.dup-sys-title {display:inline-block; width:250px; padding:1px; }
42
+ div.dup-sys-title div {display:inline-block;float:right; }
43
+ div.dup-sys-info {display:none; max-width: 98%; margin:4px 4px 12px 4px}
44
+ div.dup-sys-pass {display:inline-block; color:green;}
45
+ div.dup-sys-fail {display:inline-block; color:#AF0000;}
46
+ div.dup-sys-contact {padding:5px 0px 0px 10px; font-size:11px; font-style:italic}
47
+ span.dup-toggle {float:left; margin:0 2px 2px 0; }
48
+ table.dup-sys-info-results td:first-child {width:200px}
49
+ </style>
50
+
51
+
52
+ <!-- ============================
53
+ TOOL BAR: STEPS -->
54
+ <table id="dup-toolbar">
55
+ <tr valign="top">
56
+ <td style="white-space: nowrap">
57
+ <div id="dup-wiz">
58
+ <div id="dup-wiz-steps">
59
+ <div class="active-step"><a>1-<?php _e('Setup', 'duplicator'); ?></a></div>
60
+ <div><a>2-<?php _e('Scan', 'duplicator'); ?> </a></div>
61
+ <div><a>3-<?php _e('Build', 'duplicator'); ?> </a></div>
62
+ </div>
63
+ <div id="dup-wiz-title">
64
+ <?php _e('Step 1: Package Setup', 'duplicator'); ?>
65
+ </div>
66
+ </div>
67
+ </td>
68
+ <td>
69
+ <a href="?page=duplicator" class="add-new-h2"><i class="fa fa-archive"></i> <?php _e("Packages", 'duplicator'); ?></a>
70
+ <span> <?php _e("Create New", 'duplicator'); ?></span>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ <hr class="dup-toolbar-line">
75
+
76
+ <?php if (!empty($action_response)) : ?>
77
+ <div id="message" class="notice notice-success is-dismissible"><p><?php echo $action_response; ?></p></div>
78
+ <?php endif; ?>
79
+
80
+ <!-- ============================
81
+ SYSTEM REQUIREMENTS -->
82
+ <?php if (! $dup_tests['Success'] || $dup_tests['Warning']) : ?>
83
+ <div class="dup-box">
84
+ <div class="dup-box-title">
85
+ <?php
86
+ _e("Requirements:", 'duplicator');
87
+ echo ($dup_tests['Success']) ? ' <div class="dup-sys-pass">Pass</div>' : ' <div class="dup-sys-fail">Fail</div>';
88
+ ?>
89
+ <div class="dup-box-arrow"></div>
90
+ </div>
91
+
92
+ <div class="dup-box-panel">
93
+
94
+ <div class="dup-sys-section">
95
+ <i><?php _e("System requirements must pass for the Duplicator to work properly. Click each link for details.", 'duplicator'); ?></i>
96
+ </div>
97
+
98
+ <!-- PHP SUPPORT -->
99
+ <div class='dup-sys-req'>
100
+ <div class='dup-sys-title'>
101
+ <a><?php _e('PHP Support', 'duplicator'); ?></a>
102
+ <div><?php echo $dup_tests['PHP']['ALL']; ?></div>
103
+ </div>
104
+ <div class="dup-sys-info dup-info-box">
105
+ <table class="dup-sys-info-results">
106
+ <tr>
107
+ <td><?php printf("%s [%s]", __("PHP Version", 'duplicator'), phpversion()); ?></td>
108
+ <td><?php echo $dup_tests['PHP']['VERSION'] ?></td>
109
+ </tr>
110
+ <tr>
111
+ <td><?php _e('Zip Archive Enabled', 'duplicator'); ?></td>
112
+ <td><?php echo $dup_tests['PHP']['ZIP'] ?></td>
113
+ </tr>
114
+ <tr>
115
+ <td><?php _e('Safe Mode Off', 'duplicator'); ?></td>
116
+ <td><?php echo $dup_tests['PHP']['SAFE_MODE'] ?></td>
117
+ </tr>
118
+ <tr>
119
+ <td><?php _e('Function', 'duplicator'); ?> <a href="http://php.net/manual/en/function.file-get-contents.php" target="_blank">file_get_contents</a></td>
120
+ <td><?php echo $dup_tests['PHP']['FUNC_1'] ?></td>
121
+ </tr>
122
+ <tr>
123
+ <td><?php _e('Function', 'duplicator'); ?> <a href="http://php.net/manual/en/function.file-put-contents.php" target="_blank">file_put_contents</a></td>
124
+ <td><?php echo $dup_tests['PHP']['FUNC_2'] ?></td>
125
+ </tr>
126
+ <tr>
127
+ <td><?php _e('Function', 'duplicator'); ?> <a href="http://php.net/manual/en/mbstring.installation.php" target="_blank">mb_strlen</a></td>
128
+ <td><?php echo $dup_tests['PHP']['FUNC_3'] ?></td>
129
+ </tr>
130
+ </table>
131
+ <small>
132
+ <?php _e("PHP versions 5.2.9+ or higher is required. For compression to work the ZipArchive extension for PHP is required. Safe Mode should be set to 'Off' in you php.ini file and is deprecated as of PHP 5.3.0. For any issues in this section please contact your hosting provider or server administrator. For additional information see our online documentation.", 'duplicator'); ?>
133
+ </small>
134
+ </div>
135
+ </div>
136
+
137
+ <!-- PERMISSIONS -->
138
+ <div class='dup-sys-req'>
139
+ <div class='dup-sys-title'>
140
+ <a><?php _e('Required Paths', 'duplicator'); ?></a>
141
+ <div>
142
+ <?php
143
+ if ($dup_tests['IO']['ALL']) {
144
+ echo ($dup_tests['IO']['WPROOT'] == 'Warn') ? 'Warn' : 'Pass';
145
+ } else {
146
+ echo 'Fail';
147
+ }
148
+ ?>
149
+ </div>
150
+ </div>
151
+ <div class="dup-sys-info dup-info-box">
152
+ <?php
153
+ printf("<b>%s</b> &nbsp; [%s] <br/>", $dup_tests['IO']['SSDIR'], DUPLICATOR_SSDIR_PATH);
154
+ printf("<b>%s</b> &nbsp; [%s] <br/>", $dup_tests['IO']['SSTMP'], DUPLICATOR_SSDIR_PATH_TMP);
155
+ printf("<b>%s</b> &nbsp; [%s] <br/>", $dup_tests['IO']['WPROOT'], DUPLICATOR_WPROOTPATH);
156
+ ?>
157
+ <div style="font-size:11px; padding-top: 3px">
158
+ <?php
159
+ if ($dup_tests['IO']['WPROOT'] == 'Warn') {
160
+ echo sprintf( __('If the root WordPress path is not writable by PHP on some systems this can cause issues.', 'duplicator'), DUPLICATOR_WPROOTPATH);
161
+ echo '<br/>';
162
+ }
163
+ _e("If Duplicator does not have enough permissions then you will need to manually create the paths above. &nbsp; ", 'duplicator');
164
+ ?>
165
+ </div>
166
+ </div>
167
+ </div>
168
+
169
+ <!-- SERVER SUPPORT -->
170
+ <div class='dup-sys-req'>
171
+ <div class='dup-sys-title'>
172
+ <a><?php _e('Server Support', 'duplicator'); ?></a>
173
+ <div><?php echo $dup_tests['SRV']['ALL']; ?></div>
174
+ </div>
175
+ <div class="dup-sys-info dup-info-box">
176
+ <table class="dup-sys-info-results">
177
+ <tr>
178
+ <td><?php printf("%s [%s]", __("MySQL Version", 'duplicator'), DUP_DB::getVersion()); ?></td>
179
+ <td><?php echo $dup_tests['SRV']['MYSQL_VER'] ?></td>
180
+ </tr>
181
+ <tr>
182
+ <td><?php printf("%s", __("MySQLi Support", 'duplicator')); ?></td>
183
+ <td><?php echo $dup_tests['SRV']['MYSQLi'] ?></td>
184
+ </tr>
185
+ </table>
186
+ <small>
187
+ <?php
188
+ _e("MySQL version 5.0+ or better is required and the PHP MySQLi extension (note the trailing 'i') is also required. Contact your server administrator and request that mysqli extension and MySQL Server 5.0+ be installed.", 'duplicator');
189
+ echo "&nbsp;<i><a href='http://php.net/manual/en/mysqli.installation.php' target='_blank'>[" . __('more info', 'duplicator') . "]</a></i>";
190
+ ?>
191
+ </small>
192
+ </div>
193
+ </div>
194
+
195
+ <!-- RESERVED FILES -->
196
+ <div class='dup-sys-req'>
197
+ <div class='dup-sys-title'>
198
+ <a><?php _e('Reserved Files', 'duplicator'); ?></a> <div><?php echo $dup_tests['RES']['INSTALL']; ?></div>
199
+ </div>
200
+ <div class="dup-sys-info dup-info-box">
201
+ <?php if ($dup_tests['RES']['INSTALL'] == 'Pass') : ?>
202
+ <?php
203
+ _e("None of the reserved files where found from a previous install. This means you are clear to create a new package.", 'duplicator');
204
+ echo " [{$dup_intaller_files}]";
205
+ ?>
206
+ <?php else:
207
+ $duplicator_nonce = wp_create_nonce('duplicator_cleanup_page');
208
+ ?>
209
+ <form method="post" action="admin.php?page=duplicator-tools&tab=diagnostics&section=info&action=installer&_wpnonce=<?php echo $duplicator_nonce; ?>">
210
+ <b><?php _e('WordPress Root Path:', 'duplicator'); ?></b> <?php echo DUPLICATOR_WPROOTPATH; ?><br/>
211
+ <?php _e("A reserved file(s) was found in the WordPress root directory. Reserved file names include [{$dup_intaller_files}]. To archive your data correctly please remove any of these files from your WordPress root directory. Then try creating your package again.", 'duplicator'); ?>
212
+ <br/><input type='submit' class='button button-small' value='<?php _e('Remove Files Now', 'duplicator') ?>' style='font-size:10px; margin-top:5px;' />
213
+ </form>
214
+ <?php endif; ?>
215
+ </div>
216
+ </div>
217
+
218
+ <!-- ONLINE SUPPORT -->
219
+ <div class="dup-sys-contact">
220
+ <?php
221
+ printf("%s <a href='admin.php?page=duplicator-help'>[%s]</a>", __("For additional help please see the ", 'duplicator'), __("help page", 'duplicator'));
222
+ ?>
223
+ </div>
224
+
225
+ </div>
226
+ </div><br/>
227
+ <?php endif; ?>
228
+
229
+
230
+ <!-- ============================
231
+ FORM PACKAGE OPTIONS -->
232
+ <div style="padding:5px 5px 2px 5px">
233
+ <?php include('s1.setup2.php'); ?>
234
+ </div>
235
+
236
+ <!-- CACHE PROTECTION: If the back-button is used from the scanner page then we need to
237
+ refresh page in-case any filters where set while on the scanner page -->
238
+ <form id="cache_detection">
239
+ <input type="hidden" id="cache_state" name="cache_state" value="" />
240
+ </form>
241
+
242
+ <script>
243
+ jQuery(document).ready(function ($)
244
+ {
245
+ Duplicator.Pack.checkPageCache = function()
246
+ {
247
+ var $state = $('#cache_state');
248
+ if( $state.val() == "" ) {
249
+ $state.val("fresh-load");
250
+ } else {
251
+ $state.val("cached");
252
+ <?php
253
+ $redirect = admin_url('admin.php?page=duplicator&tab=new1');
254
+ echo "window.location.href = '{$redirect}'";
255
+ ?>
256
+ }
257
+ }
258
+
259
+ //INIT
260
+ Duplicator.Pack.checkPageCache();
261
+
262
+ //Toogle for system requirment detial links
263
+ $('.dup-sys-title a').each(function () {
264
+ $(this).attr('href', 'javascript:void(0)');
265
+ $(this).click({selector: '.dup-sys-info'}, Duplicator.Pack.ToggleSystemDetails);
266
+ $(this).prepend("<span class='ui-icon ui-icon-triangle-1-e dup-toggle' />");
267
+ });
268
+
269
+ //Color code Pass/Fail/Warn items
270
+ $('.dup-sys-title div').each(function () {
271
+ $(this).addClass(($(this).text().trim() == 'Pass') ? 'dup-sys-pass' : 'dup-sys-fail');
272
+ });
273
+ });
274
  </script>
views/tools/controller.php CHANGED
@@ -13,6 +13,7 @@ $current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'diagnosti
13
 
14
  <style>
15
  div.lite-sub-tabs {padding: 10px 0 10px 0; font-size: 14px}
 
16
  </style>
17
  <?php
18
 
@@ -20,14 +21,11 @@ $installer_files = DUP_Server::getInstallerFiles();
20
  $package_name = (isset($_GET['package'])) ? esc_html($_GET['package']) : '';
21
  $package_path = (isset($_GET['package'])) ? DUPLICATOR_WPROOTPATH . esc_html($_GET['package']) : '';
22
 
23
- $txt_found = __('File Found', 'duplicator');
24
- $txt_removed = __('File Removed', 'duplicator');
25
- $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"
26
- . " risk if the file was not renamed. It is still recommended to remove the archive file after install,"
27
- . " especially if it was renamed.", 'duplicator');
28
 
29
- $nonce = wp_create_nonce('duplicator_cleanup_page');
30
- $section = (isset($_GET['section'])) ?$_GET['section']:'';
31
  if($current_tab == "diagnostics" && ($section == "info" || $section == '')){
32
  $ajax_nonce = wp_create_nonce('DUP_CTRL_Tools_deleteInstallerFiles');
33
  $_GET['action'] = isset($_GET['action']) ? $_GET['action'] : 'display';
@@ -60,16 +58,32 @@ if($current_tab == "diagnostics" && ($section == "info" || $section == '')){
60
  <div id="message" class="notice notice-success is-dismissible">
61
  <p><b><?php echo $action_response; ?></b></p>
62
  <?php if ( $_GET['action'] == 'installer') : ?>
63
- <?php
64
  $html = "";
65
 
66
  //REMOVE CORE INSTALLER FILES
67
  $installer_files = DUP_Server::getInstallerFiles();
 
68
  foreach ($installer_files as $file => $path) {
69
- @unlink($path);
70
- echo (file_exists($path))
71
- ? "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$path} </div>"
72
- : "<div class='success'> <i class='fa fa-check'></i> {$txt_removed} - {$path} </div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
 
75
  //No way to know exact name of archive file except from installer.
@@ -86,14 +100,18 @@ if($current_tab == "diagnostics" && ($section == "info" || $section == '')){
86
  }
87
 
88
  echo $html;
89
- ?><br/>
90
 
91
- <div style="font-style: italic; max-width:900px">
 
 
 
 
 
 
92
  <b><?php _e('Security Notes', 'duplicator')?>:</b>
93
- <?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, '
94
- . ' file system or FTP. Please remove all installer files listed above to avoid leaving open security issues on your server.', 'duplicator')?>
95
- <br/><br/>
96
- <?php echo $txt_archive_msg; ?>
97
  <br/><br/>
98
  </div>
99
 
@@ -128,8 +146,6 @@ if($current_tab == "diagnostics" && ($section == "info" || $section == '')){
128
  switch_theme($temp_theme['template'], $temp_theme['stylesheet']);
129
  switch_theme($active_theme->template, $active_theme->stylesheet);
130
  }
131
-
132
-
133
  break;
134
  }
135
 
13
 
14
  <style>
15
  div.lite-sub-tabs {padding: 10px 0 10px 0; font-size: 14px}
16
+ div.dup-no-files-msg {padding:10px 0 10px 0}
17
  </style>
18
  <?php
19
 
21
  $package_name = (isset($_GET['package'])) ? esc_html($_GET['package']) : '';
22
  $package_path = (isset($_GET['package'])) ? DUPLICATOR_WPROOTPATH . esc_html($_GET['package']) : '';
23
 
24
+ $txt_found = __('File Found: Unable to remove', 'duplicator');
25
+ $txt_removed = __('File Removed', 'duplicator');
26
+ $nonce = wp_create_nonce('duplicator_cleanup_page');
27
+ $section = (isset($_GET['section'])) ?$_GET['section']:'';
 
28
 
 
 
29
  if($current_tab == "diagnostics" && ($section == "info" || $section == '')){
30
  $ajax_nonce = wp_create_nonce('DUP_CTRL_Tools_deleteInstallerFiles');
31
  $_GET['action'] = isset($_GET['action']) ? $_GET['action'] : 'display';
58
  <div id="message" class="notice notice-success is-dismissible">
59
  <p><b><?php echo $action_response; ?></b></p>
60
  <?php if ( $_GET['action'] == 'installer') : ?>
61
+ <?php
62
  $html = "";
63
 
64
  //REMOVE CORE INSTALLER FILES
65
  $installer_files = DUP_Server::getInstallerFiles();
66
+ $installer_file_found = false;
67
  foreach ($installer_files as $file => $path) {
68
+ $file_path = '';
69
+ if (false !== stripos($file, '[hash]')) {
70
+ $glob_files = glob($path);
71
+ if (!empty($glob_files)) {
72
+ $file_path = $glob_files[0];
73
+ }
74
+ } elseif (file_exists($path)) {
75
+ $file_path = $path;
76
+ }
77
+
78
+ if (!empty($file_path)) {
79
+ @unlink($file_path);
80
+ if (file_exists($file_path)) {
81
+ $installer_file_found = true;
82
+ echo "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$file_path} </div>";
83
+ } else {
84
+ echo "<div class='success'> <i class='fa fa-check'></i> {$txt_removed} - {$file_path} </div>";
85
+ }
86
+ }
87
  }
88
 
89
  //No way to know exact name of archive file except from installer.
100
  }
101
 
102
  echo $html;
 
103
 
104
+ if (!$installer_file_found) {
105
+ echo '<div class="dup-no-files-msg success">'
106
+ . '<i class="fa fa-check"></i> <b>'.__('No Duplicator installer files found on this WordPress Site.', 'duplicator').'</b>'
107
+ . '</div>';
108
+ }
109
+ ?>
110
+ <div style="font-style: italic; max-width:1000px; padding-top:15px">
111
  <b><?php _e('Security Notes', 'duplicator')?>:</b>
112
+ <?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 '
113
+ . ' or FTP. Please remove all installer files to avoid any security issues on this site. For more details please visit '
114
+ . 'the FAQ link <a href="https://snapcreek.com/duplicator/docs/faqs-tech/#faq-installer-295-q" target="_blank">Which files need to be removed after an install?</a>', 'duplicator')?>
 
115
  <br/><br/>
116
  </div>
117
 
146
  switch_theme($temp_theme['template'], $temp_theme['stylesheet']);
147
  switch_theme($active_theme->template, $active_theme->stylesheet);
148
  }
 
 
149
  break;
150
  }
151
 
views/tools/diagnostics/inc.data.php CHANGED
@@ -2,9 +2,6 @@
2
 
3
  $sql = "SELECT * FROM `{$wpdb->prefix}options` WHERE `option_name` LIKE '%duplicator_%' AND `option_name` NOT LIKE '%duplicator_pro%' ORDER BY option_name";
4
 
5
- $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"
6
- . " risk if the file was not renamed. It is still recommended to remove the archive file after install,"
7
- . " especially if it was renamed.", 'duplicator');
8
  ?>
9
 
10
  <!-- ==============================
@@ -31,15 +28,13 @@ OPTIONS DATA -->
31
 
32
  <div id="dup-tools-delete-moreinfo">
33
  <?php
34
- _e("Clicking on the 'Remove Installation Files' button will remove the files used by Duplicator to install this site. "
35
- ."These files should not be left on production systems for security reasons.", 'duplicator');
 
 
 
 
36
  echo "<br/><br/>";
37
-
38
- foreach ($installer_files as $file => $path) {
39
- echo (file_exists($path)) ? "<div class='failed'><i class='fa fa-exclamation-triangle'></i> {$txt_found} - {$file}</div>" : "<div class='success'><i class='fa fa-check'></i> {$txt_removed} - {$file}</div>";
40
- }
41
- echo "<br/>";
42
- echo $txt_archive_msg;
43
  ?>
44
  </div>
45
  </td>
@@ -135,25 +130,9 @@ jQuery(document).ready(function($)
135
 
136
  Duplicator.Tools.deleteInstallerFiles = function()
137
  {
138
- var data = {
139
- action: 'DUP_CTRL_Tools_deleteInstallerFiles',
140
- nonce: '<?php echo $ajax_nonce; ?>',
141
- 'archive-name': '<?php echo $package_name; ?>'
142
- };
143
-
144
- jQuery.ajax({
145
- type: "POST",
146
- url: ajaxurl,
147
- dataType: "json",
148
- data: data,
149
- complete: function() {
150
- <?php
151
- $url = "?page=duplicator-tools&tab=diagnostics&action=installer&_wpnonce={$nonce}&package={$package_name}";
152
- echo "window.location = '{$url}';";
153
- ?>
154
- },
155
- error: function(data) {console.log(data)},
156
- done: function(data) {console.log(data)}
157
- });
158
  }
159
  </script>
2
 
3
  $sql = "SELECT * FROM `{$wpdb->prefix}options` WHERE `option_name` LIKE '%duplicator_%' AND `option_name` NOT LIKE '%duplicator_pro%' ORDER BY option_name";
4
 
 
 
 
5
  ?>
6
 
7
  <!-- ==============================
28
 
29
  <div id="dup-tools-delete-moreinfo">
30
  <?php
31
+ _e("Clicking on the 'Remove Installation Files' button will attempt to remove the installer files used by Duplicator. These files should not "
32
+ . "be left on production systems for security reasons. Below are the files that should be removed.", 'duplicator');
33
+ echo "<br/><br/>";
34
+ $installer_files = array_keys($installer_files);
35
+ array_push($installer_files, '[HASH]_archive.zip');
36
+ echo '<i>' . implode('<br/>', $installer_files) . '</i>';
37
  echo "<br/><br/>";
 
 
 
 
 
 
38
  ?>
39
  </div>
40
  </td>
130
 
131
  Duplicator.Tools.deleteInstallerFiles = function()
132
  {
133
+ <?php
134
+ $url = "?page=duplicator-tools&tab=diagnostics&action=installer&_wpnonce={$nonce}&package={$package_name}";
135
+ echo "window.location = '{$url}';";
136
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
  </script>