WP Staging – DB & File Duplicator & Migration - Version 2.7.3

Version Description

  • New: Compatible up to WordPress 5.4.1
  • New: Allow filtering of staging site title
  • Fix: Since WordPress WP 5.4 cloning fails if WordPress is installed in subfolder
  • Fix: Loading icon not shown when disk space is checked
  • Fix: Can not copy tables if prefix is capitalized & has no underscore
Download this release

Release Info

Developer ReneHermi
Plugin Icon 128x128 WP Staging – DB & File Duplicator & Migration
Version 2.7.3
Comparing to
See all releases

Code changes from version 2.7.2 to 2.7.3

Backend/Modules/Jobs/Cloning.php CHANGED
@@ -150,7 +150,7 @@ class Cloning extends Job
150
  }
151
  $this->options->databasePrefix = '';
152
  if (isset($_POST["databasePrefix"]) && !empty($_POST["databasePrefix"])) {
153
- $this->options->databasePrefix = strtolower($this->sanitizePrefix($_POST["databasePrefix"]));
154
  }
155
  $this->options->cloneDir = '';
156
  if (isset($_POST["cloneDir"]) && !empty($_POST["cloneDir"])) {
@@ -263,7 +263,6 @@ class Cloning extends Job
263
  if (empty($this->options->cloneDir)) {
264
  $this->options->cloneDir = trailingslashit(\WPStaging\WPStaging::getWPpath() . $this->options->cloneDirectoryName);
265
  return $this->options->cloneDir;
266
- //return trailingslashit( \WPStaging\WPStaging::getWPpath() . $this->options->cloneDirectoryName );
267
  }
268
  return trailingslashit($this->options->cloneDir);
269
  }
@@ -301,7 +300,7 @@ class Cloning extends Job
301
 
302
  // Prefix does not exist. We can use it
303
  if (!$tables) {
304
- return strtolower($this->options->prefix);
305
  }
306
  }
307
  $this->returnException("Fatal Error: Can not create staging prefix. '{$this->options->prefix}' already exists! Stopping for security reasons. Contact support@wp-staging.com");
@@ -343,7 +342,6 @@ class Cloning extends Job
343
  }
344
 
345
  // Call the job
346
- //$this->log("execute job: Job's method {$methodName}");
347
  return $this->{$methodName}();
348
  }
349
 
@@ -375,7 +373,6 @@ class Cloning extends Job
375
  */
376
  public function jobDatabase()
377
  {
378
-
379
  // Could be written more elegant
380
  // but for xdebug purposes and breakpoints its cleaner to have separate if blocks
381
  if (defined('WPSTGPRO_VERSION') && is_multisite()) {
@@ -386,7 +383,6 @@ class Cloning extends Job
386
  $database = new muDatabaseExternal();
387
  }
388
  } else {
389
-
390
  // No Multisite
391
  if (empty($this->options->databaseUser) && empty($this->options->databasePassword)) {
392
  $database = new Database();
150
  }
151
  $this->options->databasePrefix = '';
152
  if (isset($_POST["databasePrefix"]) && !empty($_POST["databasePrefix"])) {
153
+ $this->options->databasePrefix = $this->sanitizePrefix($_POST["databasePrefix"]);
154
  }
155
  $this->options->cloneDir = '';
156
  if (isset($_POST["cloneDir"]) && !empty($_POST["cloneDir"])) {
263
  if (empty($this->options->cloneDir)) {
264
  $this->options->cloneDir = trailingslashit(\WPStaging\WPStaging::getWPpath() . $this->options->cloneDirectoryName);
265
  return $this->options->cloneDir;
 
266
  }
267
  return trailingslashit($this->options->cloneDir);
268
  }
300
 
301
  // Prefix does not exist. We can use it
302
  if (!$tables) {
303
+ return $this->options->prefix;
304
  }
305
  }
306
  $this->returnException("Fatal Error: Can not create staging prefix. '{$this->options->prefix}' already exists! Stopping for security reasons. Contact support@wp-staging.com");
342
  }
343
 
344
  // Call the job
 
345
  return $this->{$methodName}();
346
  }
347
 
373
  */
374
  public function jobDatabase()
375
  {
 
376
  // Could be written more elegant
377
  // but for xdebug purposes and breakpoints its cleaner to have separate if blocks
378
  if (defined('WPSTGPRO_VERSION') && is_multisite()) {
383
  $database = new muDatabaseExternal();
384
  }
385
  } else {
 
386
  // No Multisite
387
  if (empty($this->options->databaseUser) && empty($this->options->databasePassword)) {
388
  $database = new Database();
Backend/Modules/Jobs/DataExternal.php CHANGED
@@ -11,7 +11,6 @@ use WPStaging\Utils\Logger;
11
  use WPStaging\WPStaging;
12
  use WPStaging\Utils\Helper;
13
  use WPStaging\Utils\Strings;
14
- use WPStaging\Backend\Modules\Jobs\JobExecutable;
15
 
16
  /**
17
  * Class Data
@@ -534,52 +533,57 @@ define( 'DB_COLLATE', '" . DB_COLLATE . "' );\r\n";
534
  }
535
 
536
  /**
537
- * Reset index.php to original file
538
  * This is needed if live site is located in subfolder
539
  * Check first if main wordpress is used in subfolder and index.php in parent directory
540
  * @see: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
541
  * @return bool
542
  */
543
- protected function step6() {
 
544
 
545
- if( !$this->isSubDir() ) {
546
- $this->debugLog( "Preparing Data Step6: WP installation is not in a subdirectory! All good, skipping this step" );
 
 
547
  return true;
548
  }
549
 
 
 
550
  $path = $this->options->destinationDir . "index.php";
551
 
552
- if( false === ($content = file_get_contents( $path )) ) {
553
- $this->log( "Preparing Data Step6: Failed to reset {$path} for sub directory; can't read contents", Logger::TYPE_ERROR );
554
  return false;
555
  }
556
 
 
 
 
 
 
 
 
 
557
 
558
- if( !preg_match( "/(require(.*)wp-blog-header.php' \);)/", $content, $matches ) ) {
 
 
 
 
559
  $this->log(
560
- "Preparing Data Step6: Failed to reset index.php for sub directory; wp-blog-header.php is missing", Logger::TYPE_ERROR
561
  );
562
  return false;
563
  }
564
- $this->log( "Preparing Data: WP installation is in a subdirectory. Progressing..." );
565
 
566
- $pattern = "/require(.*) dirname(.*) __FILE__ (.*) \. '(.*)wp-blog-header.php'(.*);.*/";
567
-
568
- $replace = "require( dirname( __FILE__ ) . '/wp-blog-header.php' ); // " . $matches[0];
569
- //$replace.= " // Changed by WP-Staging";
570
-
571
-
572
-
573
- if( null === ($content = preg_replace( array($pattern), $replace, $content )) ) {
574
- $this->log( "Preparing Data: Failed to reset index.php for sub directory; replacement failed", Logger::TYPE_ERROR );
575
  return false;
576
  }
577
 
578
- if( false === @wpstg_put_contents( $path, $content ) ) {
579
- $this->log( "Preparing Data: Failed to reset index.php for sub directory; can't save contents", Logger::TYPE_ERROR );
580
- return false;
581
- }
582
- $this->Log( "Preparing Data Step6: Finished successfully" );
583
  return true;
584
  }
585
 
11
  use WPStaging\WPStaging;
12
  use WPStaging\Utils\Helper;
13
  use WPStaging\Utils\Strings;
 
14
 
15
  /**
16
  * Class Data
533
  }
534
 
535
  /**
536
+ * Reset index.php to WordPress default
537
  * This is needed if live site is located in subfolder
538
  * Check first if main wordpress is used in subfolder and index.php in parent directory
539
  * @see: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
540
  * @return bool
541
  */
542
+ protected function step6()
543
+ {
544
 
545
+ $step = "Preparing Data Step6: ";
546
+
547
+ if (!$this->isSubDir()) {
548
+ $this->debugLog($step . ": WP installation is not in a subdirectory! All good, skipping this step");
549
  return true;
550
  }
551
 
552
+ $this->log($step . "WP installation is in a subdirectory");
553
+
554
  $path = $this->options->destinationDir . "index.php";
555
 
556
+ if (false === ($content = file_get_contents($path))) {
557
+ $this->log($step . ": Failed to reset {$path}. Error: Can't read contents", Logger::TYPE_ERROR);
558
  return false;
559
  }
560
 
561
+ /*
562
+ * Before WordPress 5.4: require( dirname( __FILE__ ) . '/wp-blog-header.php' );
563
+ * Since WordPress 5.4: require __DIR__ . '/wp-blog-header.php';
564
+ */
565
+ $pattern = "/require(.*)wp-blog-header.php(.*)/";
566
+
567
+ if (preg_match($pattern, $content, $matches)) {
568
+ $replace = "require __DIR__ . '/wp-blog-header.php'; // " . $matches[0] . " Changed by WP-Staging";
569
 
570
+ if (null === ($content = preg_replace(array($pattern), $replace, $content))) {
571
+ $this->log($step . "Failed to reset index.php for sub directory; replacement failed", Logger::TYPE_ERROR);
572
+ return false;
573
+ }
574
+ } else {
575
  $this->log(
576
+ $step . "Failed to reset index.php for sub directory. Can not find code 'require(.*)wp-blog-header.php' or require __DIR__ . '/wp-blog-header.php'; in index.php", Logger::TYPE_ERROR
577
  );
578
  return false;
579
  }
 
580
 
581
+ if (false === @wpstg_put_contents($path, $content)) {
582
+ $this->log($step . "Failed to reset index.php for sub directory; can't save contents", Logger::TYPE_ERROR);
 
 
 
 
 
 
 
583
  return false;
584
  }
585
 
586
+ $this->Log($step . "Finished successfully");
 
 
 
 
587
  return true;
588
  }
589
 
Backend/public/css/wpstg-admin.css CHANGED
@@ -270,7 +270,7 @@
270
  .wpstg-clone-title {
271
  display: inline-block;
272
  font-size: 15px;
273
- max-width: 130px;
274
  text-decoration: none;
275
  font-weight: bold;
276
  color:white;
270
  .wpstg-clone-title {
271
  display: inline-block;
272
  font-size: 15px;
273
+ max-width: 300px;
274
  text-decoration: none;
275
  font-weight: bold;
276
  color:white;
Backend/views/clone/ajax/scan.php CHANGED
@@ -112,8 +112,9 @@
112
  </div>
113
  </div>
114
 
115
- <strong>Important:</strong><a href="#" id="wpstg-check-space"><?php _e( 'Check required disk space', 'wp-staging' ); ?></a>
116
- <p></p>
 
117
 
118
  <button type="button" class="wpstg-prev-step-link wpstg-link-btn wpstg-blue-primary wpstg-button">
119
  <?php _e( "Back", "wp-staging" ) ?>
112
  </div>
113
  </div>
114
 
115
+ <div style="line-height: 40px;">
116
+ <strong>Important:</strong><a href="#" id="wpstg-check-space"><?php _e( 'Check required disk space', 'wp-staging' ); ?></a><span class="wpstg-loader" style="margin-left:6px;vertical-align:middle;"></span>
117
+ </div>
118
 
119
  <button type="button" class="wpstg-prev-step-link wpstg-link-btn wpstg-blue-primary wpstg-button">
120
  <?php _e( "Back", "wp-staging" ) ?>
Frontend/Frontend.php CHANGED
@@ -48,11 +48,12 @@ class Frontend extends InjectionAware
48
  public function changeSiteName()
49
  {
50
  global $wp_admin_bar;
 
51
  if ($this->isStagingSite()) {
52
  // Main Title
53
  $wp_admin_bar->add_menu(array(
54
  'id' => 'site-name',
55
- 'title' => is_admin() ? ('STAGING - ' . get_bloginfo('name')) : ('STAGING - ' . get_bloginfo('name') . ' Dashboard'),
56
  'href' => is_admin() ? home_url('/') : admin_url(),
57
  ));
58
  }
48
  public function changeSiteName()
49
  {
50
  global $wp_admin_bar;
51
+ $siteTitle = apply_filters('wpstg_staging_site_title', 'STAGING');
52
  if ($this->isStagingSite()) {
53
  // Main Title
54
  $wp_admin_bar->add_menu(array(
55
  'id' => 'site-name',
56
+ 'title' => is_admin() ? ($siteTitle . ' - ' . get_bloginfo('name')) : ($siteTitle .' - ' . get_bloginfo('name') . ' Dashboard'),
57
  'href' => is_admin() ? home_url('/') : admin_url(),
58
  ));
59
  }
readme.txt CHANGED
@@ -9,8 +9,8 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Tags: staging, duplication, cloning, clone, migration, sandbox, test site, testing, backup, post, admin, administration, duplicate posts
10
  Requires at least: 3.6+
11
  Tested up to: 5.4
12
- Stable tag: 2.7.2
13
- Requires PHP: 5.3
14
 
15
  A duplicator plugin - clone/move, duplicate & migrate live websites to independent staging and development sites that are accessible​ by authorized users only.
16
 
@@ -153,6 +153,13 @@ https://wp-staging.com
153
 
154
  == Changelog ==
155
 
 
 
 
 
 
 
 
156
  = 2.7.2 =
157
  * New: Compatible up to WordPress 5.4
158
  * Fix: Fatal error on WordPress 4.6 and older
9
  Tags: staging, duplication, cloning, clone, migration, sandbox, test site, testing, backup, post, admin, administration, duplicate posts
10
  Requires at least: 3.6+
11
  Tested up to: 5.4
12
+ Stable tag: 2.7.3
13
+ Requires PHP: 5.5
14
 
15
  A duplicator plugin - clone/move, duplicate & migrate live websites to independent staging and development sites that are accessible​ by authorized users only.
16
 
153
 
154
  == Changelog ==
155
 
156
+ = 2.7.3 =
157
+ * New: Compatible up to WordPress 5.4.1
158
+ * New: Allow filtering of staging site title
159
+ * Fix: Since WordPress WP 5.4 cloning fails if WordPress is installed in subfolder
160
+ * Fix: Loading icon not shown when disk space is checked
161
+ * Fix: Can not copy tables if prefix is capitalized & has no underscore
162
+
163
  = 2.7.2 =
164
  * New: Compatible up to WordPress 5.4
165
  * Fix: Fatal error on WordPress 4.6 and older
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitee22bbb45ac7485b1bb51f603f013aa2::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitd3ab211c510172b0edc8b09988ac2855::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitee22bbb45ac7485b1bb51f603f013aa2
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitee22bbb45ac7485b1bb51f603f013aa2
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitee22bbb45ac7485b1bb51f603f013aa2', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitee22bbb45ac7485b1bb51f603f013aa2', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitee22bbb45ac7485b1bb51f603f013aa2::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitd3ab211c510172b0edc8b09988ac2855
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitd3ab211c510172b0edc8b09988ac2855', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitd3ab211c510172b0edc8b09988ac2855', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitd3ab211c510172b0edc8b09988ac2855::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitee22bbb45ac7485b1bb51f603f013aa2
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'W' =>
@@ -36,8 +36,8 @@ class ComposerStaticInitee22bbb45ac7485b1bb51f603f013aa2
36
  public static function getInitializer(ClassLoader $loader)
37
  {
38
  return \Closure::bind(function () use ($loader) {
39
- $loader->prefixLengthsPsr4 = ComposerStaticInitee22bbb45ac7485b1bb51f603f013aa2::$prefixLengthsPsr4;
40
- $loader->prefixDirsPsr4 = ComposerStaticInitee22bbb45ac7485b1bb51f603f013aa2::$prefixDirsPsr4;
41
 
42
  }, null, ClassLoader::class);
43
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitd3ab211c510172b0edc8b09988ac2855
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'W' =>
36
  public static function getInitializer(ClassLoader $loader)
37
  {
38
  return \Closure::bind(function () use ($loader) {
39
+ $loader->prefixLengthsPsr4 = ComposerStaticInitd3ab211c510172b0edc8b09988ac2855::$prefixLengthsPsr4;
40
+ $loader->prefixDirsPsr4 = ComposerStaticInitd3ab211c510172b0edc8b09988ac2855::$prefixDirsPsr4;
41
 
42
  }, null, ClassLoader::class);
43
  }
wp-staging.php CHANGED
@@ -7,7 +7,7 @@
7
  * Author: WP-Staging
8
  * Author URI: https://wp-staging.com
9
  * Contributors: ReneHermi, ilgityildirim
10
- * Version: 2.7.2
11
  * Text Domain: wp-staging
12
  * Domain Path: /languages/
13
  *
@@ -39,12 +39,12 @@ if (!defined('WPSTG_PLUGIN_SLUG')) {
39
 
40
  // Plugin Version
41
  if (!defined('WPSTG_VERSION')) {
42
- define('WPSTG_VERSION', '2.7.2');
43
  }
44
 
45
  // Compatible up to WordPress Version
46
  if (!defined('WPSTG_COMPATIBLE')) {
47
- define('WPSTG_COMPATIBLE', '5.4.0');
48
  }
49
 
50
  // Absolute path to plugin
7
  * Author: WP-Staging
8
  * Author URI: https://wp-staging.com
9
  * Contributors: ReneHermi, ilgityildirim
10
+ * Version: 2.7.3
11
  * Text Domain: wp-staging
12
  * Domain Path: /languages/
13
  *
39
 
40
  // Plugin Version
41
  if (!defined('WPSTG_VERSION')) {
42
+ define('WPSTG_VERSION', '2.7.3');
43
  }
44
 
45
  // Compatible up to WordPress Version
46
  if (!defined('WPSTG_COMPATIBLE')) {
47
+ define('WPSTG_COMPATIBLE', '5.4.1');
48
  }
49
 
50
  // Absolute path to plugin