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

Version Description

  • Fix: Link to the staging site is missing a slash if WordPress is installed in subdir
  • Tweak: Allow file copy limit 1 to prevent copy timeouts
Download this release

Release Info

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

Code changes from version 2.1.3 to 2.1.4

apps/Backend/Modules/Jobs/Job.php CHANGED
@@ -174,7 +174,7 @@ abstract class Job implements JobInterface
174
  */
175
  protected function setDefaultSettings(){
176
  $this->settings->queryLimit = "1000";
177
- $this->settings->fileLimit = "10";
178
  $this->settings->batchSize = "2";
179
  $this->settings->cpuLoad = 'medium';
180
  update_option('wpstg_settings', $this->settings);
174
  */
175
  protected function setDefaultSettings(){
176
  $this->settings->queryLimit = "1000";
177
+ $this->settings->fileLimit = "1";
178
  $this->settings->batchSize = "2";
179
  $this->settings->cpuLoad = 'medium';
180
  update_option('wpstg_settings', $this->settings);
apps/Backend/Modules/Views/Forms/Settings.php CHANGED
@@ -1,220 +1,220 @@
1
- <?php
2
- namespace WPStaging\Backend\Modules\Views\Forms;
3
-
4
- use WPStaging\Forms\Elements\Check;
5
- use WPStaging\Forms\Elements\Numerical;
6
- use WPStaging\Forms\Elements\Select;
7
- use WPStaging\Forms\Elements\SelectMultiple;
8
- use WPStaging\Forms\Form;
9
- use WPStaging\Backend\Modules\Views\Tabs\Tabs;
10
-
11
- /**
12
- * Class Settings
13
- * @package WPStaging\Backend\Modules\Views\Forms
14
- */
15
- class Settings
16
- {
17
-
18
- /**
19
- * @var array
20
- */
21
- private $form = array();
22
-
23
- /**
24
- * @var Tabs
25
- */
26
- private $tabs;
27
-
28
- /**
29
- * Settings constructor.
30
- * @param Tabs $tabs
31
- */
32
- public function __construct($tabs)
33
- {
34
- $this->tabs = $tabs;
35
-
36
- foreach ($this->tabs->get() as $id => $name)
37
- {
38
- if (!method_exists($this, $id))
39
- {
40
- continue;
41
- }
42
-
43
- $this->{$id}();
44
- }
45
- }
46
-
47
- private function general()
48
- {
49
- $this->form["general"] = new Form();
50
-
51
- $settings = json_decode(json_encode(get_option("wpstg_settings", array())));
52
-
53
- // DB Copy Query Limit
54
- $element = new Numerical(
55
- "wpstg_settings[queryLimit]",
56
- array(
57
- "class" => "medium-text",
58
- "step" => 1,
59
- "max" => 999999,
60
- "min" => 0
61
- )
62
- );
63
-
64
- $this->form["general"]->add(
65
- $element->setLabel("DB Copy Query Limit")
66
- ->setDefault(isset($settings->queryLimit) ? $settings->queryLimit : 1000)
67
- );
68
-
69
- $options = array('250' => '250' ,'500' => '500', '1000' => '1000');
70
- // DB Copy Query Limit
71
- $element = new Select(
72
- "wpstg_settings[fileLimit]",
73
- $options,
74
- array(
75
- "class" => "medium-text",
76
- "step" => 1,
77
- "max" => 999999,
78
- "min" => 0
79
- )
80
- );
81
-
82
- $this->form["general"]->add(
83
- $element->setLabel("File Copy Limit")->setDefault(isset($settings->fileLimit) ? $settings->fileLimit : 500)
84
- );
85
-
86
-
87
- // File Copy Batch Size
88
- $element = new Numerical(
89
- "wpstg_settings[batchSize]",
90
- array(
91
- "class" => "medium-text",
92
- "step" => 1,
93
- "max" => 999999,
94
- "min" => 0
95
- )
96
- );
97
-
98
- $this->form["general"]->add(
99
- $element->setLabel("File Copy Batch Size")
100
- ->setDefault(isset($settings->batchSize) ? $settings->batchSize : 2)
101
- );
102
-
103
- // CPU load priority
104
- $element = new Select(
105
- "wpstg_settings[cpuLoad]",
106
- array(
107
- "high" => "High (fast)",
108
- "medium" => "Medium (average)",
109
- "low" => "Low (slow)"
110
- )
111
- );
112
-
113
- $this->form["general"]->add(
114
- $element->setLabel("CPU load priority")
115
- ->setDefault(isset($settings->cpuLoad) ? $settings->cpuLoad : "fast")
116
- );
117
-
118
-
119
- // Optimizer
120
- $element = new Check(
121
- "wpstg_settings[optimizer]",
122
- array('1' => "Select the plugins you wish to disable during clone process")
123
- );
124
-
125
- $this->form["general"]->add(
126
- $element->setLabel("Optimizer")
127
- ->setDefault((isset($settings->optimizer)) ? $settings->optimizer : null)
128
- );
129
-
130
- // Plugins
131
- $plugins = array();
132
-
133
- foreach (get_plugins() as $key => $data)
134
- {
135
- if ("wp-staging/wp-staging.php" === $key)
136
- {
137
- continue;
138
- }
139
-
140
- $plugins[$key] = $data["Name"];
141
- }
142
-
143
- $element = new Select(
144
- "wpstg_settings[blackListedPlugins][]",
145
- $plugins,
146
- array(
147
- "multiple" => "multiple",
148
- "style" => "min-height:400px;"
149
- )
150
- );
151
-
152
- $this->form["general"]->add(
153
- $element->setDefault((isset($settings->blackListedPlugins)) ? $settings->blackListedPlugins : null)
154
- );
155
-
156
- // Disable admin authorization
157
- $element = new Check(
158
- "wpstg_settings[disableAdminLogin]",
159
- array('1' => '')
160
- );
161
-
162
- $this->form["general"]->add(
163
- $element->setLabel("Disable admin authorization")
164
- ->setDefault((isset($settings->disableAdminLogin)) ? $settings->disableAdminLogin : null)
165
- );
166
-
167
- // WordPress in subdirectory
168
- $element = new Check(
169
- "wpstg_settings[wpSubDirectory]",
170
- array('1' => '')
171
- );
172
-
173
- $this->form["general"]->add(
174
- $element->setLabel("Wordpress in subdirectory")
175
- ->setDefault((isset($settings->wpSubDirectory)) ? $settings->wpSubDirectory : null)
176
- );
177
-
178
- // Debug Mode
179
- $element = new Check(
180
- "wpstg_settings[debugMode]",
181
- array('1' => '')
182
- );
183
-
184
- $this->form["general"]->add(
185
- $element->setLabel("Debug Mode")
186
- ->setDefault((isset($settings->debugMode)) ? $settings->debugMode : null)
187
- );
188
-
189
- // Remove Data on Uninstall?
190
- $element = new Check(
191
- "wpstg_settings[unInstallOnDelete]",
192
- array('1' => '')
193
- );
194
-
195
- $this->form["general"]->add(
196
- $element->setLabel("Remove Data on Uninstall?")
197
- ->setDefault((isset($settings->unInstallOnDelete)) ? $settings->unInstallOnDelete : null)
198
- );
199
-
200
- // Check Directory Sizes
201
- $element = new Check(
202
- "wpstg_settings[checkDirectorySize]",
203
- array('1' => '')
204
- );
205
-
206
- $this->form["general"]->add(
207
- $element->setLabel("Check Directory Size")
208
- ->setDefault((isset($settings->checkDirectorySize)) ? $settings->checkDirectorySize : null)
209
- );
210
- }
211
-
212
- /**
213
- * @param string $name
214
- * @return array|Form
215
- */
216
- public function get($name = null)
217
- {
218
- return (null === $name) ? $this->form : $this->form[$name];
219
- }
220
  }
1
+ <?php
2
+ namespace WPStaging\Backend\Modules\Views\Forms;
3
+
4
+ use WPStaging\Forms\Elements\Check;
5
+ use WPStaging\Forms\Elements\Numerical;
6
+ use WPStaging\Forms\Elements\Select;
7
+ use WPStaging\Forms\Elements\SelectMultiple;
8
+ use WPStaging\Forms\Form;
9
+ use WPStaging\Backend\Modules\Views\Tabs\Tabs;
10
+
11
+ /**
12
+ * Class Settings
13
+ * @package WPStaging\Backend\Modules\Views\Forms
14
+ */
15
+ class Settings
16
+ {
17
+
18
+ /**
19
+ * @var array
20
+ */
21
+ private $form = array();
22
+
23
+ /**
24
+ * @var Tabs
25
+ */
26
+ private $tabs;
27
+
28
+ /**
29
+ * Settings constructor.
30
+ * @param Tabs $tabs
31
+ */
32
+ public function __construct($tabs)
33
+ {
34
+ $this->tabs = $tabs;
35
+
36
+ foreach ($this->tabs->get() as $id => $name)
37
+ {
38
+ if (!method_exists($this, $id))
39
+ {
40
+ continue;
41
+ }
42
+
43
+ $this->{$id}();
44
+ }
45
+ }
46
+
47
+ private function general()
48
+ {
49
+ $this->form["general"] = new Form();
50
+
51
+ $settings = json_decode(json_encode(get_option("wpstg_settings", array())));
52
+
53
+ // DB Copy Query Limit
54
+ $element = new Numerical(
55
+ "wpstg_settings[queryLimit]",
56
+ array(
57
+ "class" => "medium-text",
58
+ "step" => 1,
59
+ "max" => 999999,
60
+ "min" => 0
61
+ )
62
+ );
63
+
64
+ $this->form["general"]->add(
65
+ $element->setLabel("DB Copy Query Limit")
66
+ ->setDefault(isset($settings->queryLimit) ? $settings->queryLimit : 1000)
67
+ );
68
+
69
+ $options = array('1' => '1', '250' => '250' ,'500' => '500', '1000' => '1000');
70
+ // DB Copy Query Limit
71
+ $element = new Select(
72
+ "wpstg_settings[fileLimit]",
73
+ $options,
74
+ array(
75
+ "class" => "medium-text",
76
+ "step" => 1,
77
+ "max" => 999999,
78
+ "min" => 0
79
+ )
80
+ );
81
+
82
+ $this->form["general"]->add(
83
+ $element->setLabel("File Copy Limit")->setDefault(isset($settings->fileLimit) ? $settings->fileLimit : 250)
84
+ );
85
+
86
+
87
+ // File Copy Batch Size
88
+ $element = new Numerical(
89
+ "wpstg_settings[batchSize]",
90
+ array(
91
+ "class" => "medium-text",
92
+ "step" => 1,
93
+ "max" => 999999,
94
+ "min" => 0
95
+ )
96
+ );
97
+
98
+ $this->form["general"]->add(
99
+ $element->setLabel("File Copy Batch Size")
100
+ ->setDefault(isset($settings->batchSize) ? $settings->batchSize : 2)
101
+ );
102
+
103
+ // CPU load priority
104
+ $element = new Select(
105
+ "wpstg_settings[cpuLoad]",
106
+ array(
107
+ "high" => "High (fast)",
108
+ "medium" => "Medium (average)",
109
+ "low" => "Low (slow)"
110
+ )
111
+ );
112
+
113
+ $this->form["general"]->add(
114
+ $element->setLabel("CPU load priority")
115
+ ->setDefault(isset($settings->cpuLoad) ? $settings->cpuLoad : "fast")
116
+ );
117
+
118
+
119
+ // Optimizer
120
+ $element = new Check(
121
+ "wpstg_settings[optimizer]",
122
+ array('1' => "Select the plugins you wish to disable during clone process")
123
+ );
124
+
125
+ $this->form["general"]->add(
126
+ $element->setLabel("Optimizer")
127
+ ->setDefault((isset($settings->optimizer)) ? $settings->optimizer : null)
128
+ );
129
+
130
+ // Plugins
131
+ $plugins = array();
132
+
133
+ foreach (get_plugins() as $key => $data)
134
+ {
135
+ if ("wp-staging/wp-staging.php" === $key)
136
+ {
137
+ continue;
138
+ }
139
+
140
+ $plugins[$key] = $data["Name"];
141
+ }
142
+
143
+ $element = new Select(
144
+ "wpstg_settings[blackListedPlugins][]",
145
+ $plugins,
146
+ array(
147
+ "multiple" => "multiple",
148
+ "style" => "min-height:400px;"
149
+ )
150
+ );
151
+
152
+ $this->form["general"]->add(
153
+ $element->setDefault((isset($settings->blackListedPlugins)) ? $settings->blackListedPlugins : null)
154
+ );
155
+
156
+ // Disable admin authorization
157
+ $element = new Check(
158
+ "wpstg_settings[disableAdminLogin]",
159
+ array('1' => '')
160
+ );
161
+
162
+ $this->form["general"]->add(
163
+ $element->setLabel("Disable admin authorization")
164
+ ->setDefault((isset($settings->disableAdminLogin)) ? $settings->disableAdminLogin : null)
165
+ );
166
+
167
+ // WordPress in subdirectory
168
+ $element = new Check(
169
+ "wpstg_settings[wpSubDirectory]",
170
+ array('1' => '')
171
+ );
172
+
173
+ $this->form["general"]->add(
174
+ $element->setLabel("Wordpress in subdirectory")
175
+ ->setDefault((isset($settings->wpSubDirectory)) ? $settings->wpSubDirectory : null)
176
+ );
177
+
178
+ // Debug Mode
179
+ $element = new Check(
180
+ "wpstg_settings[debugMode]",
181
+ array('1' => '')
182
+ );
183
+
184
+ $this->form["general"]->add(
185
+ $element->setLabel("Debug Mode")
186
+ ->setDefault((isset($settings->debugMode)) ? $settings->debugMode : null)
187
+ );
188
+
189
+ // Remove Data on Uninstall?
190
+ $element = new Check(
191
+ "wpstg_settings[unInstallOnDelete]",
192
+ array('1' => '')
193
+ );
194
+
195
+ $this->form["general"]->add(
196
+ $element->setLabel("Remove Data on Uninstall?")
197
+ ->setDefault((isset($settings->unInstallOnDelete)) ? $settings->unInstallOnDelete : null)
198
+ );
199
+
200
+ // Check Directory Sizes
201
+ $element = new Check(
202
+ "wpstg_settings[checkDirectorySize]",
203
+ array('1' => '')
204
+ );
205
+
206
+ $this->form["general"]->add(
207
+ $element->setLabel("Check Directory Size")
208
+ ->setDefault((isset($settings->checkDirectorySize)) ? $settings->checkDirectorySize : null)
209
+ );
210
+ }
211
+
212
+ /**
213
+ * @param string $name
214
+ * @return array|Form
215
+ */
216
+ public function get($name = null)
217
+ {
218
+ return (null === $name) ? $this->form : $this->form[$name];
219
+ }
220
  }
apps/Backend/public/js/wpstg-admin.js CHANGED
@@ -361,7 +361,7 @@ var WPStaging = (function ($)
361
  }
362
 
363
  showError(
364
- "Fatal Unknown Error. Go to WP Staging > Settings and lower 'File Copy Limit'" +
365
  "Than try again. If this does not help, " +
366
  "<a href='https://wpquads.com/support/' target='_blank'>open a support ticket</a> "
367
  );
@@ -1207,9 +1207,11 @@ var WPStaging = (function ($)
1207
  cache.get("#wpstg-finished-result").show();
1208
  cache.get("#wpstg-cancel-cloning").prop("disabled", true);
1209
  cache.get("#wpstg-cancel-cloning-update").prop("disabled", true);
1210
- $link1.attr("href", $link1.attr("href") + '/' + response.directoryName);
1211
- $link1.append('/' + response.directoryName);
1212
- $link.attr("href", $link.attr("href") + '/' + response.directoryName);
 
 
1213
  cache.get("#wpstg-remove-clone").data("clone", that.data.cloneID);
1214
 
1215
  // Finished
361
  }
362
 
363
  showError(
364
+ "Fatal Unknown Error. Go to WP Staging > Settings and set 'File Copy Limit' to 1. Also try to lower 'cpu load' there." +
365
  "Than try again. If this does not help, " +
366
  "<a href='https://wpquads.com/support/' target='_blank'>open a support ticket</a> "
367
  );
1207
  cache.get("#wpstg-finished-result").show();
1208
  cache.get("#wpstg-cancel-cloning").prop("disabled", true);
1209
  cache.get("#wpstg-cancel-cloning-update").prop("disabled", true);
1210
+ // $link1.attr("href", $link1.attr("href") + '/' + response.directoryName);
1211
+ // $link1.append('/' + response.directoryName);
1212
+ // $link.attr("href", $link.attr("href") + '/' + response.directoryName);
1213
+ $link1.attr("href", response.url);
1214
+ $link.attr("href", response.url);
1215
  cache.get("#wpstg-remove-clone").data("clone", that.data.cloneID);
1216
 
1217
  // Finished
apps/Core/WPStaging.php CHANGED
@@ -29,7 +29,7 @@ final class WPStaging {
29
  /**
30
  * Plugin version
31
  */
32
- const VERSION = "2.1.3";
33
 
34
  /**
35
  * Plugin name
29
  /**
30
  * Plugin version
31
  */
32
+ const VERSION = "2.1.4";
33
 
34
  /**
35
  * Plugin name
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.8
12
- Stable tag: 2.1.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
 
@@ -139,6 +139,10 @@ https://wp-staging.com
139
 
140
  == Changelog ==
141
 
 
 
 
 
142
  = 2.1.3 =
143
  * New: Add more details to tools->system info log for better debugging
144
  * New: Add buttons to select all default wp tables with one click
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.8
12
+ Stable tag: 2.1.4
13
 
14
  A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
15
 
139
 
140
  == Changelog ==
141
 
142
+ = 2.1.4 =
143
+ * Fix: Link to the staging site is missing a slash if WordPress is installed in subdir
144
+ * Tweak: Allow file copy limit 1 to prevent copy timeouts
145
+
146
  = 2.1.3 =
147
  * New: Add more details to tools->system info log for better debugging
148
  * New: Add buttons to select all default wp tables with one click
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.3
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.4
11
  * Text Domain: wpstg
12
  * Domain Path: /languages/
13