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

Version Description

  • Tweak: Return more human readable error notices
  • Fix: Cloning process stops due to file permission issue
  • Fix: Exclude WP Super Cache from copying process because of bug in WP Super Cache, see https://github.com/Automattic/wp-super-cache/issues/505
Download this release

Release Info

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

Code changes from version 2.1.6 to 2.1.7

apps/Backend/Modules/Jobs/Cloning.php CHANGED
@@ -33,8 +33,6 @@ class Cloning extends Job
33
  $this->options->clone = $_POST["cloneID"];
34
  $this->options->cloneDirectoryName = preg_replace("#\W+#", '-', strtolower($this->options->clone));
35
  $this->options->cloneNumber = 1;
36
- //$this->options->prefix = "wpstg1_";
37
- //$this->options->prefix = '2323';
38
  $this->options->prefix = $this->getStagingPrefix();
39
 
40
  //$this->options->prefix = $this->getStagingPrefix();
@@ -80,7 +78,8 @@ class Cloning extends Job
80
  // Do not copy these folders and plugins
81
  $excludedDirectories = array(
82
  ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'cache',
83
- ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wps-hide-login'
 
84
  );
85
 
86
  $this->options->excludedDirectories = array_merge($excludedDirectories, $this->options->excludedDirectories);
33
  $this->options->clone = $_POST["cloneID"];
34
  $this->options->cloneDirectoryName = preg_replace("#\W+#", '-', strtolower($this->options->clone));
35
  $this->options->cloneNumber = 1;
 
 
36
  $this->options->prefix = $this->getStagingPrefix();
37
 
38
  //$this->options->prefix = $this->getStagingPrefix();
78
  // Do not copy these folders and plugins
79
  $excludedDirectories = array(
80
  ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'cache',
81
+ ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wps-hide-login',
82
+ ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wp-super-cache',
83
  );
84
 
85
  $this->options->excludedDirectories = array_merge($excludedDirectories, $this->options->excludedDirectories);
apps/Backend/Modules/Jobs/Directories.php CHANGED
@@ -7,7 +7,7 @@ if (!defined("WPINC")) {
7
  die;
8
  }
9
 
10
- use WPStaging\WPStaging;
11
  use WPStaging\Utils\Logger;
12
  use WPStaging\Iterators\RecursiveDirectoryIterator;
13
  use WPStaging\Iterators\RecursiveFilterNewLine;
@@ -75,22 +75,23 @@ class Directories extends JobExecutable {
75
 
76
  try {
77
 
78
- // Iterate over content directory
79
  $iterator = new \DirectoryIterator(ABSPATH);
80
 
81
  // Write path line
82
  foreach ($iterator as $item) {
83
- if ($item->isFile()) {
84
  if ($this->write($files, $iterator->getFilename() . PHP_EOL)) {
85
  $this->options->totalFiles++;
86
 
87
  // Add current file size
88
  $this->options->totalFileSize += $iterator->getSize();
89
- }
90
  }
91
  }
92
  } catch (\Exception $e) {
93
- throw new \Exception('Out of disk space.');
 
94
  } catch (\Exception $e) {
95
  // Skip bad file permissions
96
  }
@@ -146,7 +147,8 @@ class Directories extends JobExecutable {
146
  }
147
  }
148
  } catch (\Exception $e) {
149
- throw new \Exception('Out of disk space.');
 
150
  } catch (\Exception $e) {
151
  // Skip bad file permissions
152
  }
@@ -191,7 +193,8 @@ class Directories extends JobExecutable {
191
  }
192
  }
193
  } catch (\Exception $e) {
194
- throw new \Exception('Out of disk space.');
 
195
  } catch (\Exception $e) {
196
  // Skip bad file permissions
197
  }
@@ -235,7 +238,8 @@ class Directories extends JobExecutable {
235
  }
236
  }
237
  } catch (\Exception $e) {
238
- throw new \Exception('Out of disk space.');
 
239
  } catch (\Exception $e) {
240
  // Skip bad file permissions
241
  }
@@ -267,7 +271,8 @@ class Directories extends JobExecutable {
267
 
268
  $file_handle = @fopen($file, $mode);
269
  if (false === $file_handle) {
270
- throw new Exception(sprintf(__('Unable to open %s with mode %s', 'wpstg'), $file, $mode));
 
271
  }
272
 
273
  return $file_handle;
@@ -286,9 +291,11 @@ class Directories extends JobExecutable {
286
  $write_result = @fwrite($handle, $content);
287
  if (false === $write_result) {
288
  if (( $meta = \stream_get_meta_data($handle))) {
 
289
  throw new \Exception(sprintf(__('Unable to write to: %s', 'wpstg'), $meta['uri']));
290
  }
291
  } elseif (strlen($content) !== $write_result) {
 
292
  throw new \Exception(__('Out of disk space.', 'wpstg'));
293
  }
294
 
7
  die;
8
  }
9
 
10
+ use WPStaging\WPStaging;
11
  use WPStaging\Utils\Logger;
12
  use WPStaging\Iterators\RecursiveDirectoryIterator;
13
  use WPStaging\Iterators\RecursiveFilterNewLine;
75
 
76
  try {
77
 
78
+ // Iterate over wp root directory
79
  $iterator = new \DirectoryIterator(ABSPATH);
80
 
81
  // Write path line
82
  foreach ($iterator as $item) {
83
+ if (!$item->isDot() && $item->isFile()) {
84
  if ($this->write($files, $iterator->getFilename() . PHP_EOL)) {
85
  $this->options->totalFiles++;
86
 
87
  // Add current file size
88
  $this->options->totalFileSize += $iterator->getSize();
89
+ }
90
  }
91
  }
92
  } catch (\Exception $e) {
93
+ $this->returnException('Error: ' . $e->getMessage());
94
+ //throw new \Exception('Out of disk space.');
95
  } catch (\Exception $e) {
96
  // Skip bad file permissions
97
  }
147
  }
148
  }
149
  } catch (\Exception $e) {
150
+ //$this->returnException('Out of disk space.');
151
+ throw new \Exception('Error: ' . $e->getMessage());
152
  } catch (\Exception $e) {
153
  // Skip bad file permissions
154
  }
193
  }
194
  }
195
  } catch (\Exception $e) {
196
+ //$this->returnException('Out of disk space.');
197
+ throw new \Exception('Error: ' . $e->getMessage());
198
  } catch (\Exception $e) {
199
  // Skip bad file permissions
200
  }
238
  }
239
  }
240
  } catch (\Exception $e) {
241
+ //$this->returnException('Out of disk space.');
242
+ throw new \Exception('Error: ' . $e->getMessage());
243
  } catch (\Exception $e) {
244
  // Skip bad file permissions
245
  }
271
 
272
  $file_handle = @fopen($file, $mode);
273
  if (false === $file_handle) {
274
+ $this->returnException(sprintf(__('Unable to open %s with mode %s', 'wpstg'), $file, $mode));
275
+ //throw new Exception(sprintf(__('Unable to open %s with mode %s', 'wpstg'), $file, $mode));
276
  }
277
 
278
  return $file_handle;
291
  $write_result = @fwrite($handle, $content);
292
  if (false === $write_result) {
293
  if (( $meta = \stream_get_meta_data($handle))) {
294
+ //$this->returnException(sprintf(__('Unable to write to: %s', 'wpstg'), $meta['uri']));
295
  throw new \Exception(sprintf(__('Unable to write to: %s', 'wpstg'), $meta['uri']));
296
  }
297
  } elseif (strlen($content) !== $write_result) {
298
+ //$this->returnException(__('Out of disk space.', 'wpstg'));
299
  throw new \Exception(__('Out of disk space.', 'wpstg'));
300
  }
301
 
apps/Backend/public/js/wpstg-admin.js CHANGED
@@ -1032,6 +1032,13 @@ var WPStaging = (function ($)
1032
  nonce: wpstg.nonce
1033
  },
1034
  function (response) {
 
 
 
 
 
 
 
1035
  // Add percentage
1036
  if ("undefined" !== typeof (response.percentage))
1037
  {
1032
  nonce: wpstg.nonce
1033
  },
1034
  function (response) {
1035
+
1036
+ // Error
1037
+ if ("undefined" !== typeof response.error && "undefined" !== typeof response.message) {
1038
+ showError(response.message);
1039
+ console.log(response.message);
1040
+ }
1041
+
1042
  // Add percentage
1043
  if ("undefined" !== typeof (response.percentage))
1044
  {
apps/Backend/views/_includes/messages/beta.php CHANGED
@@ -1,25 +1,20 @@
1
- <div class="wpstg_beta_notice error" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
2
- <p>
3
- WP Staging is well tested and i did my best to catch every possible error i can forecast but
4
- i can not handle all possible combinations of different server, plugins and themes. <br>
5
- <strong>BEFORE</strong> you create your first staging site it´s highly recommended
6
- <strong>to make a full backup of your website</strong> first!
7
- </p>
8
- <p>
9
- One of the best free plugins for an entire wordpress backup is the free one
10
- <a href="https://wordpress.org/plugins/backwpup/" target="_blank">BackWPup</a>
11
- </p>
12
- <p>
13
- I am not responsible for any damages you do to your site;)
14
- <br>
15
- Create a full backup first.
16
- </p>
17
- <ul>
18
- <li>
19
- <a href="javascript:void(0);" class="wpstg_hide_beta" title="I understand" data-url="<?php echo admin_url("admin-ajax.php")?>" style="font-weight:bold;color:#00a0d2;">
20
- I understand! (Do not show this again)
21
- </a>
22
- </li>
23
- </ul>
24
- </div>
25
  <script type="text/javascript" src="<?php echo $this->url . "js/wpstg-admin-beta.js"?>"></script>
1
+ <div class="wpstg_beta_notice error" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
2
+ <p>
3
+ WP Staging is well tested and we did a lot to catch every possible error but
4
+ we can not handle all possible combinations of server, plugins and themes. <br>
5
+ <strong>BEFORE</strong> you create your first staging site it´s highly recommended
6
+ <strong>to make a full backup of your website</strong> first!
7
+ </p>
8
+ <p>
9
+ A good plugin for an entire WordPress backup is the free one
10
+ <a href="https://wordpress.org/plugins/backwpup/" target="_blank">BackWPup</a>
11
+ </p>
12
+ <ul>
13
+ <li>
14
+ <a href="javascript:void(0);" class="wpstg_hide_beta" title="I understand" data-url="<?php echo admin_url("admin-ajax.php")?>" style="font-weight:bold;color:#00a0d2;">
15
+ I understand! (Do not show this again)
16
+ </a>
17
+ </li>
18
+ </ul>
19
+ </div>
 
 
 
 
 
20
  <script type="text/javascript" src="<?php echo $this->url . "js/wpstg-admin-beta.js"?>"></script>
apps/Core/WPStaging.php CHANGED
@@ -29,7 +29,7 @@ final class WPStaging {
29
  /**
30
  * Plugin version
31
  */
32
- const VERSION = "2.1.6";
33
 
34
  /**
35
  * Plugin name
@@ -44,7 +44,7 @@ final class WPStaging {
44
  /**
45
  * Compatible WP Version
46
  */
47
- const WP_COMPATIBLE = "4.9.0";
48
 
49
  /**
50
  * Slug: Either wp-staging or wp-staging-pro
29
  /**
30
  * Plugin version
31
  */
32
+ const VERSION = "2.1.7";
33
 
34
  /**
35
  * Plugin name
44
  /**
45
  * Compatible WP Version
46
  */
47
+ const WP_COMPATIBLE = "4.9.1";
48
 
49
  /**
50
  * Slug: Either wp-staging or wp-staging-pro
readme.txt CHANGED
@@ -9,14 +9,12 @@ 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: 4.9
12
- Stable tag: 2.1.6
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
16
  == Description ==
17
 
18
- <strong>User of WP Super Cache? Than you need to exclude the WP Super Cache plugin from the WP Staging cloning process or the staging site will throw an error! This will be fixed with next WP Super Cache Update</strong>
19
- <br/>
20
  <strong>This cloning and staging plugin is well tested but work in progress. <br><br>
21
  If you find any issue, please open a [support ticket](https://wp-staging.com/support/ "support ticket").
22
  </strong>
@@ -141,6 +139,11 @@ https://wp-staging.com
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
144
  = 2.1.6 =
145
  * New: increased speed for cloning process by factor 5, using new method of file agregation
146
  * New: Skip files larger than 8MB
@@ -291,5 +294,5 @@ Complete changelog: [https://wp-staging.com/changelog.txt](https://wp-staging.co
291
 
292
  == Upgrade Notice ==
293
 
294
- = 2.1.6 =
295
- 2.1.6 * * Fix: Additional checks to ensure that the root path is never deleted
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: 4.9
12
+ Stable tag: 2.1.7
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
16
  == Description ==
17
 
 
 
18
  <strong>This cloning and staging plugin is well tested but work in progress. <br><br>
19
  If you find any issue, please open a [support ticket](https://wp-staging.com/support/ "support ticket").
20
  </strong>
139
 
140
  == Changelog ==
141
 
142
+ = 2.1.7 =
143
+ * Tweak: Return more human readable error notices
144
+ * Fix: Cloning process stops due to file permission issue
145
+ * Fix: Exclude WP Super Cache from copying process because of bug in WP Super Cache, see https://github.com/Automattic/wp-super-cache/issues/505
146
+
147
  = 2.1.6 =
148
  * New: increased speed for cloning process by factor 5, using new method of file agregation
149
  * New: Skip files larger than 8MB
294
 
295
  == Upgrade Notice ==
296
 
297
+ = 2.1.7 =
298
+ 2.1.7 * Update for WordPress 4.9.1. Preparations for Database Migration
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.1.6
11
  * Text Domain: wpstg
12
  * Domain Path: /languages/
13
 
7
  * Author: WP-Staging
8
  * Author URI: https://wp-staging.com
9
  * Contributors: ReneHermi, ilgityildirim
10
+ * Version: 2.1.7
11
  * Text Domain: wpstg
12
  * Domain Path: /languages/
13