Duplicator – WordPress Migration Plugin - Version 1.4.7.1

Version Description

Download this release

Release Info

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

Code changes from version 1.4.7 to 1.4.7.1

classes/class.plugin.upgrade.php CHANGED
@@ -42,18 +42,27 @@ class DUP_LITE_Plugin_Upgrade
42
  DUP_Settings::Save();
43
  }
44
 
 
 
 
 
 
 
 
 
 
45
  //PRE 1.4.7
46
  //Remove the core dup-install file that might exist in local storage directory
47
- if (version_compare($oldVersion, '1.4.7', '<')) {
48
  $ssdir = DUP_Settings::getSsdirPath();
49
  $dupInstallFile = "{$ssdir}/dup-installer/main.installer.php";
50
  if (file_exists($dupInstallFile) ) {
51
  @unlink("{$dupInstallFile}");
52
  }
53
  }
54
-
55
- //WordPress Options Hooks
56
- update_option(self::DUP_VERSION_OPT_KEY, DUPLICATOR_VERSION);
57
  }
58
 
59
  protected static function updateDatabase()
42
  DUP_Settings::Save();
43
  }
44
 
45
+ //Run and secure updates
46
+ self::secureLocalStorageDirectory($oldVersion);
47
+
48
+ //WordPress Options Hooks
49
+ update_option(self::DUP_VERSION_OPT_KEY, DUPLICATOR_VERSION);
50
+ }
51
+
52
+ protected static function secureLocalStorageDirectory($oldVersion) {
53
+
54
  //PRE 1.4.7
55
  //Remove the core dup-install file that might exist in local storage directory
56
+ if (version_compare($oldVersion, '1.4.7', '<=')) {
57
  $ssdir = DUP_Settings::getSsdirPath();
58
  $dupInstallFile = "{$ssdir}/dup-installer/main.installer.php";
59
  if (file_exists($dupInstallFile) ) {
60
  @unlink("{$dupInstallFile}");
61
  }
62
  }
63
+
64
+ //Always apply the htaccess to backup dir
65
+ DUP_Util::setupBackupDirHtaccess();
66
  }
67
 
68
  protected static function updateDatabase()
classes/utilities/class.u.php CHANGED
@@ -605,19 +605,16 @@ class DUP_Util
605
  @fclose($ssfile);
606
  }
607
 
608
- //SSDIR: Create .htaccess
609
  $storage_htaccess_off = DUP_Settings::Get('storage_htaccess_off');
610
  $fileName = $path_ssdir.'/.htaccess';
611
  if ($storage_htaccess_off) {
612
  @unlink($fileName);
613
  } else if (!file_exists($fileName)) {
614
- $htfile = @fopen($fileName, 'w');
615
- $htoutput = "Options -Indexes";
616
- @fwrite($htfile, $htoutput);
617
- @fclose($htfile);
618
  }
619
 
620
- //SSDIR: Robots.txt file
621
  $fileName = $path_ssdir.'/robots.txt';
622
  if (!file_exists($fileName)) {
623
  $robotfile = @fopen($fileName, 'w');
@@ -631,6 +628,26 @@ class DUP_Util
631
  return true;
632
  }
633
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
634
  /**
635
  * Attempts to get the file zip path on a users system
636
  *
@@ -857,4 +874,22 @@ class DUP_Util
857
  {
858
  return function_exists($function_name) && !in_array($function_name, self::getIniDisableFuncs());
859
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
860
  }
605
  @fclose($ssfile);
606
  }
607
 
608
+ //SSDIR: Create .htaccess file
609
  $storage_htaccess_off = DUP_Settings::Get('storage_htaccess_off');
610
  $fileName = $path_ssdir.'/.htaccess';
611
  if ($storage_htaccess_off) {
612
  @unlink($fileName);
613
  } else if (!file_exists($fileName)) {
614
+ self::setupBackupDirHtaccess();
 
 
 
615
  }
616
 
617
+ //SSDIR: Create Robots.txt file
618
  $fileName = $path_ssdir.'/robots.txt';
619
  if (!file_exists($fileName)) {
620
  $robotfile = @fopen($fileName, 'w');
628
  return true;
629
  }
630
 
631
+ /**
632
+ * Attempts to create a secure .htaccess file in the download directory
633
+ *
634
+ * @return null
635
+ */
636
+ public static function setupBackupDirHtaccess()
637
+ {
638
+ try {
639
+ $backupDirPath = DUP_Settings::getSsdirPath();
640
+ $fileName = "{$backupDirPath}/.htaccess";
641
+ $htfile = @fopen($fileName, 'w');
642
+ $htoutput = "Options -Indexes \n";
643
+ $htoutput .= "<Files *.php>\n deny from all\n</Files>";
644
+ @fwrite($htfile, $htoutput);
645
+ @fclose($htfile);
646
+ } catch (Exception $ex) {
647
+ DUP_Log::Info("Duplicator Error: Unable to properly configure .htaccess for servers storage directory {$fileName}" . $ex);
648
+ }
649
+ }
650
+
651
  /**
652
  * Attempts to get the file zip path on a users system
653
  *
874
  {
875
  return function_exists($function_name) && !in_array($function_name, self::getIniDisableFuncs());
876
  }
877
+
878
+ /**
879
+ * Is the web server IIS
880
+ *
881
+ * @return bool Returns true if web server is IIS
882
+ */
883
+ public static function isIISRunning()
884
+ {
885
+ if (isset($_SERVER["SERVER_SOFTWARE"])) {
886
+ $sSoftware = strtolower($_SERVER["SERVER_SOFTWARE"]);
887
+ if ( strpos($sSoftware, "microsoft-iis") !== false ) {
888
+ return true;
889
+ } else {
890
+ return false;
891
+ }
892
+ }
893
+ return false;
894
+ }
895
  }
define.php CHANGED
@@ -5,8 +5,8 @@ defined('ABSPATH') || defined('DUPXABSPATH') || exit;
5
 
6
  if (function_exists('plugin_dir_url'))
7
  {
8
- define('DUPLICATOR_VERSION', '1.4.7');
9
- define('DUPLICATOR_VERSION_BUILD', '2022-06-27_12:00');
10
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
11
  define('DUPLICATOR_SITE_URL', get_site_url());
12
 
5
 
6
  if (function_exists('plugin_dir_url'))
7
  {
8
+ define('DUPLICATOR_VERSION', '1.4.7.1');
9
+ define('DUPLICATOR_VERSION_BUILD', '2022-08-02_15:00');
10
  define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
11
  define('DUPLICATOR_SITE_URL', get_site_url());
12
 
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.4.7
7
  Requires at least: 4.0
8
  Tested up to: 6.0
9
  Requires PHP: 5.3.8
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.4.7.1
7
  Requires at least: 4.0
8
  Tested up to: 6.0
9
  Requires PHP: 5.3.8
installer/dup-installer/main.installer.php CHANGED
@@ -28,6 +28,15 @@ if ( !defined('DUPXABSPATH') ) {
28
  define('DUPXABSPATH', dirname(__FILE__));
29
  }
30
 
 
 
 
 
 
 
 
 
 
31
  define('ERR_CONFIG_FOUND', 'A wp-config.php already exists in this location. This error prevents users from accidentally overwriting a WordPress site or trying to install on top of an existing one. Extracting an archive on an existing site will overwrite existing files and intermix files causing site incompatibility issues.<br/><br/> It is highly recommended to place the installer and archive in an empty directory. If you have already manually extracted the archive file that is associated with this installer then choose option #1 below; other-wise consider the other options: <ol><li>Click &gt; Try Again &gt; Options &gt; choose "Manual Archive Extraction".</li><li>Empty the directory except for the archive.zip/daf and installer.php and try again.</li><li>Advanced users only can remove the existing wp-config.php file and try again.</li></ol>');
32
 
33
  ob_start();
28
  define('DUPXABSPATH', dirname(__FILE__));
29
  }
30
 
31
+ $disabled_dirs = array(
32
+ 'backups-dup-lite',
33
+ 'wp-snapshots'
34
+ );
35
+
36
+ if (in_array(basename(dirname(dirname(__FILE__))), $disabled_dirs)) {
37
+ die;
38
+ }
39
+
40
  define('ERR_CONFIG_FOUND', 'A wp-config.php already exists in this location. This error prevents users from accidentally overwriting a WordPress site or trying to install on top of an existing one. Extracting an archive on an existing site will overwrite existing files and intermix files causing site incompatibility issues.<br/><br/> It is highly recommended to place the installer and archive in an empty directory. If you have already manually extracted the archive file that is associated with this installer then choose option #1 below; other-wise consider the other options: <ol><li>Click &gt; Try Again &gt; Options &gt; choose "Manual Archive Extraction".</li><li>Empty the directory except for the archive.zip/daf and installer.php and try again.</li><li>Advanced users only can remove the existing wp-config.php file and try again.</li></ol>');
41
 
42
  ob_start();
installer/installer.tpl CHANGED
@@ -16,6 +16,15 @@ if (!defined('DUPLICATOR_PHP_MAX_MEMORY')) { define('DUPLICATOR_PHP_MAX_MEMORY',
16
  date_default_timezone_set('UTC'); // Some machines don’t have this set so just do it here.
17
  @ignore_user_abort(true);
18
 
 
 
 
 
 
 
 
 
 
19
  if (!function_exists('wp_is_ini_value_changeable')) {
20
  /**
21
  * Determines whether a PHP ini value is changeable at runtime.
16
  date_default_timezone_set('UTC'); // Some machines don’t have this set so just do it here.
17
  @ignore_user_abort(true);
18
 
19
+ $disabled_dirs = array(
20
+ 'backups-dup-lite',
21
+ 'wp-snapshots'
22
+ );
23
+
24
+ if (in_array(basename(dirname(__FILE__)), $disabled_dirs)) {
25
+ die;
26
+ }
27
+
28
  if (!function_exists('wp_is_ini_value_changeable')) {
29
  /**
30
  * Determines whether a PHP ini value is changeable at runtime.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: migration, backup, duplicate, move, migrate, restore, transfer, clone, aut
4
  Requires at least: 4.0
5
  Tested up to: 6.0
6
  Requires PHP: 5.3.8
7
- Stable tag: 1.4.7
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: 6.0
6
  Requires PHP: 5.3.8
7
+ Stable tag: 1.4.7.1
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.
uninstall.php CHANGED
@@ -34,9 +34,10 @@ delete_option('duplicator_usage_id');
34
 
35
  //Remove entire storage directory
36
  if (DUP_Settings::Get('uninstall_files')) {
37
- $ssdir = DUP_Settings::getSsdirPath();
38
- $ssdir_tmp = DUP_Settings::getSsdirTmpPath();
39
- $ssdir_installer = DUP_Settings::getSsdirInstallerPath();
 
40
 
41
  //Sanity check for strange setup
42
  $check = glob("{$ssdir}/wp-config.php");
@@ -80,6 +81,10 @@ if (DUP_Settings::Get('uninstall_files')) {
80
  if (strstr($file, '.log1'))
81
  @unlink("{$file}");
82
  }
 
 
 
 
83
 
84
  //Check for core files and only continue removing data if the snapshots directory
85
  //has not been edited by 3rd party sources, this helps to keep the system stable
@@ -103,6 +108,14 @@ if (DUP_Settings::Get('uninstall_files')) {
103
 
104
  @rmdir($ssdir_installer);
105
  @rmdir($ssdir_tmp);
 
 
 
 
 
 
 
 
106
  @rmdir($ssdir);
107
  }
108
  }
34
 
35
  //Remove entire storage directory
36
  if (DUP_Settings::Get('uninstall_files')) {
37
+ $ssdir = DUP_Settings::getSsdirPath();
38
+ $ssdir_tmp = DUP_Settings::getSsdirTmpPath();
39
+ $ssdir_installer = DUP_Settings::getSsdirInstallerPath();
40
+ $ssdir_dupInstaller = "{$ssdir}/dup-installer/";
41
 
42
  //Sanity check for strange setup
43
  $check = glob("{$ssdir}/wp-config.php");
81
  if (strstr($file, '.log1'))
82
  @unlink("{$file}");
83
  }
84
+ foreach (glob("{$ssdir}/*.txt") as $file) {
85
+ if (strstr($file, '.txt'))
86
+ @unlink("{$file}");
87
+ }
88
 
89
  //Check for core files and only continue removing data if the snapshots directory
90
  //has not been edited by 3rd party sources, this helps to keep the system stable
108
 
109
  @rmdir($ssdir_installer);
110
  @rmdir($ssdir_tmp);
111
+
112
+ //Edge Case: dup-installer directory
113
+ if (file_exists($ssdir_dupInstaller)) {
114
+ error_log("Duplicator Removing: {$ssdir_dupInstaller}");
115
+ DupLiteSnapLibIOU::emptyDir($ssdir_dupInstaller);
116
+ @rmdir($ssdir_dupInstaller);
117
+ }
118
+
119
  @rmdir($ssdir);
120
  }
121
  }