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

Version Description

  • Fix: Change default login link to wp-admin
  • Fix: Unneccessary duplicates of wpstg tables in db
Download this release

Release Info

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

Code changes from version 2.2.2 to 2.2.3

apps/Backend/Modules/Jobs/Cloning.php CHANGED
@@ -33,9 +33,7 @@ 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 = $this->getStagingPrefix();
37
-
38
- //$this->options->prefix = $this->getStagingPrefix();
39
  $this->options->includedDirectories = array();
40
  $this->options->excludedDirectories = array();
41
  $this->options->extraDirectories = array();
@@ -52,21 +50,28 @@ class Cloning extends Job
52
 
53
  $this->options->prefix = isset($this->options->existingClones[$this->options->clone]->prefix) ?
54
  $this->options->existingClones[$this->options->clone]->prefix :
55
- $this->getStagingPrefix();
56
 
57
  } // Clone does not exist but there are other clones in db
58
  // Get data and increment it
59
  elseif (!empty($this->options->existingClones))
60
  {
61
  $this->options->cloneNumber = count($this->options->existingClones)+1;
62
- $this->options->prefix = $this->getStagingPrefix();
63
  }
64
 
65
- // Excluded Tables
66
- if (isset($_POST["excludedTables"]) && is_array($_POST["excludedTables"]))
67
  {
68
- $this->options->excludedTables = $_POST["excludedTables"];
 
 
69
  }
 
 
 
 
 
70
 
71
  // Excluded Directories
72
  if (isset($_POST["excludedDirectories"]) && is_array($_POST["excludedDirectories"]))
@@ -74,12 +79,14 @@ class Cloning extends Job
74
  $this->options->excludedDirectories = $_POST["excludedDirectories"];
75
  }
76
 
 
77
  // Excluded Directories TOTAL
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);
@@ -113,10 +120,10 @@ class Cloning extends Job
113
  /**
114
  * Create a new staging prefix which does not already exists in database
115
  */
116
- public function getStagingPrefix(){
117
 
118
- // Find a new prefix that does not already exist in database.
119
- // 1000 different possible prefixes should be enough here
120
  for($i=0; $i <= 10000; $i++){
121
  $this->options->prefix = isset($this->options->existingClones) ?
122
  'wpstg' . (count($this->options->existingClones)+$i) . '_' :
@@ -198,6 +205,10 @@ class Cloning extends Job
198
  return $response;
199
  }
200
 
 
 
 
 
201
  /**
202
  * Clone Database
203
  * @return object
@@ -238,6 +249,7 @@ class Cloning extends Job
238
  return $this->handleJobResponse($data->start(), "finish");
239
  }
240
 
 
241
  /**
242
  * Save Clone Data
243
  * @return object
@@ -247,4 +259,6 @@ class Cloning extends Job
247
  $finish = new Finish();
248
  return $this->handleJobResponse($finish->start(), '');
249
  }
 
 
250
  }
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->setStagingPrefix();
 
 
37
  $this->options->includedDirectories = array();
38
  $this->options->excludedDirectories = array();
39
  $this->options->extraDirectories = array();
50
 
51
  $this->options->prefix = isset($this->options->existingClones[$this->options->clone]->prefix) ?
52
  $this->options->existingClones[$this->options->clone]->prefix :
53
+ $this->setStagingPrefix();
54
 
55
  } // Clone does not exist but there are other clones in db
56
  // Get data and increment it
57
  elseif (!empty($this->options->existingClones))
58
  {
59
  $this->options->cloneNumber = count($this->options->existingClones)+1;
60
+ $this->options->prefix = $this->setStagingPrefix();
61
  }
62
 
63
+ // Included Tables
64
+ if (isset($_POST["includedTables"]) && is_array($_POST["includedTables"]))
65
  {
66
+ $this->options->tables = $_POST["includedTables"];
67
+ } else {
68
+ $this->options->tables = array();
69
  }
70
+ // Excluded Tables
71
+ // if (isset($_POST["excludedTables"]) && is_array($_POST["excludedTables"]))
72
+ // {
73
+ // $this->options->excludedTables = $_POST["excludedTables"];
74
+ // }
75
 
76
  // Excluded Directories
77
  if (isset($_POST["excludedDirectories"]) && is_array($_POST["excludedDirectories"]))
79
  $this->options->excludedDirectories = $_POST["excludedDirectories"];
80
  }
81
 
82
+
83
  // Excluded Directories TOTAL
84
  // Do not copy these folders and plugins
85
  $excludedDirectories = array(
86
  ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'cache',
87
  ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wps-hide-login',
88
  ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wp-super-cache',
89
+ ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'peters-login-redirect',
90
  );
91
 
92
  $this->options->excludedDirectories = array_merge($excludedDirectories, $this->options->excludedDirectories);
120
  /**
121
  * Create a new staging prefix which does not already exists in database
122
  */
123
+ public function setStagingPrefix(){
124
 
125
+ // Get & find a new prefix that does not already exist in database.
126
+ // Loop through up to 1000 different possible prefixes should be enough here;)
127
  for($i=0; $i <= 10000; $i++){
128
  $this->options->prefix = isset($this->options->existingClones) ?
129
  'wpstg' . (count($this->options->existingClones)+$i) . '_' :
205
  return $response;
206
  }
207
 
208
+
209
+
210
+
211
+
212
  /**
213
  * Clone Database
214
  * @return object
249
  return $this->handleJobResponse($data->start(), "finish");
250
  }
251
 
252
+
253
  /**
254
  * Save Clone Data
255
  * @return object
259
  $finish = new Finish();
260
  return $this->handleJobResponse($finish->start(), '');
261
  }
262
+
263
+
264
  }
apps/Backend/Modules/SystemInfo.php CHANGED
@@ -147,6 +147,7 @@ class SystemInfo extends InjectionAware
147
  $output .= $this->info( "Batch Size:", isset( $settings->batchSize ) ? $settings->batchSize : 'undefined' );
148
  $output .= $this->info( "CPU Load:", isset( $settings->cpuLoad ) ? $settings->cpuLoad : 'undefined' );
149
  $output .= $this->info( "WP in Subdir:", isset( $settings->wpSubDirectory ) ? $settings->wpSubDirectory : 'false' );
 
150
 
151
  $output .= PHP_EOL . PHP_EOL . "-- Available Sites Version < 1.6.x" . PHP_EOL . PHP_EOL;
152
 
147
  $output .= $this->info( "Batch Size:", isset( $settings->batchSize ) ? $settings->batchSize : 'undefined' );
148
  $output .= $this->info( "CPU Load:", isset( $settings->cpuLoad ) ? $settings->cpuLoad : 'undefined' );
149
  $output .= $this->info( "WP in Subdir:", isset( $settings->wpSubDirectory ) ? $settings->wpSubDirectory : 'false' );
150
+ $output .= $this->info( "Login Custom Link:", isset( $settings->loginSlug ) ? $settings->loginSlug : 'false' );
151
 
152
  $output .= PHP_EOL . PHP_EOL . "-- Available Sites Version < 1.6.x" . PHP_EOL . PHP_EOL;
153
 
apps/Backend/views/clone/ajax/scan.php CHANGED
@@ -101,13 +101,18 @@
101
  <div class="wpstg-tab-section" id="wpstg-advanced-settings">
102
  <p>
103
  <?php
104
- _e('<strong>Important:</strong> Are you using a custom login url?', 'wpstg');
105
  echo '<br/>';
106
- echo sprintf(__('Set up first <a href="%1$s"><strong>Login Custom Link</strong></a> if login to the admin dashboard is not reachable from the default url <pre>%2$s</pre>', 'wpstg'),
107
- admin_url() . '/admin.php?page=wpstg-settings#wpstg_settings[loginSlug]',
108
- admin_url()
109
  );
110
- _e('<strong>If you do not do that step, the staging site will not be accessable!</strong>', 'wpstg');
 
 
 
 
 
 
111
  //$form = $this->di->get("forms")->get("general");
112
  //echo $form->label("wpstg_settings['loginPostId']");
113
  //echo $form->render("wpstg_settings['loginPostId']");
101
  <div class="wpstg-tab-section" id="wpstg-advanced-settings">
102
  <p>
103
  <?php
104
+ _e('<strong>Important:</strong> Is your site using a custom login url?', 'wpstg');
105
  echo '<br/>';
106
+ echo sprintf(__('Set up a <a href="%1$s" target="_blank" rel="noopener"><strong>Login Custom Link</strong></a> if login to the admin dashboard is <strong>not</strong> reachable from the default login url.', 'wpstg'),
107
+ admin_url() . '/admin.php?page=wpstg-settings#wpstg_settings[loginSlug]'
 
108
  );
109
+ echo '<br/>';
110
+ sprintf(__('To test this you need to log out first! Than login again by using the link <a href="%1$s" target="_blank">12$s</a>.', 'wpstg'), admin_url());
111
+ echo '<br/>';
112
+ _e('If the login link does not work you <strong>must</strong> define the Login Custom Link option.', 'wpstg');
113
+ echo '<br/>';
114
+ echo '<br/>';
115
+ _e('<strong>If you are using a custom login and you do not define that setting, the staging site will not be accessable!</strong>', 'wpstg');
116
  //$form = $this->di->get("forms")->get("general");
117
  //echo $form->label("wpstg_settings['loginPostId']");
118
  //echo $form->render("wpstg_settings['loginPostId']");
apps/Backend/views/settings/index.php CHANGED
@@ -273,7 +273,7 @@
273
  <span class="description">
274
  Check this box if you like WP Staging to check sizes of each directory on scanning process.
275
  <br>
276
- Warning this might cause timeout problems in big directory / file structures.
277
  </span>
278
  </div>
279
  </td>
273
  <span class="description">
274
  Check this box if you like WP Staging to check sizes of each directory on scanning process.
275
  <br>
276
+ Warning this might cause timeout problems in big directories / file structures.
277
  </span>
278
  </div>
279
  </td>
apps/Core/WPStaging.php CHANGED
@@ -29,7 +29,7 @@ final class WPStaging {
29
  /**
30
  * Plugin version
31
  */
32
- const VERSION = "2.2.2";
33
 
34
  /**
35
  * Plugin name
29
  /**
30
  * Plugin version
31
  */
32
+ const VERSION = "2.2.3";
33
 
34
  /**
35
  * Plugin name
apps/Frontend/Frontend.php CHANGED
@@ -15,6 +15,12 @@ class Frontend extends InjectionAware {
15
  * @var object
16
  */
17
  private $settings;
 
 
 
 
 
 
18
 
19
  /**
20
  * Frontend initialization.
@@ -23,6 +29,9 @@ class Frontend extends InjectionAware {
23
  $this->defineHooks();
24
 
25
  $this->settings = json_decode( json_encode( get_option( "wpstg_settings", array() ) ) );
 
 
 
26
  }
27
 
28
  /**
@@ -76,13 +85,12 @@ class Frontend extends InjectionAware {
76
  * @return string
77
  */
78
  private function getLoginUrl() {
79
- $loginSlug = isset($this->settings->loginSlug) ? $this->settings->loginSlug : '';
80
 
81
- if( empty( $loginSlug ) ) {
82
- return wp_login_url();
83
  }
84
 
85
- return get_home_url() . '/?' . $loginSlug;
86
  }
87
 
88
  /**
@@ -119,12 +127,11 @@ class Frontend extends InjectionAware {
119
  * @return bool
120
  */
121
  private function isLoginPage() {
122
- $loginSlug = isset($this->settings->loginSlug) ? $this->settings->loginSlug : '';
123
 
124
  return (
125
  in_array( $GLOBALS["pagenow"], array("wp-login.php") ) ||
126
- in_array( $loginSlug, $_GET ) ||
127
- array_key_exists( $loginSlug, $_GET )
128
  );
129
  }
130
 
15
  * @var object
16
  */
17
  private $settings;
18
+
19
+ /**
20
+ *
21
+ * @var string
22
+ */
23
+ private $loginSlug;
24
 
25
  /**
26
  * Frontend initialization.
29
  $this->defineHooks();
30
 
31
  $this->settings = json_decode( json_encode( get_option( "wpstg_settings", array() ) ) );
32
+
33
+ $this->loginSlug = isset($this->settings->loginSlug) ? $this->settings->loginSlug : '';
34
+
35
  }
36
 
37
  /**
85
  * @return string
86
  */
87
  private function getLoginUrl() {
 
88
 
89
+ if( empty( $this->loginSlug ) ) {
90
+ return get_home_url() . '/wp-admin';
91
  }
92
 
93
+ return get_home_url() . '/?' . $this->loginSlug;
94
  }
95
 
96
  /**
127
  * @return bool
128
  */
129
  private function isLoginPage() {
 
130
 
131
  return (
132
  in_array( $GLOBALS["pagenow"], array("wp-login.php") ) ||
133
+ in_array( $this->loginSlug, $_GET ) ||
134
+ array_key_exists( $this->loginSlug, $_GET )
135
  );
136
  }
137
 
readme.txt CHANGED
@@ -9,7 +9,7 @@ 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.2.2
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
@@ -145,6 +145,10 @@ https://wp-staging.com
145
 
146
  == Changelog ==
147
 
 
 
 
 
148
  = 2.2.2 =
149
  * Fix: Undefined property: stdClass::$loginSlug
150
 
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.2.3
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
145
 
146
  == Changelog ==
147
 
148
+ = 2.2.3 =
149
+ * Fix: Change default login link to wp-admin
150
+ * Fix: Unneccessary duplicates of wpstg tables in db
151
+
152
  = 2.2.2 =
153
  * Fix: Undefined property: stdClass::$loginSlug
154
 
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.2.2
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.2.3
11
  * Text Domain: wpstg
12
  * Domain Path: /languages/
13