Version Description
- New: Tested up to WP 4.5
- Fix: Download system log not working
- Fix: Click on Optimizer "Select all | none | invert" links leads to jumping
- Tweak: Make clear that unselecting a checkbox will exlude table or file from copy process
- Tweak: Remove unnecessary text
- Tweak: Change beta notice in dashboard. WP Staging is stable
- Tweak: Change twitter handle to @wpstg
Download this release
Release Info
Developer | ReneHermi |
Plugin | WP Staging – DB & File Duplicator & Migration |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- assets/css/wpstg-admin.css +4 -0
- assets/css/wpstg-admin.min.css +615 -1
- assets/js/wpstg-admin.js +747 -728
- assets/js/wpstg-admin.min.js +1 -1
- includes/admin/admin-notices.php +4 -6
- includes/admin/settings/display-settings.php +5 -8
- includes/admin/settings/register-settings.php +2 -2
- includes/admin/tools.php +3 -3
- includes/error-handling.php +36 -0
- includes/logger.php +1 -0
- includes/template-functions.php +53 -64
- readme.txt +11 -2
- templates/wpstg.min.css +0 -0
- wp-staging.php +70 -108
assets/css/wpstg-admin.css
CHANGED
@@ -37,6 +37,10 @@ text-decoration: none;
|
|
37 |
padding-bottom:12px;
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
40 |
|
41 |
#tab_container .row label strong, #tab_container .row strong {
|
42 |
font-weight: bold;
|
37 |
padding-bottom:12px;
|
38 |
}
|
39 |
|
40 |
+
#wpstg-tools .nav-tab-wrapper{
|
41 |
+
padding:0px;
|
42 |
+
}
|
43 |
+
|
44 |
|
45 |
#tab_container .row label strong, #tab_container .row strong {
|
46 |
font-weight: bold;
|
assets/css/wpstg-admin.min.css
CHANGED
@@ -1 +1,615 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WPSTG Admin CSS
|
3 |
+
*
|
4 |
+
* @package WPSTG
|
5 |
+
* @subpackage Admin CSS
|
6 |
+
* @copyright Copyright (c) 2015, René Hermenau
|
7 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
/* CSS for Tabs */
|
12 |
+
|
13 |
+
#tab_container ul {
|
14 |
+
/*height: 200px;*/
|
15 |
+
list-style: none;
|
16 |
+
margin: 0;
|
17 |
+
padding: 0;
|
18 |
+
background: #f1f1f1;
|
19 |
+
float: left;
|
20 |
+
padding-top: 0px;
|
21 |
+
/*list-style-type: square;*/
|
22 |
+
}
|
23 |
+
|
24 |
+
#tab_container ul li:first-child.selected-tab {
|
25 |
+
border-top: none;
|
26 |
+
}
|
27 |
+
|
28 |
+
#tab_container ul li a.selected-tab {
|
29 |
+
font-weight: bold;
|
30 |
+
text-decoration: none;
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
#tab_container .row{
|
36 |
+
padding-top:10px;
|
37 |
+
padding-bottom:12px;
|
38 |
+
}
|
39 |
+
|
40 |
+
#wpstg-tools .nav-tab-wrapper{
|
41 |
+
padding:0px;
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
#tab_container .row label strong, #tab_container .row strong {
|
46 |
+
font-weight: bold;
|
47 |
+
}
|
48 |
+
|
49 |
+
.wpstg-tabs a {
|
50 |
+
padding:5px;
|
51 |
+
}
|
52 |
+
|
53 |
+
#tab_container > ul > li.wpstg-tabs.active {
|
54 |
+
background-color:white;
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
#wpstg_settingsgeneral_header .row:nth-child(3), #wpstg_settingsgeneral_header .row:nth-child(4){
|
60 |
+
display:none;
|
61 |
+
}
|
62 |
+
|
63 |
+
/* Layout of admin table and rows
|
64 |
+
*/
|
65 |
+
|
66 |
+
#tab_container .panel-container {
|
67 |
+
background: #FFF;
|
68 |
+
padding:20px;
|
69 |
+
padding-top:0px;
|
70 |
+
overflow:auto;
|
71 |
+
}
|
72 |
+
|
73 |
+
#tab_container .form-table th {
|
74 |
+
vertical-align: top;
|
75 |
+
text-align: left;
|
76 |
+
padding: 20px 10px 20px 0;
|
77 |
+
width: 200px;
|
78 |
+
line-height: 1.3;
|
79 |
+
font-weight: bold;
|
80 |
+
font-size: 14px;
|
81 |
+
color:#484848;
|
82 |
+
width: 30%;
|
83 |
+
}
|
84 |
+
|
85 |
+
#tab_container .form-table tr {
|
86 |
+
border-bottom: 1px solid #E7E7E7;
|
87 |
+
}
|
88 |
+
|
89 |
+
#tab_container span.description{
|
90 |
+
display: block;
|
91 |
+
font-weight: 400;
|
92 |
+
font-style: normal;
|
93 |
+
font-size: 13px;
|
94 |
+
margin-top: 7px;
|
95 |
+
color:#484848;
|
96 |
+
}
|
97 |
+
|
98 |
+
#tab_container .col-title{
|
99 |
+
color:#484848;
|
100 |
+
}
|
101 |
+
|
102 |
+
@media only screen and (max-width:680px) {
|
103 |
+
#tab_container ul {
|
104 |
+
float:none;
|
105 |
+
}
|
106 |
+
#tab_container .form-table tr > th {
|
107 |
+
width:100%;
|
108 |
+
}
|
109 |
+
#tab_container span.description{
|
110 |
+
font-size: 14px;
|
111 |
+
}
|
112 |
+
#tab_container .form-table tr > th, #tab_container .form-table tr > td {
|
113 |
+
padding:10px;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
#tab_container ul li {
|
118 |
+
margin-bottom:0px;
|
119 |
+
}
|
120 |
+
|
121 |
+
#tab_container ul li a {
|
122 |
+
display: block;
|
123 |
+
padding:10px 4px 10px 14px;
|
124 |
+
border-width: 1px 0;
|
125 |
+
border-style: solid;
|
126 |
+
border-top-color:white;
|
127 |
+
border-bottom-color:#e7e7e7;
|
128 |
+
text-decoration: none;
|
129 |
+
color: #0097DF;
|
130 |
+
font-weight: bold;
|
131 |
+
}
|
132 |
+
#tab_container ul li a:hover {
|
133 |
+
background-color: #e5e5e5;
|
134 |
+
color:#777777;
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
.wp-staginglogo{
|
139 |
+
display: block;
|
140 |
+
font-size:16px;
|
141 |
+
padding-top:20px;
|
142 |
+
width:220px;
|
143 |
+
float:left;
|
144 |
+
}
|
145 |
+
|
146 |
+
.wpstg-version{
|
147 |
+
display: block;
|
148 |
+
padding-top:29px
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
.wpstg_admin .nav-tab {
|
153 |
+
color: #3C3C3C;
|
154 |
+
}
|
155 |
+
|
156 |
+
|
157 |
+
#tab_container table tbody tr:nth-child(1) > th > div {
|
158 |
+
font-size: 20px;
|
159 |
+
}
|
160 |
+
|
161 |
+
.wpstg_hidden{
|
162 |
+
display: none;
|
163 |
+
}
|
164 |
+
|
165 |
+
/* End layout of admin table and rows
|
166 |
+
*/
|
167 |
+
#mashtabcontainer > .mashtabs {
|
168 |
+
background-color: #ffffff;
|
169 |
+
}
|
170 |
+
|
171 |
+
#mashtabcontainer ul .active {
|
172 |
+
background-color: #00adef;
|
173 |
+
color: white;
|
174 |
+
border-bottom-color: #0098D2;
|
175 |
+
}
|
176 |
+
|
177 |
+
#mashtabcontainer ul .active:hover {
|
178 |
+
background-color: #00A4E2;
|
179 |
+
color: white;
|
180 |
+
border-bottom-color: #0098D2;
|
181 |
+
}
|
182 |
+
|
183 |
+
#mashtabcontainer ul li a {
|
184 |
+
padding: 10px 14px 10px 14px;
|
185 |
+
background-color: #f3f3f3
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
#mashtabcontainer .mashtab-container {
|
190 |
+
border: 0px solid #ececec;
|
191 |
+
}
|
192 |
+
|
193 |
+
/* Cloning workflow */
|
194 |
+
#wpstg-clonepage-wrapper {
|
195 |
+
margin-bottom: 20px;
|
196 |
+
width: 690px;
|
197 |
+
}
|
198 |
+
|
199 |
+
@media screen and (min-width:1090px){
|
200 |
+
#wpstg-clonepage-wrapper {
|
201 |
+
float: left;
|
202 |
+
margin-bottom: 20px;
|
203 |
+
width: 690px;
|
204 |
+
}
|
205 |
+
.wpstg-sidebar{
|
206 |
+
display: none;
|
207 |
+
margin-left: 700px;
|
208 |
+
margin-top: 138px;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
.wpstg-sidebar{
|
213 |
+
display: none;
|
214 |
+
padding: 10px;
|
215 |
+
border: 1px solid #DFDFDF;
|
216 |
+
max-width: 250px;
|
217 |
+
height: 250px;
|
218 |
+
}
|
219 |
+
|
220 |
+
#wpstg-steps {
|
221 |
+
margin-top:30px;
|
222 |
+
}
|
223 |
+
|
224 |
+
#wpstg-steps li {
|
225 |
+
color: #444;
|
226 |
+
line-height: 20px;
|
227 |
+
padding-right:10px;
|
228 |
+
float:left;
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
.wpstg-step-num {
|
233 |
+
border: 1px solid #444;
|
234 |
+
border-radius: 3px;
|
235 |
+
display: inline-block;
|
236 |
+
width: 20px;
|
237 |
+
height: 20px;
|
238 |
+
text-align: center;
|
239 |
+
margin-right: 5px;
|
240 |
+
}
|
241 |
+
|
242 |
+
.wpstg-current-step {
|
243 |
+
font-weight: bold;
|
244 |
+
}
|
245 |
+
|
246 |
+
.wpstg-current-step .wpstg-step-num {
|
247 |
+
background: #444;
|
248 |
+
color: #eee;
|
249 |
+
}
|
250 |
+
|
251 |
+
.wpstg-clone {
|
252 |
+
border: 3px solid #ffffff;
|
253 |
+
margin-bottom: 5px;
|
254 |
+
padding: 5px 10px;
|
255 |
+
width: 300px;
|
256 |
+
position: relative;
|
257 |
+
overflow: hidden;
|
258 |
+
transition: border-color .2s ease-in-out;
|
259 |
+
background-color: #DDDDDD;
|
260 |
+
}
|
261 |
+
|
262 |
+
.wpstg-clone.active {
|
263 |
+
border-color: #1d94cf;;
|
264 |
+
}
|
265 |
+
|
266 |
+
.wpstg-clone-title {
|
267 |
+
display: inline-block;
|
268 |
+
font-size: 15px;
|
269 |
+
max-width: 130px;
|
270 |
+
text-decoration: none;
|
271 |
+
font-weight: bold;
|
272 |
+
color:#0285AE;
|
273 |
+
}
|
274 |
+
|
275 |
+
.wpstg-clone-action {
|
276 |
+
background: #ffffff;
|
277 |
+
border-left: 1px solid #ccc;
|
278 |
+
color: #bbb;
|
279 |
+
display: none;
|
280 |
+
padding: 0 5px;
|
281 |
+
float: right;
|
282 |
+
text-decoration: none;
|
283 |
+
position: relative;
|
284 |
+
transition: color .2s ease-in-out;
|
285 |
+
}
|
286 |
+
|
287 |
+
.wpstg-remove-clone:hover {
|
288 |
+
color: #ef6d6d;
|
289 |
+
}
|
290 |
+
|
291 |
+
.wpstg-clone-action:last-child {
|
292 |
+
border: none;
|
293 |
+
}
|
294 |
+
|
295 |
+
.wpstg-clone:hover .wpstg-clone-action {
|
296 |
+
display: inline-block;
|
297 |
+
}
|
298 |
+
|
299 |
+
#wpstg-show-error-details:focus,
|
300 |
+
#wpstg-workflow .wpstg-clone-action {
|
301 |
+
outline: none;
|
302 |
+
box-shadow: none;
|
303 |
+
}
|
304 |
+
|
305 |
+
.wpstg-link-btn {
|
306 |
+
background: #45a1c9;
|
307 |
+
color: #fff;
|
308 |
+
display: inline-block;
|
309 |
+
padding: 5px 10px;
|
310 |
+
text-decoration: none;
|
311 |
+
vertical-align: baseline;
|
312 |
+
transition: all .2s ease-in-out;
|
313 |
+
}
|
314 |
+
|
315 |
+
.wpstg-link-btn:hover,
|
316 |
+
.wpstg-link-btn:focus {
|
317 |
+
color: #fff;
|
318 |
+
outline: none;
|
319 |
+
box-shadow: none;
|
320 |
+
}
|
321 |
+
|
322 |
+
#wpstg-workflow .wpstg-link-btn:active {
|
323 |
+
vertical-align: baseline;
|
324 |
+
}
|
325 |
+
|
326 |
+
.wpstg-link-btn[disabled] {
|
327 |
+
background: #777 !important;
|
328 |
+
pointer-events: none;
|
329 |
+
}
|
330 |
+
|
331 |
+
#wpstg-cancel-cloning {
|
332 |
+
background: #ff3428;
|
333 |
+
border-color: #e72f24;
|
334 |
+
margin-top: 5px;
|
335 |
+
}
|
336 |
+
|
337 |
+
#wpstg-cancel-cloning.success {
|
338 |
+
background: #64dd58;
|
339 |
+
border-color: #54bd4a;
|
340 |
+
}
|
341 |
+
|
342 |
+
#wpstg-error-wrapper,
|
343 |
+
#wpstg-error-details {
|
344 |
+
display: none;
|
345 |
+
margin-top: 10px;
|
346 |
+
font-size: 13px;
|
347 |
+
}
|
348 |
+
|
349 |
+
#wpstg-show-error-details {
|
350 |
+
display: inline-block;
|
351 |
+
margin-left: 5px;
|
352 |
+
color: #555;
|
353 |
+
text-decoration: none;
|
354 |
+
transition: color .2s ease-in-out;
|
355 |
+
}
|
356 |
+
|
357 |
+
#wpstg-show-error-details:hover {
|
358 |
+
color: #1d94cf;
|
359 |
+
}
|
360 |
+
|
361 |
+
#wpstg-error-details {
|
362 |
+
border-left: 5px solid #ef6d6d;
|
363 |
+
padding: 10px;
|
364 |
+
width: 500px;
|
365 |
+
}
|
366 |
+
|
367 |
+
#wpstg-home-link,
|
368 |
+
#wpstg-try-again {
|
369 |
+
display: none;
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
#wpstg-loader {
|
374 |
+
content: url('../images/loading.gif');
|
375 |
+
margin-top:-5px;
|
376 |
+
}
|
377 |
+
|
378 |
+
#wpstg-workflow {
|
379 |
+
position: relative;
|
380 |
+
clear:both;
|
381 |
+
padding-top:20px;
|
382 |
+
margin-right:20px;
|
383 |
+
}
|
384 |
+
|
385 |
+
#wpstg-workflow.loading::after,
|
386 |
+
#wpstg-removing-clone.loading::after {
|
387 |
+
background: rgba(255, 255, 255, .7);
|
388 |
+
content: 'LOADING May take little bit longer for large sites... ';
|
389 |
+
display: block;
|
390 |
+
width: 100%;
|
391 |
+
height: 100%;
|
392 |
+
font-size: 20px;
|
393 |
+
padding-top: 100px;
|
394 |
+
text-align: center;
|
395 |
+
position: absolute;
|
396 |
+
top: 0;
|
397 |
+
left: 0;
|
398 |
+
z-index: 99;
|
399 |
+
}
|
400 |
+
|
401 |
+
#wpstg-removing-clone.loading::after {
|
402 |
+
content: 'REMOVING' !important;
|
403 |
+
}
|
404 |
+
|
405 |
+
#wpstg-existing-clones,
|
406 |
+
#wpstg-removing-clone {
|
407 |
+
position: relative;
|
408 |
+
}
|
409 |
+
|
410 |
+
.wpstg-progress-bar {
|
411 |
+
max-width: 900px;
|
412 |
+
height: 27px;
|
413 |
+
padding: 0px;
|
414 |
+
background-color: #d6d8d7;
|
415 |
+
}
|
416 |
+
|
417 |
+
.wpstg-progress {
|
418 |
+
background: #1d94cf;
|
419 |
+
width: 0;
|
420 |
+
height: 100%;
|
421 |
+
transition: width 1s;
|
422 |
+
color:white;
|
423 |
+
line-height:25px;
|
424 |
+
text-align:center;
|
425 |
+
}
|
426 |
+
|
427 |
+
#wpstg-new-clone-id.wpstg-error-input,
|
428 |
+
#wpstg-clone-path.wpstg-error-input {
|
429 |
+
border: 1px solid #ff4235;
|
430 |
+
box-shadow: 0 0 2px rgba(255, 66, 53, .8);
|
431 |
+
}
|
432 |
+
|
433 |
+
#wpstg-clone-path {
|
434 |
+
margin-left: 10px;
|
435 |
+
width: 350px;
|
436 |
+
}
|
437 |
+
|
438 |
+
.wpstg-error-msg {
|
439 |
+
color: #ff4235;
|
440 |
+
}
|
441 |
+
|
442 |
+
#wpstg-start-cloning + .wpstg-error-msg {
|
443 |
+
display: block;
|
444 |
+
margin-top: 5px;
|
445 |
+
}
|
446 |
+
|
447 |
+
.wpstg-size-info {
|
448 |
+
color: #999;
|
449 |
+
font-weight: normal;
|
450 |
+
position: relative;
|
451 |
+
left: 2px;
|
452 |
+
}
|
453 |
+
|
454 |
+
.wpstg-db-table .wpstg-size-info {
|
455 |
+
top: 2px;
|
456 |
+
}
|
457 |
+
|
458 |
+
#wpstg-workflow #wpstg-start-cloning {
|
459 |
+
display: inline-block;
|
460 |
+
margin-left: 5px;
|
461 |
+
font-size: 14px;
|
462 |
+
vertical-align: baseline;
|
463 |
+
}
|
464 |
+
|
465 |
+
/* Tabs */
|
466 |
+
.wpstg-tabs-wrapper {
|
467 |
+
max-width: 640px;
|
468 |
+
margin: 10px 0;
|
469 |
+
}
|
470 |
+
|
471 |
+
#wpstg-path-wrapper {
|
472 |
+
border-bottom: 2px dashed #ccc;
|
473 |
+
padding-bottom: 10px;
|
474 |
+
margin-bottom: 10px;
|
475 |
+
}
|
476 |
+
|
477 |
+
.wpstg-tabs-wrapper {
|
478 |
+
border: 1px solid #ddd;
|
479 |
+
border-right: none;
|
480 |
+
border-left: none;
|
481 |
+
}
|
482 |
+
|
483 |
+
.wpstg-tab-section {
|
484 |
+
border: 1px solid #ddd;
|
485 |
+
border-right: none;
|
486 |
+
border-left: none;
|
487 |
+
display: none;
|
488 |
+
padding: 20px;
|
489 |
+
}
|
490 |
+
|
491 |
+
.wpstg-tab-section::after {
|
492 |
+
display: block;
|
493 |
+
content: '';
|
494 |
+
clear: both;
|
495 |
+
}
|
496 |
+
|
497 |
+
.wpstg-tab-header {
|
498 |
+
border: 1px solid #ddd;
|
499 |
+
border-right: none;
|
500 |
+
border-left: none;
|
501 |
+
color: #444;
|
502 |
+
font-size: 16px;
|
503 |
+
font-weight: bolder;
|
504 |
+
display: block;
|
505 |
+
padding: 10px;;
|
506 |
+
text-decoration: none;
|
507 |
+
}
|
508 |
+
|
509 |
+
.wpstg-tab-triangle {
|
510 |
+
display: inline-block;
|
511 |
+
margin-right: 10px;
|
512 |
+
}
|
513 |
+
|
514 |
+
.wpstg-tab-header:focus {
|
515 |
+
color: #444;
|
516 |
+
outline: none;
|
517 |
+
box-shadow: none;
|
518 |
+
}
|
519 |
+
|
520 |
+
#wpstg-large-files {
|
521 |
+
display:none;
|
522 |
+
border: 1px dashed #ccc;
|
523 |
+
/*float: right;*/
|
524 |
+
padding: 10px 10px 10px;
|
525 |
+
margin-top:20px;
|
526 |
+
position: relative;
|
527 |
+
font-size:12px;
|
528 |
+
}
|
529 |
+
|
530 |
+
#wpstg-large-files h3 {
|
531 |
+
background: #fff;
|
532 |
+
margin: 0;
|
533 |
+
padding: 0 5px;
|
534 |
+
position: absolute;
|
535 |
+
top: -10px;
|
536 |
+
left: 5px;
|
537 |
+
}
|
538 |
+
|
539 |
+
/* tmp */
|
540 |
+
.wpstg-subdir {
|
541 |
+
display: none;
|
542 |
+
margin-left: 20px;
|
543 |
+
}
|
544 |
+
|
545 |
+
.wpstg-dir a.disabled {
|
546 |
+
color: #888;
|
547 |
+
cursor: default;
|
548 |
+
text-decoration: none;
|
549 |
+
}
|
550 |
+
|
551 |
+
.wpstg-check-subdirs {
|
552 |
+
display: inline-block;
|
553 |
+
margin-left: 10px;
|
554 |
+
}
|
555 |
+
|
556 |
+
.wpstg-notice-alert{
|
557 |
+
display:block;
|
558 |
+
background-color:#FFD0D0;
|
559 |
+
padding:20px;
|
560 |
+
border: 1px solid #fff;
|
561 |
+
max-width: 600px;
|
562 |
+
}
|
563 |
+
|
564 |
+
.wpstg-header{
|
565 |
+
font-weight: 400;
|
566 |
+
line-height: 1.6em;
|
567 |
+
font-size: 19px;
|
568 |
+
border-bottom: 1px solid #DFDFDF;
|
569 |
+
clear:both;
|
570 |
+
}
|
571 |
+
|
572 |
+
|
573 |
+
#wpstg-clone-label{
|
574 |
+
font-size: 14px;
|
575 |
+
font-weight: bold;
|
576 |
+
}
|
577 |
+
|
578 |
+
#wpstg-log-details{
|
579 |
+
display:none;
|
580 |
+
height: 300px;
|
581 |
+
overflow: scroll;
|
582 |
+
max-width: 500px;
|
583 |
+
font-size: 11px;
|
584 |
+
border: 1px solid #FFF;
|
585 |
+
background-color: black;
|
586 |
+
color: white;
|
587 |
+
padding:10px;
|
588 |
+
}
|
589 |
+
|
590 |
+
#wpstg-finished-result {
|
591 |
+
display:none;
|
592 |
+
}
|
593 |
+
|
594 |
+
#wpstg-remove-cloning {
|
595 |
+
background: #ff3428;
|
596 |
+
border-color: #e72f24;
|
597 |
+
margin-top: 5px;
|
598 |
+
}
|
599 |
+
|
600 |
+
#wpstg-success-notice{
|
601 |
+
padding: 10px;
|
602 |
+
background-color: white;
|
603 |
+
max-width: 900px;
|
604 |
+
border: 1px solid #ccc;
|
605 |
+
margin-top: 20px;
|
606 |
+
}
|
607 |
+
|
608 |
+
.wpstg_beta_notice {
|
609 |
+
margin-bottom:20px;
|
610 |
+
}
|
611 |
+
|
612 |
+
.wpstg-sysinfo {
|
613 |
+
width:400px;
|
614 |
+
height: 500px;
|
615 |
+
}
|
assets/js/wpstg-admin.js
CHANGED
@@ -11,8 +11,8 @@
|
|
11 |
|
12 |
// Cloning workflow
|
13 |
(function ($) {
|
14 |
-
|
15 |
-
|
16 |
// Unselect/select all db tables
|
17 |
var ischecked = true;
|
18 |
$('#wpstg-workflow').on("click", ".wpstg-button-unselect", function (e) {
|
@@ -27,7 +27,7 @@
|
|
27 |
ischecked = false;
|
28 |
}
|
29 |
});
|
30 |
-
|
31 |
// Ajax loading spinner
|
32 |
var admin_url = ajaxurl.replace('/admin-ajax.php', '');
|
33 |
var spinner_url = admin_url + '/images/spinner';
|
@@ -36,11 +36,11 @@
|
|
36 |
}
|
37 |
spinner_url += '.gif';
|
38 |
var ajax_spinner = '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />';
|
39 |
-
|
40 |
var doing_plugin_compatibility_ajax = false;
|
41 |
-
|
42 |
// Basic functions
|
43 |
-
|
44 |
/**
|
45 |
* Check if object is JSON valid
|
46 |
*
|
@@ -53,8 +53,8 @@
|
|
53 |
return true;
|
54 |
}
|
55 |
}
|
56 |
-
|
57 |
-
|
58 |
/**
|
59 |
* Check if given value is an integer
|
60 |
* This also casts strings as potential integers as well
|
@@ -65,736 +65,755 @@
|
|
65 |
parseInt(Number(value)) == value &&
|
66 |
!isNaN(parseInt(value, 10));
|
67 |
}
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
}
|
88 |
-
}).fail(function(xhr) { // Will be executed when $.post() fails
|
89 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is often caused by other plugins. Enable first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
90 |
-
console.log(xhr.statusText);
|
91 |
-
});
|
92 |
-
});
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Check cloning path
|
96 |
-
*/
|
97 |
-
$('#wpstg-workflow').on('keyup', '#wpstg-clone-path', function () {
|
98 |
-
var path = this.value;
|
99 |
-
if (path.length < 1) {
|
100 |
-
$('#wpstg-clone-path').removeClass('wpstg-error-input');
|
101 |
-
$('#wpstg-start-cloning').removeAttr('disabled');
|
102 |
-
$('#wpstg-path-error').text('');
|
103 |
-
return true;
|
104 |
-
}
|
105 |
-
|
106 |
-
var data = {
|
107 |
-
action: 'wpstg_check_path',
|
108 |
-
path: path
|
109 |
-
};
|
110 |
-
|
111 |
-
$.post(ajaxurl, data, function (resp, status, xhr) {
|
112 |
-
if (resp) {
|
113 |
-
$('#wpstg-clone-path').removeClass('wpstg-error-input');
|
114 |
-
$('#wpstg-start-cloning').removeAttr('disabled');
|
115 |
-
$('#wpstg-path-error').text('');
|
116 |
-
} else {
|
117 |
-
$('#wpstg-clone-path').addClass('wpstg-error-input');
|
118 |
-
$('#wpstg-start-cloning').attr('disabled', 'disabled');
|
119 |
-
$('#wpstg-path-error').text('Folder does not exist or is not writable!');
|
120 |
-
}
|
121 |
-
}).fail(function(xhr) { // Will be executed when $.post() fails
|
122 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
123 |
-
console.log(xhr.statusText);
|
124 |
-
});
|
125 |
-
});
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Edit profile
|
129 |
-
*/
|
130 |
-
$('#wpstg-workflow').on('click', '.wpstg-edit-clone', function (e) {
|
131 |
-
e.preventDefault();
|
132 |
-
|
133 |
-
var data = {
|
134 |
-
action: 'wpstg_edit_profile',
|
135 |
-
clone: $(this).data('clone'),
|
136 |
-
nonce: wpstg.nonce
|
137 |
-
};
|
138 |
-
$('#wpstg-workflow').load(ajaxurl, data);
|
139 |
-
});
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Save profile
|
143 |
-
*/
|
144 |
-
$('#wpstg-workflow').on('click', '#wpstg-save-profile', function (e) {
|
145 |
-
e.preventDefault();
|
146 |
-
|
147 |
-
var data = {
|
148 |
-
action: 'wpstg_save_profile',
|
149 |
-
cloneID: $(this).data('clone'),
|
150 |
-
nonce: wpstg.nonce,
|
151 |
-
dbCredentials: {
|
152 |
-
dbname: $('#wpstgdb-name').val(),
|
153 |
-
dbuser: $('#wpstgdb-user').val(),
|
154 |
-
dbpassword: $('#wpstgdb-password').val(),
|
155 |
-
dbhost: $('#wpstgdb-host').val()
|
156 |
-
}
|
157 |
-
};
|
158 |
-
wpstg_additional_data(data, false);
|
159 |
-
$.post(ajaxurl, data, function (resp, status, xhr) {
|
160 |
-
location.reload();
|
161 |
-
}).fail(function(xhr) { // Will be executed when $.post() fails
|
162 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
163 |
-
console.log(xhr.statusText);
|
164 |
-
});
|
165 |
-
});
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Next step
|
169 |
-
*/
|
170 |
-
$('#wpstg-workflow').on('click', '.wpstg-next-step-link', function (e) {
|
171 |
-
e.preventDefault();
|
172 |
-
if ($(this).attr('disabled'))
|
173 |
-
return false;
|
174 |
-
|
175 |
-
$('#wpstg-workflow').addClass('loading');
|
176 |
-
var data = {
|
177 |
-
action: $(this).data('action'),
|
178 |
-
nonce: wpstg.nonce
|
179 |
-
};
|
180 |
-
if (data.action == 'wpstg_cloning') {
|
181 |
-
data.cloneID = $('#wpstg-new-clone-id').val() || new Date().getTime();
|
182 |
-
wpstg_additional_data(data, false);
|
183 |
-
}
|
184 |
-
|
185 |
-
$('#wpstg-workflow').load(ajaxurl, data, function (response, status, xhr) {
|
186 |
-
if ( status == 'error') { //Unknown error
|
187 |
-
console.log(xhr.status + ' ' + xhr.statusText);
|
188 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: ' + xhr.status + ' ' + xhr.statusText);
|
189 |
-
}
|
190 |
-
$('#wpstg-workflow').removeClass('loading');
|
191 |
-
$('.wpstg-current-step').removeClass('wpstg-current-step')
|
192 |
-
.next('li').addClass('wpstg-current-step');
|
193 |
-
if (data.action == 'wpstg_cloning') {
|
194 |
-
clone_db();
|
195 |
-
}
|
196 |
-
});
|
197 |
-
});
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Previous step
|
201 |
-
*/
|
202 |
-
$('#wpstg-workflow').on('click', '.wpstg-prev-step-link', function (e) {
|
203 |
-
e.preventDefault();
|
204 |
-
$('#wpstg-workflow').addClass('loading');
|
205 |
-
var data = {
|
206 |
-
action: 'wpstg_overview',
|
207 |
-
nonce: wpstg.nonce
|
208 |
-
};
|
209 |
-
$('#wpstg-workflow').load(ajaxurl, data, function (response, status, xhr) {
|
210 |
-
if ( status == 'error') { //Unknown error
|
211 |
-
console.log(xhr.status + ' ' + xhr.statusText);
|
212 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: ' + xhr.status + ' ' + xhr.statusText);
|
213 |
-
}
|
214 |
-
$('#wpstg-workflow').removeClass('loading');
|
215 |
-
$('.wpstg-current-step').removeClass('wpstg-current-step')
|
216 |
-
.prev('li').addClass('wpstg-current-step');
|
217 |
-
});
|
218 |
-
});
|
219 |
-
|
220 |
-
var cloneID;
|
221 |
-
function wpstg_additional_data(data, isRemoving) {
|
222 |
-
data.uncheckedTables = [];
|
223 |
-
$('.wpstg-db-table input:not(:checked)').each(function () {
|
224 |
-
data.uncheckedTables.push(this.name);
|
225 |
-
});
|
226 |
-
data.excludedFolders = [];
|
227 |
-
$('.wpstg-dir input:not(:checked)').each(function () {
|
228 |
-
if (! $(this).parent('.wpstg-dir').parents('.wpstg-dir').children('.wpstg-expand-dirs').hasClass('disabled'))
|
229 |
-
data.excludedFolders.push(this.name);
|
230 |
-
});
|
231 |
-
|
232 |
-
cloneID = data.cloneID.toString();
|
233 |
-
}
|
234 |
-
|
235 |
-
/*
|
236 |
-
* Start scanning process
|
237 |
-
*/
|
238 |
-
$('#wpstg-workflow').on('click', '.wpstg-execute-clone', function (e) {
|
239 |
-
e.preventDefault();
|
240 |
-
$('#wpstg-workflow').addClass('loading');
|
241 |
-
var data = {
|
242 |
-
action: 'wpstg_scanning',
|
243 |
-
clone: $(this).data('clone'),
|
244 |
-
nonce: wpstg.nonce
|
245 |
-
};
|
246 |
-
|
247 |
-
$('#wpstg-workflow').load(ajaxurl, data, function (response, status, xhr) {
|
248 |
-
if ( status == 'error') { //Unknown error
|
249 |
-
console.log(xhr.status + ' ' + xhr.statusText);
|
250 |
-
wpstg_show_error_die('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ' + xhr.status + ' ' + xhr.statusText);
|
251 |
-
}
|
252 |
-
$('#wpstg-workflow').removeClass('loading');
|
253 |
-
$('.wpstg-current-step').removeClass('wpstg-current-step')
|
254 |
-
.next('li').addClass('wpstg-current-step');
|
255 |
-
});
|
256 |
-
});
|
257 |
-
|
258 |
-
$('#wpstg-workflow').on('click', '.wpstg-remove-clone', function (e) {
|
259 |
-
e.preventDefault();
|
260 |
-
$('.wpstg-clone').removeClass('active');
|
261 |
-
$( '#wpstg-existing-clones' ).append( ajax_spinner );
|
262 |
-
var data = {
|
263 |
-
action: 'wpstg_preremove',
|
264 |
-
cloneID: $(this).data('clone')
|
265 |
-
};
|
266 |
-
$('#wpstg-removing-clone').load(ajaxurl, data, function (resp, status, xhr){
|
267 |
-
if ( status == 'error') { //Unknown error
|
268 |
-
console.log(xhr.status + ' ' + xhr.statusText);
|
269 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
270 |
-
}
|
271 |
-
if (status === 'success'){
|
272 |
-
$('#wpstg-existing-clones').children("img").remove();
|
273 |
-
}
|
274 |
-
});
|
275 |
-
});
|
276 |
-
|
277 |
-
$('#wpstg-workflow').on('click', '#wpstg-cancel-removing', function (e) {
|
278 |
-
e.preventDefault();
|
279 |
-
$('.wpstg-clone').removeClass('active');
|
280 |
-
$('#wpstg-removing-clone').html('');
|
281 |
-
});
|
282 |
-
|
283 |
-
$('#wpstg-workflow').on('click', '#wpstg-remove-clone', function (e) {
|
284 |
-
e.preventDefault();
|
285 |
-
$('#wpstg-removing-clone').addClass('loading');
|
286 |
-
var cloneID = $(this).data('clone');
|
287 |
-
var data = {
|
288 |
-
action: 'wpstg_remove_clone',
|
289 |
-
cloneID: cloneID,
|
290 |
-
nonce: wpstg.nonce
|
291 |
-
};
|
292 |
-
|
293 |
-
wpstg_additional_data(data, true);
|
294 |
-
$.post(ajaxurl, data, function (resp, status, xhr) {
|
295 |
-
console.log(xhr.status + ' ' + xhr.statusText);
|
296 |
-
if ( status == 'error') { //Unknown error
|
297 |
-
console.log(xhr.status + ' ' + xhr.statusText);
|
298 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
299 |
-
}
|
300 |
-
if (resp == 0) {
|
301 |
-
$('#wpstg-removing-clone').html('');
|
302 |
-
$('.wpstg-clone#' + cloneID).remove();
|
303 |
-
$('#wpstg-removing-clone').removeClass('loading');
|
304 |
-
var remaining_clones = $('.wpstg-clone');
|
305 |
-
if (remaining_clones.length < 1)
|
306 |
-
$('#wpstg-existing-clones h3').text('');
|
307 |
-
}
|
308 |
-
}).fail(function(xhr) { // Will be executed when $.post() fails
|
309 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
310 |
-
console.log(xhr.statusText);
|
311 |
-
});
|
312 |
-
});
|
313 |
-
|
314 |
-
/**
|
315 |
-
* Show error message and die()
|
316 |
-
* Writes error message into log file
|
317 |
-
*
|
318 |
-
* @param {string} $error notice
|
319 |
-
* @returns void
|
320 |
-
*/
|
321 |
-
function wpstg_show_error_die(error) {
|
322 |
-
$('#wpstg-try-again').css('display', 'inline-block');
|
323 |
-
$('#wpstg-cancel-cloning').text('Reset');
|
324 |
-
$('#wpstg-cloning-result').text('Fail');
|
325 |
-
$('#wpstg-error-wrapper').show();
|
326 |
-
$('#wpstg-error-details').show();
|
327 |
-
$('#wpstg-error-details').html(error);
|
328 |
-
$('#wpstg-loader').hide();
|
329 |
-
isFinished = true; // die cloning process
|
330 |
-
console.log(error);
|
331 |
-
var add_error = ' Fatal Error: This should not happen! Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not fix it enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out what is causing this.';
|
332 |
-
var data = {
|
333 |
-
action: 'wpstg_error_processing',
|
334 |
-
wpstg_error_msg: error + add_error
|
335 |
-
};
|
336 |
-
$.post(ajaxurl, data);
|
337 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
wpstg_show_error_die(xhr.statusText);
|
383 |
console.log('Fatal Error: This should not happen but is often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
384 |
-
});
|
385 |
-
},wpstg.cpu_load); // timeout of x sec - prevent security blocks and cpu overload
|
386 |
-
}
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
function copy_files() {
|
392 |
-
setTimeout(function(){ // timeout of x sec - prevent security blocks and cpu overload
|
393 |
-
var data = {
|
394 |
-
action: 'wpstg_copy_files',
|
395 |
-
nonce: wpstg.nonce
|
396 |
-
};
|
397 |
-
$.post(ajaxurl, data, function(resp, status, xhr) {
|
398 |
-
if (isCanceled) {
|
399 |
-
cancelCloning();
|
400 |
-
return false;
|
401 |
-
}
|
402 |
-
|
403 |
-
if (!wpstgIsJsonObj(resp)) { //Unknown error
|
404 |
-
wpstg_show_error_die('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ');
|
405 |
-
} else if (resp.percent < 0) { //Fail
|
406 |
-
wpstg_show_error_die('Fatal Error: This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '. xhr.statusText);
|
407 |
-
} else if (resp.percent < 1) { //Continue copying
|
408 |
-
var complete = Math.floor(resp.percent * 100) + '%';
|
409 |
-
$('#wpstg-files-progress').text(complete).css('width', complete);
|
410 |
-
$('#wpstg-loader').show();
|
411 |
-
if (resp.message !== '')
|
412 |
-
$('#wpstg-log-details').append(resp.message + '<br>');
|
413 |
-
wpstg_logscroll_bottom();
|
414 |
-
copy_files();
|
415 |
-
} else { //Success copying
|
416 |
-
$('#wpstg-files-progress').text('').css('width', '100%');
|
417 |
-
wpstg_logscroll_bottom();
|
418 |
-
replace_links();
|
419 |
-
}
|
420 |
-
}).fail(function(xhr) { // Will be executed when $.post() fails
|
421 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
422 |
-
console.log(xhr.statusText);
|
423 |
-
});
|
424 |
-
},wpstg.cpu_load); // timeout of x sec - prevent security blocks and cpu overload
|
425 |
-
}
|
426 |
-
|
427 |
-
var isFinished = false;
|
428 |
-
function replace_links() {
|
429 |
-
var data = {
|
430 |
-
action: 'wpstg_replace_links',
|
431 |
-
nonce: wpstg.nonce
|
432 |
-
};
|
433 |
-
$.post(ajaxurl, data, function(resp, status, xhr) {
|
434 |
-
if (isCanceled) {
|
435 |
-
cancelCloning();
|
436 |
-
return false;
|
437 |
-
}
|
438 |
-
|
439 |
-
if (!wpstgIsJsonObj(resp)) { //Unknown error
|
440 |
-
wpstg_show_error_die('Fatal Error code: 1001. This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ');
|
441 |
-
} else if (resp.percent < 0) { //Fail
|
442 |
-
wpstg_show_error_die('Fatal Error code: 1002. This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ' . xhr.statusText);
|
443 |
-
} else if (resp.percent < 1) { //Continue replacing string
|
444 |
-
var complete = Math.floor(resp.percent * 100) + '%';
|
445 |
-
$('#wpstg-links-progress').text('').css('width', complete);
|
446 |
-
$('#wpstg-loader').show();
|
447 |
-
if (resp.message !== '')
|
448 |
-
$('#wpstg-log-details').append(resp.message + '<br>');
|
449 |
-
wpstg_logscroll_bottom();
|
450 |
-
replace_links();
|
451 |
-
} else { //Success
|
452 |
-
$('#wpstg-links-progress').text('').css('width', '100%');
|
453 |
-
$('#wpstg-loader').hide();
|
454 |
-
wpstg_logscroll_bottom();
|
455 |
-
cloneID = cloneID.replace(/[^A-Za-z0-9]/g, '');
|
456 |
-
var redirectURL = $('#wpstg-clone-url').attr('href') + '/' + cloneID + '/';
|
457 |
-
setTimeout(function () {
|
458 |
-
$('#wpstg-finished-result').show();
|
459 |
-
$('#wpstg-clone-url').text('Visit staging site <span style="font-size: 10px;">(login with your admin credentials)</span>' . cloneID).attr('href', redirectURL );
|
460 |
-
$('#wpstg_staging_name').text(cloneID);
|
461 |
-
$('#wpstg-cancel-cloning').hide();
|
462 |
-
$('#wpstg-home-link').css('display', 'inline-block');
|
463 |
-
isFinished = true;
|
464 |
-
}, 1200);
|
465 |
-
if (resp.message !== '')
|
466 |
-
$('#wpstg-log-details').append(resp.message + '<br>');
|
467 |
-
wpstg_logscroll_bottom();
|
468 |
-
}
|
469 |
-
|
470 |
-
}).fail(function(xhr) { // Will be executed when $.post() fails
|
471 |
-
wpstg_show_error_die('Fatal Error: This should not happen but is sometimes caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
472 |
-
console.log(xhr.statusText);
|
473 |
});
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
495 |
}
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
$('#wpstg-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
});
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
if ( $( '#plugin-compatibility' ).is( ':checked' ) ) {
|
693 |
-
$( '.plugin-compatibility-wrap' ).show();
|
694 |
-
}
|
695 |
-
$( '.plugin-compatibility-save' ).click( function() {
|
696 |
-
if ( doing_plugin_compatibility_ajax ) {
|
697 |
-
return;
|
698 |
-
}
|
699 |
-
$( this ).addClass( 'disabled' );
|
700 |
-
var select_element = $( '#selected-plugins' );
|
701 |
-
$( select_element ).attr( 'disabled', 'disabled' );
|
702 |
-
var query_limit = $( '#wpstg_settings\\[wpstg_query_limit\\]' );
|
703 |
-
var batch_size = $( '#wpstg_settings\\[wpstg_batch_size\\]' );
|
704 |
-
var disable_admin_login = $( '#wpstg_settings\\[disable_admin_login\\]' );
|
705 |
-
var uninstall_on_delete = $( '#wpstg_settings\\[uninstall_on_delete\\]' );
|
706 |
-
disable_admin_login = $( disable_admin_login ).prop('checked') ? '1' : '0';
|
707 |
-
uninstall_on_delete = $( uninstall_on_delete ).prop('checked') ? '1' : '0';
|
708 |
-
|
709 |
-
doing_plugin_compatibility_ajax = true;
|
710 |
-
$( this ).after( '<img src="' + spinner_url + '" alt="" class="plugin-compatibility-spinner general-spinner" />' );
|
711 |
-
|
712 |
-
$.ajax( {
|
713 |
-
url: ajaxurl,
|
714 |
-
type: 'POST',
|
715 |
-
dataType: 'text',
|
716 |
-
cache: false,
|
717 |
-
data: {
|
718 |
-
action: 'wpstg_disable_plugins',
|
719 |
-
blacklist_plugins: $( select_element ).val(),
|
720 |
-
query_limit: $( query_limit ).val(),
|
721 |
-
batch_size: $( batch_size ).val(),
|
722 |
-
disable_admin_login: disable_admin_login,
|
723 |
-
uninstall_on_delete: uninstall_on_delete,
|
724 |
-
|
725 |
-
},
|
726 |
-
error: function( jqXHR, textStatus, errorThrown ) {
|
727 |
-
alert( wpstg.blacklist_problem + '\r\n\r\n' + wpstg.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpstg.response + '\r\n' + jqXHR.responseText );
|
728 |
-
$( select_element ).removeAttr( 'disabled' );
|
729 |
-
$( '.plugin-compatibility-save' ).removeClass( 'disabled' );
|
730 |
-
doing_plugin_compatibility_ajax = false;
|
731 |
-
$( '.plugin-compatibility-spinner' ).remove();
|
732 |
-
$( '.plugin-compatibility-success-msg' ).show().fadeOut( 2000 );
|
733 |
-
},
|
734 |
-
success: function( data ) {
|
735 |
-
if ( '' !== $.trim( data ) ) {
|
736 |
-
alert( data );
|
737 |
-
}
|
738 |
-
$( select_element ).removeAttr( 'disabled' );
|
739 |
-
$( '.plugin-compatibility-save' ).removeClass( 'disabled' );
|
740 |
-
doing_plugin_compatibility_ajax = false;
|
741 |
-
$( '.plugin-compatibility-spinner' ).remove();
|
742 |
-
$( '.plugin-compatibility-success-msg' ).show().fadeOut( 2000 );
|
743 |
-
}
|
744 |
-
} );
|
745 |
-
} );
|
746 |
-
|
747 |
-
// select all tables
|
748 |
-
$( '.multiselect-select-all' ).click( function() {
|
749 |
-
var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
|
750 |
-
$( 'option', multiselect ).attr( 'selected', 1 );
|
751 |
-
$( multiselect ).focus().trigger( 'change' );
|
752 |
-
} );
|
753 |
-
|
754 |
-
// deselect all tables
|
755 |
-
$( '.multiselect-deselect-all' ).click( function() {
|
756 |
-
var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
|
757 |
-
$( 'option', multiselect ).removeAttr( 'selected' );
|
758 |
-
$( multiselect ).focus().trigger( 'change' );
|
759 |
-
} );
|
760 |
-
|
761 |
-
// invert table selection
|
762 |
-
$( '.multiselect-invert-selection' ).click( function() {
|
763 |
-
var multiselect = $( this ).parents( '.select-wrap' ).children( '.multiselect' );
|
764 |
-
$( 'option', multiselect ).each( function() {
|
765 |
-
$( this ).attr( 'selected', !$( this ).attr( 'selected' ) );
|
766 |
-
} );
|
767 |
-
$( multiselect ).focus().trigger( 'change' );
|
768 |
-
} );
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
// Show large files
|
773 |
-
$('#wpstg-workflow').on('click', '#wpstg-show-large-files', function (e) {
|
774 |
-
e.preventDefault();
|
775 |
-
//$('#wpstg-show-large-files').on('click', ) click(function(){
|
776 |
-
$('#wpstg-large-files').toggle();
|
777 |
-
});
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
});
|
782 |
})(jQuery);
|
783 |
|
784 |
// Load twitter button async
|
785 |
-
window.twttr = (function(d, s, id) {
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
t.
|
797 |
-
|
798 |
-
|
799 |
-
|
|
|
800 |
}(document, "script", "twitter-wjs"));
|
11 |
|
12 |
// Cloning workflow
|
13 |
(function ($) {
|
14 |
+
$(document).ready(function () {
|
15 |
+
|
16 |
// Unselect/select all db tables
|
17 |
var ischecked = true;
|
18 |
$('#wpstg-workflow').on("click", ".wpstg-button-unselect", function (e) {
|
27 |
ischecked = false;
|
28 |
}
|
29 |
});
|
30 |
+
|
31 |
// Ajax loading spinner
|
32 |
var admin_url = ajaxurl.replace('/admin-ajax.php', '');
|
33 |
var spinner_url = admin_url + '/images/spinner';
|
36 |
}
|
37 |
spinner_url += '.gif';
|
38 |
var ajax_spinner = '<img src="' + spinner_url + '" alt="" class="ajax-spinner general-spinner" />';
|
39 |
+
|
40 |
var doing_plugin_compatibility_ajax = false;
|
41 |
+
|
42 |
// Basic functions
|
43 |
+
|
44 |
/**
|
45 |
* Check if object is JSON valid
|
46 |
*
|
53 |
return true;
|
54 |
}
|
55 |
}
|
56 |
+
|
57 |
+
|
58 |
/**
|
59 |
* Check if given value is an integer
|
60 |
* This also casts strings as potential integers as well
|
65 |
parseInt(Number(value)) == value &&
|
66 |
!isNaN(parseInt(value, 10));
|
67 |
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Do some checks first for the clone name.
|
71 |
+
* Check the max length of string and if clone name already exists
|
72 |
+
*/
|
73 |
+
$('#wpstg-workflow').on('keyup', '#wpstg-new-clone-id', function () {
|
74 |
+
var data = {
|
75 |
+
action: 'wpstg_check_clone',
|
76 |
+
cloneID: this.value
|
77 |
+
};
|
78 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
79 |
+
if (resp.status !== "fail") {
|
80 |
+
$('#wpstg-new-clone-id').removeClass('wpstg-error-input');
|
81 |
+
$('#wpstg-start-cloning').removeAttr('disabled');
|
82 |
+
$('#wpstg-clone-id-error').text(resp.message);
|
83 |
+
} else {
|
84 |
+
$('#wpstg-new-clone-id').addClass('wpstg-error-input');
|
85 |
+
$('#wpstg-start-cloning').attr('disabled', 'disabled');
|
86 |
+
$('#wpstg-clone-id-error').text(resp.message);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
89 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is often caused by other plugins. Enable first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
90 |
+
console.log(xhr.statusText);
|
91 |
+
});
|
92 |
+
});
|
93 |
+
|
94 |
+
/*
|
95 |
+
* Opens the Sync Data settings (pro version only)
|
96 |
+
*/
|
97 |
+
$('#wpstg-workflow').on('click', '.wpstg-sync-settings', function (e) {
|
98 |
+
e.preventDefault();
|
99 |
|
100 |
+
var data = {
|
101 |
+
action: 'render_settings_page',
|
102 |
+
clone: $(this).data('clone'),
|
103 |
+
nonce: wpstg.nonce
|
104 |
+
};
|
105 |
+
$('#wpstg-workflow').load(ajaxurl, data);
|
106 |
+
})
|
107 |
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Check cloning path
|
111 |
+
*/
|
112 |
+
$('#wpstg-workflow').on('keyup', '#wpstg-clone-path', function () {
|
113 |
+
var path = this.value;
|
114 |
+
if (path.length < 1) {
|
115 |
+
$('#wpstg-clone-path').removeClass('wpstg-error-input');
|
116 |
+
$('#wpstg-start-cloning').removeAttr('disabled');
|
117 |
+
$('#wpstg-path-error').text('');
|
118 |
+
return true;
|
119 |
+
}
|
120 |
+
|
121 |
+
var data = {
|
122 |
+
action: 'wpstg_check_path',
|
123 |
+
path: path
|
124 |
+
};
|
125 |
+
|
126 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
127 |
+
if (resp) {
|
128 |
+
$('#wpstg-clone-path').removeClass('wpstg-error-input');
|
129 |
+
$('#wpstg-start-cloning').removeAttr('disabled');
|
130 |
+
$('#wpstg-path-error').text('');
|
131 |
+
} else {
|
132 |
+
$('#wpstg-clone-path').addClass('wpstg-error-input');
|
133 |
+
$('#wpstg-start-cloning').attr('disabled', 'disabled');
|
134 |
+
$('#wpstg-path-error').text('Folder does not exist or is not writable!');
|
135 |
+
}
|
136 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
137 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
138 |
+
console.log(xhr.statusText);
|
139 |
+
});
|
140 |
+
});
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Edit profile
|
144 |
+
*/
|
145 |
+
$('#wpstg-workflow').on('click', '.wpstg-edit-clone', function (e) {
|
146 |
+
e.preventDefault();
|
147 |
+
|
148 |
+
var data = {
|
149 |
+
action: 'wpstg_edit_profile',
|
150 |
+
clone: $(this).data('clone'),
|
151 |
+
nonce: wpstg.nonce
|
152 |
+
};
|
153 |
+
$('#wpstg-workflow').load(ajaxurl, data);
|
154 |
+
});
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Save profile
|
158 |
+
*/
|
159 |
+
$('#wpstg-workflow').on('click', '#wpstg-save-profile', function (e) {
|
160 |
+
e.preventDefault();
|
161 |
+
|
162 |
+
var data = {
|
163 |
+
action: 'wpstg_save_profile',
|
164 |
+
cloneID: $(this).data('clone'),
|
165 |
+
nonce: wpstg.nonce,
|
166 |
+
dbCredentials: {
|
167 |
+
dbname: $('#wpstgdb-name').val(),
|
168 |
+
dbuser: $('#wpstgdb-user').val(),
|
169 |
+
dbpassword: $('#wpstgdb-password').val(),
|
170 |
+
dbhost: $('#wpstgdb-host').val()
|
171 |
+
}
|
172 |
+
};
|
173 |
+
wpstg_additional_data(data, false);
|
174 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
175 |
+
location.reload();
|
176 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
177 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
178 |
+
console.log(xhr.statusText);
|
179 |
+
});
|
180 |
+
});
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Next step
|
184 |
+
*/
|
185 |
+
$('#wpstg-workflow').on('click', '.wpstg-next-step-link', function (e) {
|
186 |
+
e.preventDefault();
|
187 |
+
if ($(this).attr('disabled'))
|
188 |
+
return false;
|
189 |
+
|
190 |
+
$('#wpstg-workflow').addClass('loading');
|
191 |
+
var data = {
|
192 |
+
action: $(this).data('action'),
|
193 |
+
nonce: wpstg.nonce
|
194 |
+
};
|
195 |
+
if (data.action == 'wpstg_cloning') {
|
196 |
+
data.cloneID = $('#wpstg-new-clone-id').val() || new Date().getTime();
|
197 |
+
wpstg_additional_data(data, false);
|
198 |
+
}
|
199 |
+
|
200 |
+
$('#wpstg-workflow').load(ajaxurl, data, function (response, status, xhr) {
|
201 |
+
if (status == 'error') { //Unknown error
|
202 |
+
console.log(xhr.status + ' ' + xhr.statusText);
|
203 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: ' + xhr.status + ' ' + xhr.statusText);
|
204 |
+
}
|
205 |
+
$('#wpstg-workflow').removeClass('loading');
|
206 |
+
$('.wpstg-current-step').removeClass('wpstg-current-step')
|
207 |
+
.next('li').addClass('wpstg-current-step');
|
208 |
+
if (data.action == 'wpstg_cloning') {
|
209 |
+
clone_db();
|
210 |
+
}
|
211 |
+
});
|
212 |
+
});
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Previous step
|
216 |
+
*/
|
217 |
+
$('#wpstg-workflow').on('click', '.wpstg-prev-step-link', function (e) {
|
218 |
+
e.preventDefault();
|
219 |
+
$('#wpstg-workflow').addClass('loading');
|
220 |
+
var data = {
|
221 |
+
action: 'wpstg_overview',
|
222 |
+
nonce: wpstg.nonce
|
223 |
+
};
|
224 |
+
$('#wpstg-workflow').load(ajaxurl, data, function (response, status, xhr) {
|
225 |
+
if (status == 'error') { //Unknown error
|
226 |
+
console.log(xhr.status + ' ' + xhr.statusText);
|
227 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: ' + xhr.status + ' ' + xhr.statusText);
|
228 |
+
}
|
229 |
+
$('#wpstg-workflow').removeClass('loading');
|
230 |
+
$('.wpstg-current-step').removeClass('wpstg-current-step')
|
231 |
+
.prev('li').addClass('wpstg-current-step');
|
232 |
+
});
|
233 |
+
});
|
234 |
+
|
235 |
+
var cloneID;
|
236 |
+
function wpstg_additional_data(data, isRemoving) {
|
237 |
+
data.uncheckedTables = [];
|
238 |
+
$('.wpstg-db-table input:not(:checked)').each(function () {
|
239 |
+
data.uncheckedTables.push(this.name);
|
240 |
+
});
|
241 |
+
data.excludedFolders = [];
|
242 |
+
$('.wpstg-dir input:not(:checked)').each(function () {
|
243 |
+
if (!$(this).parent('.wpstg-dir').parents('.wpstg-dir').children('.wpstg-expand-dirs').hasClass('disabled'))
|
244 |
+
data.excludedFolders.push(this.name);
|
245 |
+
});
|
246 |
+
|
247 |
+
cloneID = data.cloneID.toString();
|
248 |
+
}
|
249 |
+
|
250 |
+
/*
|
251 |
+
* Start scanning process
|
252 |
+
*/
|
253 |
+
$('#wpstg-workflow').on('click', '.wpstg-execute-clone', function (e) {
|
254 |
+
e.preventDefault();
|
255 |
+
$('#wpstg-workflow').addClass('loading');
|
256 |
+
var data = {
|
257 |
+
action: 'wpstg_scanning',
|
258 |
+
clone: $(this).data('clone'),
|
259 |
+
nonce: wpstg.nonce
|
260 |
+
};
|
261 |
+
|
262 |
+
$('#wpstg-workflow').load(ajaxurl, data, function (response, status, xhr) {
|
263 |
+
if (status == 'error') { //Unknown error
|
264 |
+
console.log(xhr.status + ' ' + xhr.statusText);
|
265 |
+
wpstg_show_error_die('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ' + xhr.status + ' ' + xhr.statusText);
|
266 |
+
}
|
267 |
+
$('#wpstg-workflow').removeClass('loading');
|
268 |
+
$('.wpstg-current-step').removeClass('wpstg-current-step')
|
269 |
+
.next('li').addClass('wpstg-current-step');
|
270 |
+
});
|
271 |
+
});
|
272 |
+
|
273 |
+
$('#wpstg-workflow').on('click', '.wpstg-remove-clone', function (e) {
|
274 |
+
e.preventDefault();
|
275 |
+
$('.wpstg-clone').removeClass('active');
|
276 |
+
$('#wpstg-existing-clones').append(ajax_spinner);
|
277 |
+
var data = {
|
278 |
+
action: 'wpstg_preremove',
|
279 |
+
cloneID: $(this).data('clone')
|
280 |
+
};
|
281 |
+
$('#wpstg-removing-clone').load(ajaxurl, data, function (resp, status, xhr) {
|
282 |
+
if (status == 'error') { //Unknown error
|
283 |
+
console.log(xhr.status + ' ' + xhr.statusText);
|
284 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
285 |
+
}
|
286 |
+
if (status === 'success') {
|
287 |
+
$('#wpstg-existing-clones').children("img").remove();
|
288 |
+
}
|
289 |
+
});
|
290 |
+
});
|
291 |
+
|
292 |
+
$('#wpstg-workflow').on('click', '#wpstg-cancel-removing', function (e) {
|
293 |
+
e.preventDefault();
|
294 |
+
$('.wpstg-clone').removeClass('active');
|
295 |
+
$('#wpstg-removing-clone').html('');
|
296 |
+
});
|
297 |
+
|
298 |
+
$('#wpstg-workflow').on('click', '#wpstg-remove-clone', function (e) {
|
299 |
+
e.preventDefault();
|
300 |
+
$('#wpstg-removing-clone').addClass('loading');
|
301 |
+
var cloneID = $(this).data('clone');
|
302 |
+
var data = {
|
303 |
+
action: 'wpstg_remove_clone',
|
304 |
+
cloneID: cloneID,
|
305 |
+
nonce: wpstg.nonce
|
306 |
+
};
|
307 |
+
|
308 |
+
wpstg_additional_data(data, true);
|
309 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
310 |
+
console.log(xhr.status + ' ' + xhr.statusText);
|
311 |
+
if (status == 'error') { //Unknown error
|
312 |
+
console.log(xhr.status + ' ' + xhr.statusText);
|
313 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
314 |
+
}
|
315 |
+
if (resp == 0) {
|
316 |
+
$('#wpstg-removing-clone').html('');
|
317 |
+
$('.wpstg-clone#' + cloneID).remove();
|
318 |
+
$('#wpstg-removing-clone').removeClass('loading');
|
319 |
+
var remaining_clones = $('.wpstg-clone');
|
320 |
+
if (remaining_clones.length < 1)
|
321 |
+
$('#wpstg-existing-clones h3').text('');
|
322 |
+
}
|
323 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
324 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
325 |
+
console.log(xhr.statusText);
|
326 |
+
});
|
327 |
+
});
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Show error message and die()
|
331 |
+
* Writes error message into log file
|
332 |
+
*
|
333 |
+
* @param {string} $error notice
|
334 |
+
* @returns void
|
335 |
+
*/
|
336 |
+
function wpstg_show_error_die(error) {
|
337 |
+
$('#wpstg-try-again').css('display', 'inline-block');
|
338 |
+
$('#wpstg-cancel-cloning').text('Reset');
|
339 |
+
$('#wpstg-cloning-result').text('Fail');
|
340 |
+
$('#wpstg-error-wrapper').show();
|
341 |
+
$('#wpstg-error-details').show();
|
342 |
+
$('#wpstg-error-details').html(error);
|
343 |
+
$('#wpstg-loader').hide();
|
344 |
+
isFinished = true; // die cloning process
|
345 |
+
console.log(error);
|
346 |
+
var add_error = ' Fatal Error: This should not happen! Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not fix it enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out what is causing this.';
|
347 |
+
var data = {
|
348 |
+
action: 'wpstg_error_processing',
|
349 |
+
wpstg_error_msg: error + add_error
|
350 |
+
};
|
351 |
+
$.post(ajaxurl, data);
|
352 |
+
}
|
353 |
+
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Clone database
|
357 |
+
*
|
358 |
+
* @return void
|
359 |
+
*/
|
360 |
+
var isCanceled = false;
|
361 |
+
function clone_db() {
|
362 |
+
|
363 |
+
setTimeout(function () { // timeout of x sec - prevent security blocks and cpu overload
|
364 |
+
$('#wpstg-loader').show();
|
365 |
+
var data = {
|
366 |
+
action: 'wpstg_clone_db',
|
367 |
+
nonce: wpstg.nonce
|
368 |
+
};
|
369 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
370 |
+
if (isCanceled) {
|
371 |
+
cancelCloning();
|
372 |
+
return false;
|
373 |
+
}
|
374 |
+
if (status == "error") { //Unknown error
|
375 |
+
wpstg_show_error_die('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);
|
376 |
+
} else if (!wpstgIsJsonObj(resp)) { //Unknown error
|
377 |
+
wpstg_show_error_die('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);
|
378 |
+
} else if (resp.percent < 0) { //Fail
|
379 |
+
wpstg_show_error_die('Fatal Error: This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);
|
380 |
+
} else if (resp.percent < 1) { //Continue cloning
|
381 |
+
var complete = Math.floor(resp.percent * 100) + '%';
|
382 |
+
$('#wpstg-db-progress').text(complete).css('width', complete);
|
383 |
+
$('#wpstg-error-wrapper').show();
|
384 |
+
if (resp.message !== '')
|
385 |
+
$('#wpstg-log-details').append(resp.message);
|
386 |
+
|
387 |
+
wpstg_logscroll_bottom();
|
388 |
+
clone_db();
|
389 |
+
} else { //Success cloning
|
390 |
+
$('#wpstg-db-progress').text('').css('width', '100%');
|
391 |
+
$('#wpstg-log-details').append(resp.message + '<br>');
|
392 |
+
wpstg_logscroll_bottom();
|
393 |
+
copy_files();
|
394 |
+
}
|
395 |
+
})
|
396 |
+
.fail(function (xhr) { // Will be executed when $.post() fails
|
397 |
wpstg_show_error_die(xhr.statusText);
|
398 |
console.log('Fatal Error: This should not happen but is often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
});
|
400 |
+
}, wpstg.cpu_load); // timeout of x sec - prevent security blocks and cpu overload
|
401 |
+
}
|
402 |
+
|
403 |
+
|
404 |
+
|
405 |
+
|
406 |
+
function copy_files() {
|
407 |
+
setTimeout(function () { // timeout of x sec - prevent security blocks and cpu overload
|
408 |
+
var data = {
|
409 |
+
action: 'wpstg_copy_files',
|
410 |
+
nonce: wpstg.nonce
|
411 |
+
};
|
412 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
413 |
+
if (isCanceled) {
|
414 |
+
cancelCloning();
|
415 |
+
return false;
|
416 |
+
}
|
417 |
+
|
418 |
+
if (!wpstgIsJsonObj(resp)) { //Unknown error
|
419 |
+
wpstg_show_error_die('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ');
|
420 |
+
} else if (resp.percent < 0) { //Fail
|
421 |
+
wpstg_show_error_die('Fatal Error: This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);
|
422 |
+
} else if (resp.percent < 1) { //Continue copying
|
423 |
+
var complete = Math.floor(resp.percent * 100) + '%';
|
424 |
+
$('#wpstg-files-progress').text(complete).css('width', complete);
|
425 |
+
$('#wpstg-loader').show();
|
426 |
+
if (resp.message !== '')
|
427 |
+
$('#wpstg-log-details').append(resp.message + '<br>');
|
428 |
+
wpstg_logscroll_bottom();
|
429 |
+
copy_files();
|
430 |
+
} else { //Success copying
|
431 |
+
$('#wpstg-files-progress').text('').css('width', '100%');
|
432 |
+
wpstg_logscroll_bottom();
|
433 |
+
replace_links();
|
434 |
+
}
|
435 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
436 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
437 |
+
console.log(xhr.statusText);
|
438 |
+
});
|
439 |
+
}, wpstg.cpu_load); // timeout of x sec - prevent security blocks and cpu overload
|
440 |
+
}
|
441 |
+
|
442 |
+
var isFinished = false;
|
443 |
+
function replace_links() {
|
444 |
+
var data = {
|
445 |
+
action: 'wpstg_replace_links',
|
446 |
+
nonce: wpstg.nonce
|
447 |
+
};
|
448 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
449 |
+
if (isCanceled) {
|
450 |
+
cancelCloning();
|
451 |
+
return false;
|
452 |
}
|
453 |
|
454 |
+
if (!wpstgIsJsonObj(resp)) { //Unknown error
|
455 |
+
wpstg_show_error_die('Fatal Error code: 1001. This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ');
|
456 |
+
} else if (resp.percent < 0) { //Fail
|
457 |
+
wpstg_show_error_die('Fatal Error code: 1002. This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);
|
458 |
+
} else if (resp.percent < 1) { //Continue replacing string
|
459 |
+
var complete = Math.floor(resp.percent * 100) + '%';
|
460 |
+
$('#wpstg-links-progress').text('').css('width', complete);
|
461 |
+
$('#wpstg-loader').show();
|
462 |
+
if (resp.message !== '')
|
463 |
+
$('#wpstg-log-details').append(resp.message + '<br>');
|
464 |
+
wpstg_logscroll_bottom();
|
465 |
+
replace_links();
|
466 |
+
} else { //Success
|
467 |
+
$('#wpstg-links-progress').text('').css('width', '100%');
|
468 |
+
$('#wpstg-loader').hide();
|
469 |
+
wpstg_logscroll_bottom();
|
470 |
+
cloneID = cloneID.replace(/[^A-Za-z0-9]/g, '');
|
471 |
+
var redirectURL = $('#wpstg-clone-url').attr('href') + '/' + cloneID + '/';
|
472 |
+
setTimeout(function () {
|
473 |
+
$('#wpstg-finished-result').show();
|
474 |
+
$('#wpstg-clone-url').text('Visit staging site <span style="font-size: 10px;">(login with your admin credentials)</span>'.cloneID).attr('href', redirectURL);
|
475 |
+
$('#wpstg_staging_name').text(cloneID);
|
476 |
+
$('#wpstg-cancel-cloning').hide();
|
477 |
+
$('#wpstg-home-link').css('display', 'inline-block');
|
478 |
+
isFinished = true;
|
479 |
+
}, 1200);
|
480 |
+
if (resp.message !== '')
|
481 |
+
$('#wpstg-log-details').append(resp.message + '<br>');
|
482 |
+
wpstg_logscroll_bottom();
|
483 |
+
}
|
484 |
+
|
485 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
486 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is sometimes caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
487 |
+
console.log(xhr.statusText);
|
488 |
+
});
|
489 |
+
}
|
490 |
+
;
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Show error log button
|
494 |
+
*/
|
495 |
+
$('#wpstg-workflow').on('click', '#wpstg-show-log-button', function (e) {
|
496 |
+
e.preventDefault();
|
497 |
+
$('#wpstg-log-details').toggle();
|
498 |
+
$('html, body').animate({
|
499 |
+
scrollTop: $("#wpstg-log-details").offset().top
|
500 |
+
}, 400);
|
501 |
+
});
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Scroll the log window to the bottom
|
505 |
+
*
|
506 |
+
* @return void
|
507 |
+
*/
|
508 |
+
function wpstg_logscroll_bottom() {
|
509 |
+
var $mydiv = $('#wpstg-log-details');
|
510 |
+
$mydiv.scrollTop($mydiv[0].scrollHeight);
|
511 |
+
}
|
512 |
+
|
513 |
+
/**
|
514 |
+
* Cancel Cloning process button
|
515 |
+
*/
|
516 |
+
$('#wpstg-workflow').on('click', '#wpstg-cancel-cloning', function (e) {
|
517 |
+
e.preventDefault();
|
518 |
+
if (!confirm('Are you sure?'))
|
519 |
+
return false;
|
520 |
+
$('#wpstg-try-again, #wpstg-home-link').hide();
|
521 |
+
$(this).attr('disabled', 'disabled');
|
522 |
+
isCanceled = true;
|
523 |
+
$('#wpstg-cloning-result').text('Please wait...this can take up to a minute');
|
524 |
+
$('#wpstg-loader').hide();
|
525 |
+
$('#wpstg-show-log-button').hide();
|
526 |
+
$(this).parent().append(ajax_spinner);
|
527 |
+
if (isFinished)
|
528 |
+
cancelCloning();
|
529 |
+
});
|
530 |
+
|
531 |
+
/**
|
532 |
+
* Remove Clone button
|
533 |
+
*/
|
534 |
+
$('#wpstg-workflow').on('click', '#wpstg-remove-cloning', function (e) {
|
535 |
+
e.preventDefault();
|
536 |
+
if (!confirm('Are you sure you want to remove the clone site ?'))
|
537 |
+
return false;
|
538 |
+
$('#wpstg-try-again, #wpstg-home-link').hide();
|
539 |
+
$(this).attr('disabled', 'disabled');
|
540 |
+
$('#wpstg-clone-url').attr('disabled', 'disabled');
|
541 |
+
isCanceled = true;
|
542 |
+
$('#wpstg-cloning-result').text('Please wait...this can take up to a minute');
|
543 |
+
$('#wpstg-loader').hide();
|
544 |
+
$('#wpstg-success-notice').hide();
|
545 |
+
$('#wpstg-show-log-button').hide();
|
546 |
+
$('#wpstg-log-details').hide();
|
547 |
+
$(this).parent().append(ajax_spinner);
|
548 |
+
if (isFinished)
|
549 |
+
cancelCloning();
|
550 |
+
});
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Try again button
|
554 |
+
*/
|
555 |
+
$('#wpstg-workflow').on('click', '#wpstg-try-again', function (e) {
|
556 |
+
e.preventDefault();
|
557 |
+
console.log('test');
|
558 |
+
$('#wpstg-workflow').addClass('loading');
|
559 |
+
var data = {
|
560 |
+
action: 'wpstg_scanning',
|
561 |
+
nonce: wpstg.nonce
|
562 |
+
};
|
563 |
+
$('#wpstg-workflow').load(ajaxurl, data, function (response, status, xhr) {
|
564 |
+
if (status == 'error') { //Unknown error
|
565 |
+
console.log(xhr.status + ' ' + xhr.statusText);
|
566 |
+
wpstg_show_error_die('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
567 |
+
}
|
568 |
+
$('#wpstg-workflow').removeClass('loading');
|
569 |
+
$('.wpstg-current-step').removeClass('wpstg-current-step')
|
570 |
+
.prev('li').addClass('wpstg-current-step');
|
571 |
+
});
|
572 |
+
});
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Reset button
|
576 |
+
*/
|
577 |
+
$('#wpstg-workflow').on('click', '#wpstg-reset-clone', function (e) {
|
578 |
+
e.preventDefault();
|
579 |
+
$(this).attr('disabled', 'disabled')
|
580 |
+
.next('.wpstg-next-step-link').hide();
|
581 |
+
$('#wpstg-loader').show();
|
582 |
+
cloneID = $(this).data('clone');
|
583 |
+
cancelCloning();
|
584 |
+
});
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Cancel Cloning process
|
588 |
+
*
|
589 |
+
* @returns void
|
590 |
+
*/
|
591 |
+
function cancelCloning() {
|
592 |
+
var data = {
|
593 |
+
action: 'wpstg_cancel_cloning',
|
594 |
+
nonce: wpstg.nonce,
|
595 |
+
cloneID: cloneID
|
596 |
+
};
|
597 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
598 |
+
if (resp == 0) {
|
599 |
+
$('#wpstg-cloning-result').text('');
|
600 |
+
$('#wpstg-cancel-cloning').text('Success').addClass('success').removeAttr('disabled');
|
601 |
+
location.reload();
|
602 |
+
}
|
603 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
604 |
+
wpstg_show_error_die(xhr.statusText);
|
605 |
+
console.log('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> ' + xhr.status + ' ' + xhr.statusText);
|
606 |
+
});
|
607 |
+
}
|
608 |
+
|
609 |
+
$('#wpstg-workflow').on('click', '#wpstg-home-link', function (e) {
|
610 |
+
e.preventDefault();
|
611 |
+
location.reload();
|
612 |
+
});
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Tabs
|
616 |
+
*/
|
617 |
+
$('#wpstg-workflow').on('click', '.wpstg-tab-header', function (e) {
|
618 |
+
e.preventDefault();
|
619 |
+
var section = $(this).data('id');
|
620 |
+
$(this).toggleClass('expand');
|
621 |
+
$(section).slideToggle();
|
622 |
+
if ($(this).hasClass('expand'))
|
623 |
+
$(this).find('.wpstg-tab-triangle').html('▼');
|
624 |
+
else
|
625 |
+
$(this).find('.wpstg-tab-triangle').html('►');
|
626 |
+
|
627 |
+
});
|
628 |
+
|
629 |
+
/**
|
630 |
+
* Directory structure
|
631 |
+
*/
|
632 |
+
$('#wpstg-workflow').on('click', '.wpstg-expand-dirs', function (e) {
|
633 |
+
e.preventDefault();
|
634 |
+
if (!$(this).hasClass('disabled'))
|
635 |
+
$(this).siblings('.wpstg-subdir').slideToggle();
|
636 |
+
});
|
637 |
+
|
638 |
+
|
639 |
+
$('#wpstg-workflow').on('change', '.wpstg-check-dir', function () {
|
640 |
+
var dir = $(this).parent('.wpstg-dir');
|
641 |
+
if (this.checked) {
|
642 |
+
dir.parents('.wpstg-dir').children('.wpstg-check-dir').attr('checked', 'checked');
|
643 |
+
dir.find('.wpstg-expand-dirs').removeClass('disabled');
|
644 |
+
dir.find('.wpstg-subdir .wpstg-check-dir').attr('checked', 'checked');
|
645 |
+
} else {
|
646 |
+
dir.find('.wpstg-dir .wpstg-check-dir').removeAttr('checked');
|
647 |
+
dir.find('.wpstg-expand-dirs, .wpstg-check-subdirs').addClass('disabled');
|
648 |
+
dir.find('.wpstg-check-subdirs').data('action', 'check').text('check');
|
649 |
+
dir.children('.wpstg-subdir').slideUp();
|
650 |
+
}
|
651 |
+
});
|
652 |
+
|
653 |
+
/**
|
654 |
+
* install must-use plugin
|
655 |
+
*/
|
656 |
+
|
657 |
+
$('#plugin-compatibility').change(function (e) {
|
658 |
+
var install = '1';
|
659 |
+
if ($(this).is(':checked')) {
|
660 |
+
var answer = confirm(wpstg.mu_plugin_confirmation);
|
661 |
+
|
662 |
+
if (!answer) {
|
663 |
+
$(this).prop('checked', false);
|
664 |
+
return;
|
665 |
+
}
|
666 |
+
} else {
|
667 |
+
install = '0';
|
668 |
+
}
|
669 |
+
|
670 |
+
$('.plugin-compatibility-wrap').toggle();
|
671 |
+
|
672 |
+
$(this).parent().append(ajax_spinner);
|
673 |
+
$('#plugin-compatibility').attr('disabled', 'disabled');
|
674 |
+
$('.plugin-compatibility').addClass('disabled');
|
675 |
+
|
676 |
+
$.ajax({
|
677 |
+
url: ajaxurl,
|
678 |
+
type: 'POST',
|
679 |
+
dataType: 'text',
|
680 |
+
cache: false,
|
681 |
+
data: {
|
682 |
+
action: 'wpstg_muplugin_install',
|
683 |
+
install: install
|
684 |
+
},
|
685 |
+
error: function (jqXHR, textStatus, errorThrown) {
|
686 |
+
alert("Error: " + wpstg.plugin_compatibility_settings_problem + '\r\n\r\n' + wpstg.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpstg.response + '\r\n' + jqXHR.responseText);
|
687 |
+
$('.ajax-spinner').remove();
|
688 |
+
$('#plugin-compatibility').removeAttr('disabled');
|
689 |
+
$('.plugin-compatibility').removeClass('disabled');
|
690 |
+
},
|
691 |
+
success: function (data) {
|
692 |
+
if ('' !== $.trim(data)) {
|
693 |
+
alert(data);
|
694 |
+
} else {
|
695 |
+
$('.plugin-compatibility').append('<span class="ajax-success-msg">' + wpstg.saved + '</span>');
|
696 |
+
$('.ajax-success-msg').fadeOut(2000, function () {
|
697 |
+
$(this).remove();
|
698 |
});
|
699 |
+
}
|
700 |
+
$('.ajax-spinner').remove();
|
701 |
+
$('#plugin-compatibility').removeAttr('disabled');
|
702 |
+
$('.plugin-compatibility').removeClass('disabled');
|
703 |
+
}
|
704 |
+
});
|
705 |
+
|
706 |
+
});
|
707 |
+
|
708 |
+
if ($('#plugin-compatibility').is(':checked')) {
|
709 |
+
$('.plugin-compatibility-wrap').show();
|
710 |
+
}
|
711 |
+
$('.plugin-compatibility-save').click(function () {
|
712 |
+
if (doing_plugin_compatibility_ajax) {
|
713 |
+
return;
|
714 |
+
}
|
715 |
+
$(this).addClass('disabled');
|
716 |
+
var select_element = $('#selected-plugins');
|
717 |
+
$(select_element).attr('disabled', 'disabled');
|
718 |
+
var query_limit = $('#wpstg_settings\\[wpstg_query_limit\\]');
|
719 |
+
var batch_size = $('#wpstg_settings\\[wpstg_batch_size\\]');
|
720 |
+
var disable_admin_login = $('#wpstg_settings\\[disable_admin_login\\]');
|
721 |
+
var uninstall_on_delete = $('#wpstg_settings\\[uninstall_on_delete\\]');
|
722 |
+
disable_admin_login = $(disable_admin_login).prop('checked') ? '1' : '0';
|
723 |
+
uninstall_on_delete = $(uninstall_on_delete).prop('checked') ? '1' : '0';
|
724 |
+
|
725 |
+
doing_plugin_compatibility_ajax = true;
|
726 |
+
$(this).after('<img src="' + spinner_url + '" alt="" class="plugin-compatibility-spinner general-spinner" />');
|
727 |
+
|
728 |
+
$.ajax({
|
729 |
+
url: ajaxurl,
|
730 |
+
type: 'POST',
|
731 |
+
dataType: 'text',
|
732 |
+
cache: false,
|
733 |
+
data: {
|
734 |
+
action: 'wpstg_disable_plugins',
|
735 |
+
blacklist_plugins: $(select_element).val(),
|
736 |
+
query_limit: $(query_limit).val(),
|
737 |
+
batch_size: $(batch_size).val(),
|
738 |
+
disable_admin_login: disable_admin_login,
|
739 |
+
uninstall_on_delete: uninstall_on_delete,
|
740 |
+
},
|
741 |
+
error: function (jqXHR, textStatus, errorThrown) {
|
742 |
+
alert(wpstg.blacklist_problem + '\r\n\r\n' + wpstg.status + ' ' + jqXHR.status + ' ' + jqXHR.statusText + '\r\n\r\n' + wpstg.response + '\r\n' + jqXHR.responseText);
|
743 |
+
$(select_element).removeAttr('disabled');
|
744 |
+
$('.plugin-compatibility-save').removeClass('disabled');
|
745 |
+
doing_plugin_compatibility_ajax = false;
|
746 |
+
$('.plugin-compatibility-spinner').remove();
|
747 |
+
$('.plugin-compatibility-success-msg').show().fadeOut(2000);
|
748 |
+
},
|
749 |
+
success: function (data) {
|
750 |
+
if ('' !== $.trim(data)) {
|
751 |
+
alert(data);
|
752 |
+
}
|
753 |
+
$(select_element).removeAttr('disabled');
|
754 |
+
$('.plugin-compatibility-save').removeClass('disabled');
|
755 |
+
doing_plugin_compatibility_ajax = false;
|
756 |
+
$('.plugin-compatibility-spinner').remove();
|
757 |
+
$('.plugin-compatibility-success-msg').show().fadeOut(2000);
|
758 |
+
}
|
759 |
+
});
|
760 |
+
});
|
761 |
+
|
762 |
+
// select all tables
|
763 |
+
$('.multiselect-select-all').click(function (e) {
|
764 |
+
e.preventDefault();
|
765 |
+
var multiselect = $(this).parents('.select-wrap').children('.multiselect');
|
766 |
+
$('option', multiselect).attr('selected', 1);
|
767 |
+
$(multiselect).focus().trigger('change');
|
768 |
+
});
|
769 |
+
|
770 |
+
// deselect all tables
|
771 |
+
$('.multiselect-deselect-all').click(function (e) {
|
772 |
+
e.preventDefault();
|
773 |
+
var multiselect = $(this).parents('.select-wrap').children('.multiselect');
|
774 |
+
$('option', multiselect).removeAttr('selected');
|
775 |
+
$(multiselect).focus().trigger('change');
|
776 |
+
});
|
777 |
+
|
778 |
+
// invert table selection
|
779 |
+
$('.multiselect-invert-selection').click(function (e) {
|
780 |
+
e.preventDefault();
|
781 |
+
var multiselect = $(this).parents('.select-wrap').children('.multiselect');
|
782 |
+
$('option', multiselect).each(function () {
|
783 |
+
$(this).attr('selected', !$(this).attr('selected'));
|
784 |
+
});
|
785 |
+
$(multiselect).focus().trigger('change');
|
786 |
+
});
|
787 |
+
|
788 |
+
|
789 |
+
|
790 |
+
// Show large files
|
791 |
+
$('#wpstg-workflow').on('click', '#wpstg-show-large-files', function (e) {
|
792 |
+
e.preventDefault();
|
793 |
+
//$('#wpstg-show-large-files').on('click', ) click(function(){
|
794 |
+
$('#wpstg-large-files').toggle();
|
795 |
+
});
|
796 |
+
|
797 |
+
|
798 |
+
|
799 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
800 |
})(jQuery);
|
801 |
|
802 |
// Load twitter button async
|
803 |
+
window.twttr = (function (d, s, id) {
|
804 |
+
var js, fjs = d.getElementsByTagName(s)[0],
|
805 |
+
t = window.twttr || {};
|
806 |
+
if (d.getElementById(id))
|
807 |
+
return t;
|
808 |
+
js = d.createElement(s);
|
809 |
+
js.id = id;
|
810 |
+
js.src = "https://platform.twitter.com/widgets.js";
|
811 |
+
fjs.parentNode.insertBefore(js, fjs);
|
812 |
+
|
813 |
+
t._e = [];
|
814 |
+
t.ready = function (f) {
|
815 |
+
t._e.push(f);
|
816 |
+
};
|
817 |
+
|
818 |
+
return t;
|
819 |
}(document, "script", "twitter-wjs"));
|
assets/js/wpstg-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(a){a(document).ready(function(){function b(a){return"object"==typeof a?!0:void 0}function c(b){b.uncheckedTables=[],a(".wpstg-db-table input:not(:checked)").each(function(){b.uncheckedTables.push(this.name)}),b.excludedFolders=[],a(".wpstg-dir input:not(:checked)").each(function(){a(this).parent(".wpstg-dir").parents(".wpstg-dir").children(".wpstg-expand-dirs").hasClass("disabled")||b.excludedFolders.push(this.name)}),o=b.cloneID.toString()}function d(b){a("#wpstg-try-again").css("display","inline-block"),a("#wpstg-cancel-cloning").text("Reset"),a("#wpstg-cloning-result").text("Fail"),a("#wpstg-error-wrapper").show(),a("#wpstg-error-details").show(),a("#wpstg-error-details").html(b),a("#wpstg-loader").hide(),q=!0,console.log(b);var c=' Fatal Error: This should not happen! Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not fix it enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out what is causing this.',d={action:"wpstg_error_processing",wpstg_error_msg:b+c};a.post(ajaxurl,d)}function e(){setTimeout(function(){a("#wpstg-loader").show();var c={action:"wpstg_clone_db",nonce:wpstg.nonce};a.post(ajaxurl,c,function(c,g){if(p)return i(),!1;if("error"==g)d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(b(c))if(c.percent<0)d('Fatal Error: This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(c.percent<1){var j=Math.floor(100*c.percent)+"%";a("#wpstg-db-progress").text(j).css("width",j),a("#wpstg-error-wrapper").show(),""!==c.message&&a("#wpstg-log-details").append(c.message),h(),e()}else a("#wpstg-db-progress").text("").css("width","100%"),a("#wpstg-log-details").append(c.message+"<br>"),h(),f();else d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText)}).fail(function(a){d(a.statusText),console.log('Fatal Error: This should not happen but is often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText)})},wpstg.cpu_load)}function f(){setTimeout(function(){var c={action:"wpstg_copy_files",nonce:wpstg.nonce};a.post(ajaxurl,c,function(c){if(p)return i(),!1;if(b(c))if(c.percent<0)d('Fatal Error: This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(c.percent<1){var e=Math.floor(100*c.percent)+"%";a("#wpstg-files-progress").text(e).css("width",e),a("#wpstg-loader").show(),""!==c.message&&a("#wpstg-log-details").append(c.message+"<br>"),h(),f()}else a("#wpstg-files-progress").text("").css("width","100%"),h(),g();else d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ')}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})},wpstg.cpu_load)}function g(){var c={action:"wpstg_replace_links",nonce:wpstg.nonce};a.post(ajaxurl,c,function(c){if(p)return i(),!1;if(b(c))if(c.percent<0)d('Fatal Error code: 1002. This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(c.percent<1){var e=Math.floor(100*c.percent)+"%";a("#wpstg-links-progress").text("").css("width",e),a("#wpstg-loader").show(),""!==c.message&&a("#wpstg-log-details").append(c.message+"<br>"),h(),g()}else{a("#wpstg-links-progress").text("").css("width","100%"),a("#wpstg-loader").hide(),h(),o=o.replace(/[^A-Za-z0-9]/g,"");var f=a("#wpstg-clone-url").attr("href")+"/"+o+"/";setTimeout(function(){a("#wpstg-finished-result").show(),a("#wpstg-clone-url").text('Visit staging site <span style="font-size: 10px;">(login with your admin credentials)</span>'.cloneID).attr("href",f),a("#wpstg_staging_name").text(o),a("#wpstg-cancel-cloning").hide(),a("#wpstg-home-link").css("display","inline-block"),q=!0},1200),""!==c.message&&a("#wpstg-log-details").append(c.message+"<br>"),h()}else d('Fatal Error code: 1001. This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ')}).fail(function(a){d('Fatal Error: This should not happen but is sometimes caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}function h(){var b=a("#wpstg-log-details");b.scrollTop(b[0].scrollHeight)}function i(){var b={action:"wpstg_cancel_cloning",nonce:wpstg.nonce,cloneID:o};a.post(ajaxurl,b,function(b){0==b&&(a("#wpstg-cloning-result").text(""),a("#wpstg-cancel-cloning").text("Success").addClass("success").removeAttr("disabled"),location.reload())}).fail(function(a){d(a.statusText),console.log('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText)})}var j=!0;a("#wpstg-workflow").on("click",".wpstg-button-unselect",function(b){b.preventDefault(),0==j?(a(".wpstg-db-table-checkboxes").attr("checked","checked"),a(".wpstg-button-unselect").html("Uncheck All"),j=!0):(a(".wpstg-db-table-checkboxes").removeAttr("checked"),a(".wpstg-button-unselect").html("Check All"),j=!1)});var k=ajaxurl.replace("/admin-ajax.php",""),l=k+"/images/spinner";2<window.devicePixelRatio&&(l+="-2x"),l+=".gif";var m='<img src="'+l+'" alt="" class="ajax-spinner general-spinner" />',n=!1;a("#wpstg-workflow").on("keyup","#wpstg-new-clone-id",function(){var b={action:"wpstg_check_clone",cloneID:this.value};a.post(ajaxurl,b,function(b){"fail"!==b.status?(a("#wpstg-new-clone-id").removeClass("wpstg-error-input"),a("#wpstg-start-cloning").removeAttr("disabled"),a("#wpstg-clone-id-error").text(b.message)):(a("#wpstg-new-clone-id").addClass("wpstg-error-input"),a("#wpstg-start-cloning").attr("disabled","disabled"),a("#wpstg-clone-id-error").text(b.message))}).fail(function(a){d('Fatal Error: This should not happen but is often caused by other plugins. Enable first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}),a("#wpstg-workflow").on("keyup","#wpstg-clone-path",function(){var b=this.value;if(b.length<1)return a("#wpstg-clone-path").removeClass("wpstg-error-input"),a("#wpstg-start-cloning").removeAttr("disabled"),a("#wpstg-path-error").text(""),!0;var c={action:"wpstg_check_path",path:b};a.post(ajaxurl,c,function(b){b?(a("#wpstg-clone-path").removeClass("wpstg-error-input"),a("#wpstg-start-cloning").removeAttr("disabled"),a("#wpstg-path-error").text("")):(a("#wpstg-clone-path").addClass("wpstg-error-input"),a("#wpstg-start-cloning").attr("disabled","disabled"),a("#wpstg-path-error").text("Folder does not exist or is not writable!"))}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}),a("#wpstg-workflow").on("click",".wpstg-edit-clone",function(b){b.preventDefault();var c={action:"wpstg_edit_profile",clone:a(this).data("clone"),nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c)}),a("#wpstg-workflow").on("click","#wpstg-save-profile",function(b){b.preventDefault();var e={action:"wpstg_save_profile",cloneID:a(this).data("clone"),nonce:wpstg.nonce,dbCredentials:{dbname:a("#wpstgdb-name").val(),dbuser:a("#wpstgdb-user").val(),dbpassword:a("#wpstgdb-password").val(),dbhost:a("#wpstgdb-host").val()}};c(e,!1),a.post(ajaxurl,e,function(){location.reload()}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}),a("#wpstg-workflow").on("click",".wpstg-next-step-link",function(b){if(b.preventDefault(),a(this).attr("disabled"))return!1;a("#wpstg-workflow").addClass("loading");var f={action:a(this).data("action"),nonce:wpstg.nonce};"wpstg_cloning"==f.action&&(f.cloneID=a("#wpstg-new-clone-id").val()||(new Date).getTime(),c(f,!1)),a("#wpstg-workflow").load(ajaxurl,f,function(b,c,g){"error"==c&&(console.log(g.status+" "+g.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: '+g.status+" "+g.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").next("li").addClass("wpstg-current-step"),"wpstg_cloning"==f.action&&e()})}),a("#wpstg-workflow").on("click",".wpstg-prev-step-link",function(b){b.preventDefault(),a("#wpstg-workflow").addClass("loading");var c={action:"wpstg_overview",nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: '+e.status+" "+e.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").prev("li").addClass("wpstg-current-step")})});var o;a("#wpstg-workflow").on("click",".wpstg-execute-clone",function(b){b.preventDefault(),a("#wpstg-workflow").addClass("loading");var c={action:"wpstg_scanning",clone:a(this).data("clone"),nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '+e.status+" "+e.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").next("li").addClass("wpstg-current-step")})}),a("#wpstg-workflow").on("click",".wpstg-remove-clone",function(b){b.preventDefault(),a(".wpstg-clone").removeClass("active"),a("#wpstg-existing-clones").append(m);var c={action:"wpstg_preremove",cloneID:a(this).data("clone")};a("#wpstg-removing-clone").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+e.status+" "+e.statusText)),"success"===c&&a("#wpstg-existing-clones").children("img").remove()})}),a("#wpstg-workflow").on("click","#wpstg-cancel-removing",function(b){b.preventDefault(),a(".wpstg-clone").removeClass("active"),a("#wpstg-removing-clone").html("")}),a("#wpstg-workflow").on("click","#wpstg-remove-clone",function(b){b.preventDefault(),a("#wpstg-removing-clone").addClass("loading");var e=a(this).data("clone"),f={action:"wpstg_remove_clone",cloneID:e,nonce:wpstg.nonce};c(f,!0),a.post(ajaxurl,f,function(b,c,f){if(console.log(f.status+" "+f.statusText),"error"==c&&(console.log(f.status+" "+f.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+f.status+" "+f.statusText)),0==b){a("#wpstg-removing-clone").html(""),a(".wpstg-clone#"+e).remove(),a("#wpstg-removing-clone").removeClass("loading");var g=a(".wpstg-clone");g.length<1&&a("#wpstg-existing-clones h3").text("")}}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})});var p=!1,q=!1;a("#wpstg-workflow").on("click","#wpstg-show-log-button",function(b){b.preventDefault(),a("#wpstg-log-details").toggle(),a("html, body").animate({scrollTop:a("#wpstg-log-details").offset().top},400)}),a("#wpstg-workflow").on("click","#wpstg-cancel-cloning",function(b){return b.preventDefault(),confirm("Are you sure?")?(a("#wpstg-try-again, #wpstg-home-link").hide(),a(this).attr("disabled","disabled"),p=!0,a("#wpstg-cloning-result").text("Please wait...this can take up to a minute"),a("#wpstg-loader").hide(),a("#wpstg-show-log-button").hide(),a(this).parent().append(m),void(q&&i())):!1}),a("#wpstg-workflow").on("click","#wpstg-remove-cloning",function(b){return b.preventDefault(),confirm("Are you sure you want to remove the clone site ?")?(a("#wpstg-try-again, #wpstg-home-link").hide(),a(this).attr("disabled","disabled"),a("#wpstg-clone-url").attr("disabled","disabled"),p=!0,a("#wpstg-cloning-result").text("Please wait...this can take up to a minute"),a("#wpstg-loader").hide(),a("#wpstg-success-notice").hide(),a("#wpstg-show-log-button").hide(),a("#wpstg-log-details").hide(),a(this).parent().append(m),void(q&&i())):!1}),a("#wpstg-workflow").on("click","#wpstg-try-again",function(b){b.preventDefault(),console.log("test"),a("#wpstg-workflow").addClass("loading");var c={action:"wpstg_scanning",nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+e.status+" "+e.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").prev("li").addClass("wpstg-current-step")})}),a("#wpstg-workflow").on("click","#wpstg-reset-clone",function(b){b.preventDefault(),a(this).attr("disabled","disabled").next(".wpstg-next-step-link").hide(),a("#wpstg-loader").show(),o=a(this).data("clone"),i()}),a("#wpstg-workflow").on("click","#wpstg-home-link",function(a){a.preventDefault(),location.reload()}),a("#wpstg-workflow").on("click",".wpstg-tab-header",function(b){b.preventDefault();var c=a(this).data("id");a(this).toggleClass("expand"),a(c).slideToggle(),a(this).find(".wpstg-tab-triangle").html(a(this).hasClass("expand")?"▼":"►")}),a("#wpstg-workflow").on("click",".wpstg-expand-dirs",function(b){b.preventDefault(),a(this).hasClass("disabled")||a(this).siblings(".wpstg-subdir").slideToggle()}),a("#wpstg-workflow").on("change",".wpstg-check-dir",function(){var b=a(this).parent(".wpstg-dir");this.checked?(b.parents(".wpstg-dir").children(".wpstg-check-dir").attr("checked","checked"),b.find(".wpstg-expand-dirs").removeClass("disabled"),b.find(".wpstg-subdir .wpstg-check-dir").attr("checked","checked")):(b.find(".wpstg-dir .wpstg-check-dir").removeAttr("checked"),b.find(".wpstg-expand-dirs, .wpstg-check-subdirs").addClass("disabled"),b.find(".wpstg-check-subdirs").data("action","check").text("check"),b.children(".wpstg-subdir").slideUp())}),a("#plugin-compatibility").change(function(){var b="1";if(a(this).is(":checked")){var c=confirm(wpstg.mu_plugin_confirmation);if(!c)return void a(this).prop("checked",!1)}else b="0";a(".plugin-compatibility-wrap").toggle(),a(this).parent().append(m),a("#plugin-compatibility").attr("disabled","disabled"),a(".plugin-compatibility").addClass("disabled"),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpstg_muplugin_install",install:b},error:function(b){alert("Error: "+wpstg.plugin_compatibility_settings_problem+"\r\n\r\n"+wpstg.status+" "+b.status+" "+b.statusText+"\r\n\r\n"+wpstg.response+"\r\n"+b.responseText),a(".ajax-spinner").remove(),a("#plugin-compatibility").removeAttr("disabled"),a(".plugin-compatibility").removeClass("disabled")},success:function(b){""!==a.trim(b)?alert(b):(a(".plugin-compatibility").append('<span class="ajax-success-msg">'+wpstg.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()})),a(".ajax-spinner").remove(),a("#plugin-compatibility").removeAttr("disabled"),a(".plugin-compatibility").removeClass("disabled")}})}),a("#plugin-compatibility").is(":checked")&&a(".plugin-compatibility-wrap").show(),a(".plugin-compatibility-save").click(function(){if(!n){a(this).addClass("disabled");var b=a("#selected-plugins");a(b).attr("disabled","disabled");var c=a("#wpstg_settings\\[wpstg_query_limit\\]"),d=a("#wpstg_settings\\[wpstg_batch_size\\]"),e=a("#wpstg_settings\\[disable_admin_login\\]"),f=a("#wpstg_settings\\[uninstall_on_delete\\]");e=a(e).prop("checked")?"1":"0",f=a(f).prop("checked")?"1":"0",n=!0,a(this).after('<img src="'+l+'" alt="" class="plugin-compatibility-spinner general-spinner" />'),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpstg_disable_plugins",blacklist_plugins:a(b).val(),query_limit:a(c).val(),batch_size:a(d).val(),disable_admin_login:e,uninstall_on_delete:f},error:function(c){alert(wpstg.blacklist_problem+"\r\n\r\n"+wpstg.status+" "+c.status+" "+c.statusText+"\r\n\r\n"+wpstg.response+"\r\n"+c.responseText),a(b).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),n=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)},success:function(c){""!==a.trim(c)&&alert(c),a(b).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),n=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)}})}}),a(".multiselect-select-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).attr("selected",1),a(b).focus().trigger("change")}),a(".multiselect-deselect-all").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).removeAttr("selected"),a(b).focus().trigger("change")}),a(".multiselect-invert-selection").click(function(){var b=a(this).parents(".select-wrap").children(".multiselect");a("option",b).each(function(){a(this).attr("selected",!a(this).attr("selected"))}),a(b).focus().trigger("change")}),a("#wpstg-workflow").on("click","#wpstg-show-large-files",function(b){b.preventDefault(),a("#wpstg-large-files").toggle()})})}(jQuery),window.twttr=function(a,b,c){var d,e=a.getElementsByTagName(b)[0],f=window.twttr||{};return a.getElementById(c)?f:(d=a.createElement(b),d.id=c,d.src="https://platform.twitter.com/widgets.js",e.parentNode.insertBefore(d,e),f._e=[],f.ready=function(a){f._e.push(a)},f)}(document,"script","twitter-wjs");
|
1 |
+
!function(a){a(document).ready(function(){function b(a){return"object"==typeof a?!0:void 0}function c(b){b.uncheckedTables=[],a(".wpstg-db-table input:not(:checked)").each(function(){b.uncheckedTables.push(this.name)}),b.excludedFolders=[],a(".wpstg-dir input:not(:checked)").each(function(){a(this).parent(".wpstg-dir").parents(".wpstg-dir").children(".wpstg-expand-dirs").hasClass("disabled")||b.excludedFolders.push(this.name)}),o=b.cloneID.toString()}function d(b){a("#wpstg-try-again").css("display","inline-block"),a("#wpstg-cancel-cloning").text("Reset"),a("#wpstg-cloning-result").text("Fail"),a("#wpstg-error-wrapper").show(),a("#wpstg-error-details").show(),a("#wpstg-error-details").html(b),a("#wpstg-loader").hide(),q=!0,console.log(b);var c=' Fatal Error: This should not happen! Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not fix it enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out what is causing this.',d={action:"wpstg_error_processing",wpstg_error_msg:b+c};a.post(ajaxurl,d)}function e(){setTimeout(function(){a("#wpstg-loader").show();var c={action:"wpstg_clone_db",nonce:wpstg.nonce};a.post(ajaxurl,c,function(c,g){if(p)return i(),!1;if("error"==g)d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(b(c))if(c.percent<0)d('Fatal Error: This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(c.percent<1){var j=Math.floor(100*c.percent)+"%";a("#wpstg-db-progress").text(j).css("width",j),a("#wpstg-error-wrapper").show(),""!==c.message&&a("#wpstg-log-details").append(c.message),h(),e()}else a("#wpstg-db-progress").text("").css("width","100%"),a("#wpstg-log-details").append(c.message+"<br>"),h(),f();else d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText)}).fail(function(a){d(a.statusText),console.log('Fatal Error: This should not happen but is often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText)})},wpstg.cpu_load)}function f(){setTimeout(function(){var c={action:"wpstg_copy_files",nonce:wpstg.nonce};a.post(ajaxurl,c,function(c){if(p)return i(),!1;if(b(c))if(c.percent<0)d('Fatal Error: This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(c.percent<1){var e=Math.floor(100*c.percent)+"%";a("#wpstg-files-progress").text(e).css("width",e),a("#wpstg-loader").show(),""!==c.message&&a("#wpstg-log-details").append(c.message+"<br>"),h(),f()}else a("#wpstg-files-progress").text("").css("width","100%"),h(),g();else d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ')}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})},wpstg.cpu_load)}function g(){var c={action:"wpstg_replace_links",nonce:wpstg.nonce};a.post(ajaxurl,c,function(c){if(p)return i(),!1;if(b(c))if(c.percent<0)d('Fatal Error code: 1002. This should never happen. Please try again! <br>If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '.xhr.statusText);else if(c.percent<1){var e=Math.floor(100*c.percent)+"%";a("#wpstg-links-progress").text("").css("width",e),a("#wpstg-loader").show(),""!==c.message&&a("#wpstg-log-details").append(c.message+"<br>"),h(),g()}else{a("#wpstg-links-progress").text("").css("width","100%"),a("#wpstg-loader").hide(),h(),o=o.replace(/[^A-Za-z0-9]/g,"");var f=a("#wpstg-clone-url").attr("href")+"/"+o+"/";setTimeout(function(){a("#wpstg-finished-result").show(),a("#wpstg-clone-url").text('Visit staging site <span style="font-size: 10px;">(login with your admin credentials)</span>'.cloneID).attr("href",f),a("#wpstg_staging_name").text(o),a("#wpstg-cancel-cloning").hide(),a("#wpstg-home-link").css("display","inline-block"),q=!0},1200),""!==c.message&&a("#wpstg-log-details").append(c.message+"<br>"),h()}else d('Fatal Error code: 1001. This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> ')}).fail(function(a){d('Fatal Error: This should not happen but is sometimes caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}function h(){var b=a("#wpstg-log-details");b.scrollTop(b[0].scrollHeight)}function i(){var b={action:"wpstg_cancel_cloning",nonce:wpstg.nonce,cloneID:o};a.post(ajaxurl,b,function(b){0==b&&(a("#wpstg-cloning-result").text(""),a("#wpstg-cancel-cloning").text("Success").addClass("success").removeAttr("disabled"),location.reload())}).fail(function(a){d(a.statusText),console.log('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText)})}var j=!0;a("#wpstg-workflow").on("click",".wpstg-button-unselect",function(b){b.preventDefault(),0==j?(a(".wpstg-db-table-checkboxes").attr("checked","checked"),a(".wpstg-button-unselect").html("Uncheck All"),j=!0):(a(".wpstg-db-table-checkboxes").removeAttr("checked"),a(".wpstg-button-unselect").html("Check All"),j=!1)});var k=ajaxurl.replace("/admin-ajax.php",""),l=k+"/images/spinner";2<window.devicePixelRatio&&(l+="-2x"),l+=".gif";var m='<img src="'+l+'" alt="" class="ajax-spinner general-spinner" />',n=!1;a("#wpstg-workflow").on("keyup","#wpstg-new-clone-id",function(){var b={action:"wpstg_check_clone",cloneID:this.value};a.post(ajaxurl,b,function(b){"fail"!==b.status?(a("#wpstg-new-clone-id").removeClass("wpstg-error-input"),a("#wpstg-start-cloning").removeAttr("disabled"),a("#wpstg-clone-id-error").text(b.message)):(a("#wpstg-new-clone-id").addClass("wpstg-error-input"),a("#wpstg-start-cloning").attr("disabled","disabled"),a("#wpstg-clone-id-error").text(b.message))}).fail(function(a){d('Fatal Error: This should not happen but is often caused by other plugins. Enable first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}),a("#wpstg-workflow").on("click",".wpstg-sync-settings",function(b){b.preventDefault();var c={action:"render_settings_page",clone:a(this).data("clone"),nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c)}),a("#wpstg-workflow").on("keyup","#wpstg-clone-path",function(){var b=this.value;if(b.length<1)return a("#wpstg-clone-path").removeClass("wpstg-error-input"),a("#wpstg-start-cloning").removeAttr("disabled"),a("#wpstg-path-error").text(""),!0;var c={action:"wpstg_check_path",path:b};a.post(ajaxurl,c,function(b){b?(a("#wpstg-clone-path").removeClass("wpstg-error-input"),a("#wpstg-start-cloning").removeAttr("disabled"),a("#wpstg-path-error").text("")):(a("#wpstg-clone-path").addClass("wpstg-error-input"),a("#wpstg-start-cloning").attr("disabled","disabled"),a("#wpstg-path-error").text("Folder does not exist or is not writable!"))}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}),a("#wpstg-workflow").on("click",".wpstg-edit-clone",function(b){b.preventDefault();var c={action:"wpstg_edit_profile",clone:a(this).data("clone"),nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c)}),a("#wpstg-workflow").on("click","#wpstg-save-profile",function(b){b.preventDefault();var e={action:"wpstg_save_profile",cloneID:a(this).data("clone"),nonce:wpstg.nonce,dbCredentials:{dbname:a("#wpstgdb-name").val(),dbuser:a("#wpstgdb-user").val(),dbpassword:a("#wpstgdb-password").val(),dbhost:a("#wpstgdb-host").val()}};c(e,!1),a.post(ajaxurl,e,function(){location.reload()}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})}),a("#wpstg-workflow").on("click",".wpstg-next-step-link",function(b){if(b.preventDefault(),a(this).attr("disabled"))return!1;a("#wpstg-workflow").addClass("loading");var f={action:a(this).data("action"),nonce:wpstg.nonce};"wpstg_cloning"==f.action&&(f.cloneID=a("#wpstg-new-clone-id").val()||(new Date).getTime(),c(f,!1)),a("#wpstg-workflow").load(ajaxurl,f,function(b,c,g){"error"==c&&(console.log(g.status+" "+g.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: '+g.status+" "+g.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").next("li").addClass("wpstg-current-step"),"wpstg_cloning"==f.action&&e()})}),a("#wpstg-workflow").on("click",".wpstg-prev-step-link",function(b){b.preventDefault(),a("#wpstg-workflow").addClass("loading");var c={action:"wpstg_overview",nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this: '+e.status+" "+e.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").prev("li").addClass("wpstg-current-step")})});var o;a("#wpstg-workflow").on("click",".wpstg-execute-clone",function(b){b.preventDefault(),a("#wpstg-workflow").addClass("loading");var c={action:"wpstg_scanning",clone:a(this).data("clone"),nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen. Please try again! <br> If restarting does not work <a href="https://wordpress.org/support/plugin/wp-staging" target="blank">get in contact with us</a> '+e.status+" "+e.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").next("li").addClass("wpstg-current-step")})}),a("#wpstg-workflow").on("click",".wpstg-remove-clone",function(b){b.preventDefault(),a(".wpstg-clone").removeClass("active"),a("#wpstg-existing-clones").append(m);var c={action:"wpstg_preremove",cloneID:a(this).data("clone")};a("#wpstg-removing-clone").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+e.status+" "+e.statusText)),"success"===c&&a("#wpstg-existing-clones").children("img").remove()})}),a("#wpstg-workflow").on("click","#wpstg-cancel-removing",function(b){b.preventDefault(),a(".wpstg-clone").removeClass("active"),a("#wpstg-removing-clone").html("")}),a("#wpstg-workflow").on("click","#wpstg-remove-clone",function(b){b.preventDefault(),a("#wpstg-removing-clone").addClass("loading");var e=a(this).data("clone"),f={action:"wpstg_remove_clone",cloneID:e,nonce:wpstg.nonce};c(f,!0),a.post(ajaxurl,f,function(b,c,f){if(console.log(f.status+" "+f.statusText),"error"==c&&(console.log(f.status+" "+f.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+f.status+" "+f.statusText)),0==b){a("#wpstg-removing-clone").html(""),a(".wpstg-clone#"+e).remove(),a("#wpstg-removing-clone").removeClass("loading");var g=a(".wpstg-clone");g.length<1&&a("#wpstg-existing-clones h3").text("")}}).fail(function(a){d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+a.status+" "+a.statusText),console.log(a.statusText)})});var p=!1,q=!1;a("#wpstg-workflow").on("click","#wpstg-show-log-button",function(b){b.preventDefault(),a("#wpstg-log-details").toggle(),a("html, body").animate({scrollTop:a("#wpstg-log-details").offset().top},400)}),a("#wpstg-workflow").on("click","#wpstg-cancel-cloning",function(b){return b.preventDefault(),confirm("Are you sure?")?(a("#wpstg-try-again, #wpstg-home-link").hide(),a(this).attr("disabled","disabled"),p=!0,a("#wpstg-cloning-result").text("Please wait...this can take up to a minute"),a("#wpstg-loader").hide(),a("#wpstg-show-log-button").hide(),a(this).parent().append(m),void(q&&i())):!1}),a("#wpstg-workflow").on("click","#wpstg-remove-cloning",function(b){return b.preventDefault(),confirm("Are you sure you want to remove the clone site ?")?(a("#wpstg-try-again, #wpstg-home-link").hide(),a(this).attr("disabled","disabled"),a("#wpstg-clone-url").attr("disabled","disabled"),p=!0,a("#wpstg-cloning-result").text("Please wait...this can take up to a minute"),a("#wpstg-loader").hide(),a("#wpstg-success-notice").hide(),a("#wpstg-show-log-button").hide(),a("#wpstg-log-details").hide(),a(this).parent().append(m),void(q&&i())):!1}),a("#wpstg-workflow").on("click","#wpstg-try-again",function(b){b.preventDefault(),console.log("test"),a("#wpstg-workflow").addClass("loading");var c={action:"wpstg_scanning",nonce:wpstg.nonce};a("#wpstg-workflow").load(ajaxurl,c,function(b,c,e){"error"==c&&(console.log(e.status+" "+e.statusText),d('Fatal Error: This should not happen but is most often caused by other plugins. Try first the option "Optimizer" in WP Staging->Settings and try again. If this does not help, enable <a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">wordpress debug mode</a> to find out which plugin is causing this:<br> '+e.status+" "+e.statusText)),a("#wpstg-workflow").removeClass("loading"),a(".wpstg-current-step").removeClass("wpstg-current-step").prev("li").addClass("wpstg-current-step")})}),a("#wpstg-workflow").on("click","#wpstg-reset-clone",function(b){b.preventDefault(),a(this).attr("disabled","disabled").next(".wpstg-next-step-link").hide(),a("#wpstg-loader").show(),o=a(this).data("clone"),i()}),a("#wpstg-workflow").on("click","#wpstg-home-link",function(a){a.preventDefault(),location.reload()}),a("#wpstg-workflow").on("click",".wpstg-tab-header",function(b){b.preventDefault();var c=a(this).data("id");a(this).toggleClass("expand"),a(c).slideToggle(),a(this).find(".wpstg-tab-triangle").html(a(this).hasClass("expand")?"▼":"►")}),a("#wpstg-workflow").on("click",".wpstg-expand-dirs",function(b){b.preventDefault(),a(this).hasClass("disabled")||a(this).siblings(".wpstg-subdir").slideToggle()}),a("#wpstg-workflow").on("change",".wpstg-check-dir",function(){var b=a(this).parent(".wpstg-dir");this.checked?(b.parents(".wpstg-dir").children(".wpstg-check-dir").attr("checked","checked"),b.find(".wpstg-expand-dirs").removeClass("disabled"),b.find(".wpstg-subdir .wpstg-check-dir").attr("checked","checked")):(b.find(".wpstg-dir .wpstg-check-dir").removeAttr("checked"),b.find(".wpstg-expand-dirs, .wpstg-check-subdirs").addClass("disabled"),b.find(".wpstg-check-subdirs").data("action","check").text("check"),b.children(".wpstg-subdir").slideUp())}),a("#plugin-compatibility").change(function(){var b="1";if(a(this).is(":checked")){var c=confirm(wpstg.mu_plugin_confirmation);if(!c)return void a(this).prop("checked",!1)}else b="0";a(".plugin-compatibility-wrap").toggle(),a(this).parent().append(m),a("#plugin-compatibility").attr("disabled","disabled"),a(".plugin-compatibility").addClass("disabled"),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpstg_muplugin_install",install:b},error:function(b){alert("Error: "+wpstg.plugin_compatibility_settings_problem+"\r\n\r\n"+wpstg.status+" "+b.status+" "+b.statusText+"\r\n\r\n"+wpstg.response+"\r\n"+b.responseText),a(".ajax-spinner").remove(),a("#plugin-compatibility").removeAttr("disabled"),a(".plugin-compatibility").removeClass("disabled")},success:function(b){""!==a.trim(b)?alert(b):(a(".plugin-compatibility").append('<span class="ajax-success-msg">'+wpstg.saved+"</span>"),a(".ajax-success-msg").fadeOut(2e3,function(){a(this).remove()})),a(".ajax-spinner").remove(),a("#plugin-compatibility").removeAttr("disabled"),a(".plugin-compatibility").removeClass("disabled")}})}),a("#plugin-compatibility").is(":checked")&&a(".plugin-compatibility-wrap").show(),a(".plugin-compatibility-save").click(function(){if(!n){a(this).addClass("disabled");var b=a("#selected-plugins");a(b).attr("disabled","disabled");var c=a("#wpstg_settings\\[wpstg_query_limit\\]"),d=a("#wpstg_settings\\[wpstg_batch_size\\]"),e=a("#wpstg_settings\\[disable_admin_login\\]"),f=a("#wpstg_settings\\[uninstall_on_delete\\]");e=a(e).prop("checked")?"1":"0",f=a(f).prop("checked")?"1":"0",n=!0,a(this).after('<img src="'+l+'" alt="" class="plugin-compatibility-spinner general-spinner" />'),a.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpstg_disable_plugins",blacklist_plugins:a(b).val(),query_limit:a(c).val(),batch_size:a(d).val(),disable_admin_login:e,uninstall_on_delete:f},error:function(c){alert(wpstg.blacklist_problem+"\r\n\r\n"+wpstg.status+" "+c.status+" "+c.statusText+"\r\n\r\n"+wpstg.response+"\r\n"+c.responseText),a(b).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),n=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)},success:function(c){""!==a.trim(c)&&alert(c),a(b).removeAttr("disabled"),a(".plugin-compatibility-save").removeClass("disabled"),n=!1,a(".plugin-compatibility-spinner").remove(),a(".plugin-compatibility-success-msg").show().fadeOut(2e3)}})}}),a(".multiselect-select-all").click(function(b){b.preventDefault();var c=a(this).parents(".select-wrap").children(".multiselect");a("option",c).attr("selected",1),a(c).focus().trigger("change")}),a(".multiselect-deselect-all").click(function(b){b.preventDefault();var c=a(this).parents(".select-wrap").children(".multiselect");a("option",c).removeAttr("selected"),a(c).focus().trigger("change")}),a(".multiselect-invert-selection").click(function(b){b.preventDefault();var c=a(this).parents(".select-wrap").children(".multiselect");a("option",c).each(function(){a(this).attr("selected",!a(this).attr("selected"))}),a(c).focus().trigger("change")}),a("#wpstg-workflow").on("click","#wpstg-show-large-files",function(b){b.preventDefault(),a("#wpstg-large-files").toggle()})})}(jQuery),window.twttr=function(a,b,c){var d,e=a.getElementsByTagName(b)[0],f=window.twttr||{};return a.getElementById(c)?f:(d=a.createElement(b),d.id=c,d.src="https://platform.twitter.com/widgets.js",e.parentNode.insertBefore(d,e),f._e=[],f.ready=function(a){f._e.push(a)},f)}(document,"script","twitter-wjs");
|
includes/admin/admin-notices.php
CHANGED
@@ -56,7 +56,7 @@ function wpstg_admin_messages() {
|
|
56 |
);
|
57 |
echo '</p></div>';
|
58 |
}
|
59 |
-
|
60 |
echo wpstg_show_beta_message();
|
61 |
wpstg_plugin_deactivated_notice();
|
62 |
|
@@ -69,7 +69,7 @@ function wpstg_admin_messages() {
|
|
69 |
if($diff_intrval >= 7 && get_option('wpstg_RatingDiv')=="no")
|
70 |
{
|
71 |
echo '<div class="wpstg_fivestar updated" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
72 |
-
<p>Awesome, you\'ve been using <strong>WP Staging </strong> for more than 1 week. May
|
73 |
<p><strong>Regards,<br>René Hermenau</strong>
|
74 |
<ul>
|
75 |
<li><a href="https://wordpress.org/support/view/plugin-reviews/wp-staging" class="thankyou" target="_new" title="Ok, you deserved it" style="font-weight:bold;">Ok, you deserved it</a></li>
|
@@ -239,12 +239,10 @@ function wpstg_plugin_update_message( $args ) {
|
|
239 |
*/
|
240 |
function wpstg_show_beta_message(){
|
241 |
$notice = '<div class="wpstg_beta_notice error" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
242 |
-
<p>
|
243 |
-
<p><strong>This is no joke! </strong>WP Staging is using crucial database and system close functions which have the power to break your website or even to delete your entire database! WP-Staging has neever caused any errors like data loose on any of the sites we are using for testing, so in most cases everything will be running fine, but we have
|
244 |
-
to give out this warning until WP Staging is not in beta status any longer.
|
245 |
<p>
|
246 |
One of the best free plugins for an entire wordpress backup is the free one <a href="https://wordpress.org/plugins/backwpup/" target="_blank">BackWPup</a>
|
247 |
-
<p>
|
248 |
<ul>
|
249 |
<li><a href="javascript:void(0);" class="wpstg_hide_beta" title="I understand" style="font-weight:bold;color:#00a0d2;">I understand! (Do not show this again)</a></li>
|
250 |
</ul>
|
56 |
);
|
57 |
echo '</p></div>';
|
58 |
}
|
59 |
+
|
60 |
echo wpstg_show_beta_message();
|
61 |
wpstg_plugin_deactivated_notice();
|
62 |
|
69 |
if($diff_intrval >= 7 && get_option('wpstg_RatingDiv')=="no")
|
70 |
{
|
71 |
echo '<div class="wpstg_fivestar updated" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
72 |
+
<p>Awesome, you\'ve been using <strong>WP Staging </strong> for more than 1 week. May i ask you to give it a <strong>5-star</strong> rating on Wordpress?
|
73 |
<p><strong>Regards,<br>René Hermenau</strong>
|
74 |
<ul>
|
75 |
<li><a href="https://wordpress.org/support/view/plugin-reviews/wp-staging" class="thankyou" target="_new" title="Ok, you deserved it" style="font-weight:bold;">Ok, you deserved it</a></li>
|
239 |
*/
|
240 |
function wpstg_show_beta_message(){
|
241 |
$notice = '<div class="wpstg_beta_notice error" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
242 |
+
<p>WP Staging is well tested and i did my best to catch every possible error i can forecast but i can not handle all possible combinations of different server, plugins and themes. <br><strong>BEFORE</strong> you create your first staging site it´s highly recommended <strong>to make a full backup of your website</strong> first!
|
|
|
|
|
243 |
<p>
|
244 |
One of the best free plugins for an entire wordpress backup is the free one <a href="https://wordpress.org/plugins/backwpup/" target="_blank">BackWPup</a>
|
245 |
+
<p>I am not responsible for any damages this plugin will cause to your site. <br>Do a full backup first!</p>
|
246 |
<ul>
|
247 |
<li><a href="javascript:void(0);" class="wpstg_hide_beta" title="I understand" style="font-weight:bold;color:#00a0d2;">I understand! (Do not show this again)</a></li>
|
248 |
</ul>
|
includes/admin/settings/display-settings.php
CHANGED
@@ -130,16 +130,13 @@ function wpstg_options_page() {
|
|
130 |
ob_start();
|
131 |
?>
|
132 |
<div class="wpstg_admin">
|
133 |
-
<span class="wp-staginglogo"><img src="<?php echo WPSTG_PLUGIN_URL . 'assets/images/logo_clean_small_212_25.png';?>"></span><span class="wpstg-version"><?php echo WPSTG_VERSION . ''; ?></span>
|
134 |
<div class="wpstg-header">
|
135 |
-
<?php echo __('Thank you for using WP Staging.', 'wpstg');?>
|
136 |
-
<br>
|
137 |
-
<?php echo __('WP Staging is ready to create a staging site!', 'wpstg'); ?>
|
138 |
-
<br>
|
139 |
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwordpress.org%2Fplugins%2Fwp-staging%2F&width=100&layout=standard&action=like&show_faces=false&share=true&height=35&appId=449277011881884" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:96px; height:20px;" allowTransparency="true"></iframe>
|
140 |
-
<a class="twitter-follow-button" href="https://twitter.com/
|
141 |
-
|
142 |
-
|
|
|
143 |
<h2 class="nav-tab-wrapper">
|
144 |
<?php
|
145 |
foreach( wpstg_get_settings_tabs() as $tab_id => $tab_name ) {
|
130 |
ob_start();
|
131 |
?>
|
132 |
<div class="wpstg_admin">
|
133 |
+
<span class="wp-staginglogo"><img src="<?php echo WPSTG_PLUGIN_URL . 'assets/images/logo_clean_small_212_25.png';?>"></span><span class="wpstg-version"><?php if (WPSTG_SLUG === 'wp-staging-pro') {echo 'Pro';} ?> Version <?php echo WPSTG_VERSION . ''; ?></span>
|
134 |
<div class="wpstg-header">
|
|
|
|
|
|
|
|
|
135 |
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwordpress.org%2Fplugins%2Fwp-staging%2F&width=100&layout=standard&action=like&show_faces=false&share=true&height=35&appId=449277011881884" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:96px; height:20px;" allowTransparency="true"></iframe>
|
136 |
+
<a class="twitter-follow-button" href="https://twitter.com/wpstg" data-size="small" id="twitter-wjs" style="display: block;">Follow @wpstg</a>
|
137 |
+
<a class="twitter-follow-button" href="https://twitter.com/renehermenau" data-size="small" id="twitter-wjs" style="display: block;">Follow @renehermenau</a>
|
138 |
+
<a href="https://twitter.com/intent/tweet?button_hashtag=wpstaging&text=Check%20out%20this%20plugin%20for%20creating%20a%20one%20click%20WordPress%20testing%20site&via=wpstg" class="twitter-hashtag-button" data-size="small" data-related="ReneHermenau" data-url="https://wordpress.org/plugins/wp-staging/" data-dnt="true">Tweet #wpstaging</a>
|
139 |
+
</div>
|
140 |
<h2 class="nav-tab-wrapper">
|
141 |
<?php
|
142 |
foreach( wpstg_get_settings_tabs() as $tab_id => $tab_name ) {
|
includes/admin/settings/register-settings.php
CHANGED
@@ -161,7 +161,7 @@ function wpstg_get_registered_settings() {
|
|
161 |
array(
|
162 |
'id' => 'wpstg_disabled_plugins',
|
163 |
'name' => __('Optimizer', 'wpstg'),
|
164 |
-
'desc' => __('Select the plugins that should be disabled during build process of the staging site. Some plugins slow down the copy process and add overhead to each request, requiring extra CPU and memory consumption. Some of them can interfere with cloning process and cause them to fail, so we recommend to
|
165 |
'type' => 'install_muplugin',
|
166 |
'size' => 'medium',
|
167 |
'std' => '20',
|
@@ -810,7 +810,7 @@ function wpstg_install_muplugin_callback(){
|
|
810 |
<select autocomplete="off" class="multiselect" id="selected-plugins" name="selected_plugins[]" multiple="multiple" style="min-height:400px;">
|
811 |
<?php
|
812 |
global $wpstg_options;
|
813 |
-
$blacklist = array_flip( (array) $wpstg_options['blacklist_plugins'] );
|
814 |
foreach ( get_plugins() as $key => $plugin ) {
|
815 |
if ( 0 === strpos( $key, 'wp-staging' ) ) {
|
816 |
continue;
|
161 |
array(
|
162 |
'id' => 'wpstg_disabled_plugins',
|
163 |
'name' => __('Optimizer', 'wpstg'),
|
164 |
+
'desc' => __('Select the plugins that should be disabled during build process of the staging site. Some plugins slow down the copy process and add overhead to each request, requiring extra CPU and memory consumption. Some of them can interfere with cloning process and cause them to fail, so we recommend to select all plugins here.<p></p><strong>Note:</strong> This does not disable plugins on your staging site. You have to disable them there separately.', 'wpstg'),
|
165 |
'type' => 'install_muplugin',
|
166 |
'size' => 'medium',
|
167 |
'std' => '20',
|
810 |
<select autocomplete="off" class="multiselect" id="selected-plugins" name="selected_plugins[]" multiple="multiple" style="min-height:400px;">
|
811 |
<?php
|
812 |
global $wpstg_options;
|
813 |
+
$blacklist = isset($wpstg_options['blacklist_plugins']) ? array_flip( (array) $wpstg_options['blacklist_plugins'] ) : array();
|
814 |
foreach ( get_plugins() as $key => $plugin ) {
|
815 |
if ( 0 === strpos( $key, 'wp-staging' ) ) {
|
816 |
continue;
|
includes/admin/tools.php
CHANGED
@@ -26,8 +26,8 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
26 |
function wpstg_tools_page() {
|
27 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'import_export';
|
28 |
?>
|
29 |
-
<div class="wrap">
|
30 |
-
<h2 class="nav-tab-wrapper">
|
31 |
<?php
|
32 |
foreach( wpstg_get_tools_tabs() as $tab_id => $tab_name ) {
|
33 |
|
@@ -455,6 +455,6 @@ function wpstg_tools_sysinfo_download() {
|
|
455 |
header( 'Content-Disposition: attachment; filename="wpstg-system-info.txt"' );
|
456 |
|
457 |
echo wp_strip_all_tags( $_POST['wpstg-sysinfo'] );
|
458 |
-
|
459 |
}
|
460 |
add_action( 'wpstg_download_sysinfo', 'wpstg_tools_sysinfo_download' );
|
26 |
function wpstg_tools_page() {
|
27 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'import_export';
|
28 |
?>
|
29 |
+
<div class="wrap" id="wpstg-tools">
|
30 |
+
<h2 class="wpstg nav-tab-wrapper">
|
31 |
<?php
|
32 |
foreach( wpstg_get_tools_tabs() as $tab_id => $tab_name ) {
|
33 |
|
455 |
header( 'Content-Disposition: attachment; filename="wpstg-system-info.txt"' );
|
456 |
|
457 |
echo wp_strip_all_tags( $_POST['wpstg-sysinfo'] );
|
458 |
+
die();
|
459 |
}
|
460 |
add_action( 'wpstg_download_sysinfo', 'wpstg_tools_sysinfo_download' );
|
includes/error-handling.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Write the debug log for regular events
|
5 |
+
*
|
6 |
+
* @param string $string
|
7 |
+
*/
|
8 |
+
function wpstg_log($string){
|
9 |
+
$wpstg_logger = new wpstgLogger("wpstglog_" . date("Y-m-d") . ".log", wpstgLogger::INFO);
|
10 |
+
$wpstg_logger->info($string);
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Write the debug log for error events
|
15 |
+
*
|
16 |
+
* @param string $string
|
17 |
+
*/
|
18 |
+
function wpstg_log_error($string){
|
19 |
+
$wpstg_logger = new wpstgLogger("wpstglog_" . date("Y-m-d") . ".log", wpstgLogger::INFO);
|
20 |
+
$wpstg_logger->error($string);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Write extended debug messsages into logfiles
|
25 |
+
* when debug mode is enabled
|
26 |
+
*
|
27 |
+
* @param string $error
|
28 |
+
*/
|
29 |
+
function wpstg_debug_log($error){
|
30 |
+
global $wpstg_options;
|
31 |
+
|
32 |
+
if ( isset($wpstg_options['debug_mode']) ){
|
33 |
+
wpstg_log($error);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
includes/logger.php
CHANGED
@@ -125,4 +125,5 @@ class wpstgLogger {
|
|
125 |
|
126 |
}
|
127 |
|
|
|
128 |
?>
|
125 |
|
126 |
}
|
127 |
|
128 |
+
|
129 |
?>
|
includes/template-functions.php
CHANGED
@@ -35,15 +35,12 @@ function wpstg_clone_page() {
|
|
35 |
ob_start();
|
36 |
?>
|
37 |
<div id="wpstg-clonepage-wrapper">
|
38 |
-
<span class="wp-staginglogo"><img src="<?php echo WPSTG_PLUGIN_URL . 'assets/images/logo_clean_small_212_25.png';?>"></span><span class="wpstg-version"><?php echo WPSTG_VERSION . ''; ?></span>
|
39 |
<div class="wpstg-header">
|
40 |
-
<?php echo __('Thank you for using WP Staging', 'wpstg');?>
|
41 |
-
<br>
|
42 |
-
<?php echo __('WP Staging is ready to create a staging site!', 'wpstg'); ?>
|
43 |
-
<br>
|
44 |
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwordpress.org%2Fplugins%2Fwp-staging%2F&width=100&layout=button&action=like&show_faces=false&share=true&height=35&appId=449277011881884" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:96px; height:20px;" allowTransparency="true"></iframe>
|
45 |
-
<a class="twitter-follow-button" href="https://twitter.com/
|
46 |
-
|
|
|
47 |
</div>
|
48 |
<?php do_action('wpstg_notifications');?>
|
49 |
<?php if (is_multisite()) {
|
@@ -104,10 +101,12 @@ function wpstg_overview() {
|
|
104 |
<?php foreach ($existing_clones as $clone) : ?>
|
105 |
<div class="wpstg-clone" id="<?php echo $clone; ?>">
|
106 |
<a href="<?php echo get_home_url() . "/$clone/wp-login.php"; ?>" class="wpstg-clone-title" target="_blank"><?php echo $clone; ?></a>
|
|
|
107 |
<a href="<?php echo get_home_url() . "/$clone/wp-login.php"; ?>" class="wpstg-open-clone wpstg-clone-action" target="_blank"><?php _e('Open', 'wpstg'); ?></a>
|
108 |
<a href="#" class="wpstg-execute-clone wpstg-clone-action" data-clone="<?php echo $clone; ?>"><?php _e('Edit', 'wpstg'); ?></a>
|
109 |
<a href="#" class="wpstg-remove-clone wpstg-clone-action" data-clone="<?php echo $clone; ?>"><?php _e('Delete', 'wpstg'); ?></a>
|
110 |
<!--<a href="#" class="wpstg-edit-clone wpstg-clone-action" data-clone="<?php //echo $clone; ?>"><?php //_e('Edit', 'wpstg'); ?></a>-->
|
|
|
111 |
</div> <!-- .wpstg-clone -->
|
112 |
<?php endforeach; ?>
|
113 |
<?php endif; ?>
|
@@ -159,8 +158,6 @@ function wpstg_scanning() {
|
|
159 |
//Scan Files
|
160 |
$wpstg_clone_details['total_size'] = 0;
|
161 |
unset($wpstg_clone_details['large_files']);
|
162 |
-
//$folders = wpstg_scan_files(rtrim(get_home_path(), '/'));
|
163 |
-
//$folders = wpstg_scan_files(get_home_path());
|
164 |
$folders = wpstg_scan_files(wpstg_get_clone_root_path());
|
165 |
|
166 |
array_pop($folders);
|
@@ -194,7 +191,7 @@ function wpstg_scanning() {
|
|
194 |
<div class="wpstg-tab-section" id="wpstg-scanning-db">
|
195 |
<?php
|
196 |
do_action('wpstg_scanning_db');
|
197 |
-
echo '<h4 style="margin:0px;">' . __('
|
198 |
wpstg_show_tables($tables, $unchecked_tables); ?>
|
199 |
</div> <!-- #wpstg-scanning-db -->
|
200 |
|
@@ -205,7 +202,7 @@ function wpstg_scanning() {
|
|
205 |
<div class="wpstg-tab-section" id="wpstg-scanning-files">
|
206 |
|
207 |
<?php
|
208 |
-
echo '<h4 style="margin:0px;">' . __('
|
209 |
wpstg_directory_structure($folders, null, false, false, $excluded_folders);
|
210 |
wpstg_show_large_files();
|
211 |
echo '<p><span id=wpstg-file-summary>' . __('Files will be copied into subfolder of: ','wpstg') . wpstg_get_clone_root_path() . '</span>';
|
@@ -519,7 +516,7 @@ function wpstg_cloning() {
|
|
519 |
<div class="wpstg-progress" id="wpstg-files-progress" style="width: <?php echo 100 * $wpstg_clone_details['files_progress']; ?>%;"></div>
|
520 |
</div>
|
521 |
</div>
|
522 |
-
<div class="wpstg-cloning-section"><?php echo __('Replace
|
523 |
<div class="wpstg-progress-bar">
|
524 |
<div class="wpstg-progress" id="wpstg-links-progress" style="width: <?php echo 100 * $wpstg_clone_details['links_progress']; ?>%"></div>
|
525 |
</div>
|
@@ -651,7 +648,8 @@ function wpstg_clone_db_internal() {
|
|
651 |
if (empty($tables)) { //exit condition
|
652 |
$wpstg_clone_details['db_progress'] = 1;
|
653 |
wpstg_save_options();
|
654 |
-
|
|
|
655 |
wpstg_return_json('wpstg_clone_db_internal', 'success', 'DB has been cloned successfully', 1, wpstg_get_runtime());
|
656 |
}
|
657 |
$table = reset($tables);
|
@@ -703,16 +701,16 @@ function wpstg_clone_db_internal() {
|
|
703 |
$wpstg_clone_details['db_progress'] = $cloned_tables_count / $all_tables_count;
|
704 |
wpstg_save_options();
|
705 |
$log_data .= '[' . date('d-m-Y H:i:s') . '] Copy database table: ' . $table . '<br>';
|
706 |
-
|
707 |
wpstg_return_json('wpstg_clone_db_internal', 'success', wpstg_get_log_data($progress) . $log_data, $wpstg_clone_details['db_progress'], wpstg_get_runtime());
|
708 |
}
|
709 |
} else {
|
710 |
-
|
711 |
wpstg_save_options();
|
712 |
//wpstg_return_json('wpstg_clone_db_internal', 'fail', 'Table ' . $new_table . ' has been created, BUT inserting rows failed. This happens sometimes when a table had been updated during staging process. Exclude this table from copying and try again. Offset: ' . $offset, $wpstg_clone_details['db_progress'] . ' ', wpstg_get_runtime());
|
713 |
}
|
714 |
} else {
|
715 |
-
|
716 |
wpstg_save_options();
|
717 |
wpstg_return_json('wpstg_clone_db_internal', 'fail', 'Copying table ' . $table . ' has been failed.', $wpstg_clone_details['db_progress'], wpstg_get_runtime());
|
718 |
}
|
@@ -754,7 +752,7 @@ function wpstg_clone_db_external($db_helper) {
|
|
754 |
if (empty($tables)) { //exit condition
|
755 |
$wpstg_clone_details['db_progress'] = 1;
|
756 |
wpstg_save_options();
|
757 |
-
|
758 |
wp_die(1);
|
759 |
}
|
760 |
$table = reset($tables);
|
@@ -810,17 +808,17 @@ function wpstg_clone_db_external($db_helper) {
|
|
810 |
$cloned_tables_count = count($wpstg_clone_details['cloned_tables']);
|
811 |
$wpstg_clone_details['db_progress'] = $cloned_tables_count / $all_tables_count;
|
812 |
wpstg_save_options();
|
813 |
-
|
814 |
wp_die($wpstg_clone_details['db_progress']);
|
815 |
}
|
816 |
} else {
|
817 |
-
|
818 |
wpstg_save_options();
|
819 |
//wp_die(-1);
|
820 |
wp_die('Table ' . $new_table . ' has been created, BUT inserting rows failed. Offset: ' . $offset);
|
821 |
}
|
822 |
} else {
|
823 |
-
|
824 |
wpstg_save_options();
|
825 |
//wp_die(-1);
|
826 |
wp_die('Creating table ' . $table . ' has been failed.');
|
@@ -886,7 +884,7 @@ function wpstg_copy_files() {
|
|
886 |
if ( is_file($files[$i]) && file_exists($files[$i]) && $size > $batch_size ) { // is_file() checks if its a symlink or real file
|
887 |
//if ( is_file($files[$i] && file_exists($files[$i] && $size > $batch_size) ) ) { // is_file() checks if its a symlink or real file
|
888 |
if (wpstg_copy_large_file($files[$i], $new_file, $batch_size)) {
|
889 |
-
//
|
890 |
$wpstg_clone_details['file_index'] = $i + 1;
|
891 |
//$part = ($batch + $size) / $wpstg_clone_details['total_size'];
|
892 |
$part = $batch / $wpstg_clone_details['total_size'];
|
@@ -894,7 +892,7 @@ function wpstg_copy_files() {
|
|
894 |
wpstg_save_options();
|
895 |
wpstg_return_json('wpstg_copy_files', 'success', '<br> [' . date('d-m-Y H:i:s') . '] Copy LARGE file: ' . $files[$i] . '. Batch size: ' . wpstg_short_size($batch + $size) . ' (' . ($batch + $size) . ' bytes)', $wpstg_clone_details['files_progress'], wpstg_get_runtime());
|
896 |
} else {
|
897 |
-
|
898 |
$wpstg_clone_details['file_index'] = $i + 1; //increment it because we want to skip this file when it can not be copied successfully
|
899 |
$part = $batch / $wpstg_clone_details['total_size'];
|
900 |
$wpstg_clone_details['files_progress'] += $part;
|
@@ -906,10 +904,10 @@ function wpstg_copy_files() {
|
|
906 |
//if ( is_readable( $files[$i] ) && is_file($files[$i]) && copy($files[$i], $new_file)) {
|
907 |
if ( is_readable( $files[$i] ) && copy($files[$i], $new_file)) {
|
908 |
$batch += $size;
|
909 |
-
|
910 |
//wpstg_return_json('wpstg_copy_files', 'success', '[' . date('d-m-Y H:i:s') . '] Copy file no: ' . $i . ' Total files:' . count($files) .' File: ' . $files[$i] . ' to ' . $new_file, $wpstg_clone_details['files_progress'], wpstg_get_runtime());
|
911 |
} else {
|
912 |
-
|
913 |
$wpstg_clone_details['file_index'] = $i + 1; //increment it because we want to skip this file when it can not be copied successfully
|
914 |
$part = $batch / $wpstg_clone_details['total_size'];
|
915 |
$wpstg_clone_details['files_progress'] += $part;
|
@@ -919,7 +917,7 @@ function wpstg_copy_files() {
|
|
919 |
wpstg_return_json('wpstg_copy_files', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span> Copying file has been failed and will be skipped: ' . $files[$i], $wpstg_clone_details['files_progress'], wpstg_get_runtime());
|
920 |
}
|
921 |
} else {
|
922 |
-
|
923 |
$wpstg_clone_details['file_index'] = $i;
|
924 |
$part = $batch / $wpstg_clone_details['total_size'];
|
925 |
$wpstg_clone_details['files_progress'] += $part;
|
@@ -1032,13 +1030,13 @@ function wpstg_replace_links() {
|
|
1032 |
if (!$result) {
|
1033 |
$wpstg_clone_details['links_progress'] = 0.33;
|
1034 |
$error = isset($db_helper->dbh->error) ? $db_helper->dbh->error : '';
|
1035 |
-
|
1036 |
//wp_die($db_helper->dbh->error);
|
1037 |
wpstg_save_options();
|
1038 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span>Replacing site url has been failed. DB Error: ' . $error, $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1039 |
} else {
|
1040 |
$wpstg_clone_details['links_progress'] = 0.33;
|
1041 |
-
|
1042 |
wpstg_save_options();
|
1043 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Replacing "siteurl" has been done succesfully', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1044 |
}
|
@@ -1053,14 +1051,14 @@ function wpstg_replace_links() {
|
|
1053 |
);
|
1054 |
if (!$result) {
|
1055 |
$wpstg_clone_details['links_progress'] = 0.43;
|
1056 |
-
|
1057 |
//wp_die(-1);
|
1058 |
//wp_die('Updating option[wpstg_is_staging_site] has been failed');
|
1059 |
wpstg_save_options();
|
1060 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span> Updating db' . $new_prefix . 'options where option_name = wpstg_is_staging_site has been failed', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1061 |
} else {
|
1062 |
$wpstg_clone_details['links_progress'] = 0.43;
|
1063 |
-
|
1064 |
wpstg_save_options();
|
1065 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Updating option [wpstg_is_staging_site] has been done succesfully', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1066 |
}
|
@@ -1075,7 +1073,7 @@ function wpstg_replace_links() {
|
|
1075 |
)
|
1076 |
);
|
1077 |
if (!$result) {
|
1078 |
-
|
1079 |
$wpstg_clone_details['links_progress'] = 0.45;
|
1080 |
// Do not die here. This db option is not available on sites with permalinks disabled, so we want to continue
|
1081 |
//wp_die(-1);
|
@@ -1083,7 +1081,7 @@ function wpstg_replace_links() {
|
|
1083 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] Updating option[rewrite_rules] was not possible. Will be skipped! Usually this is no problem and happens only when main site has no permalinks enabled!', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1084 |
} else {
|
1085 |
$wpstg_clone_details['links_progress'] = 0.45;
|
1086 |
-
|
1087 |
wpstg_save_options();
|
1088 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Updating option [rewrite_rules] has been done succesfully', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1089 |
|
@@ -1110,13 +1108,13 @@ function wpstg_replace_links() {
|
|
1110 |
);
|
1111 |
if (!$result_options || !$result_usermeta) {
|
1112 |
$wpstg_clone_details['links_progress'] = 0.66;
|
1113 |
-
|
1114 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . ']<span style="color:red;">Fatal error!</span> Updating table ' . $new_prefix . ' has been failed.', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1115 |
//wp_die(.51);
|
1116 |
//wp_die('Updating table ' . $new_prefix . ' has been failed.');
|
1117 |
} else {
|
1118 |
$wpstg_clone_details['links_progress'] = 0.66;
|
1119 |
-
|
1120 |
wpstg_save_options();
|
1121 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Updating prefix name ' . $wpdb->prefix . ' to ' . $new_prefix . ' has been done succesfully.', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1122 |
}
|
@@ -1138,14 +1136,14 @@ function wpstg_replace_links() {
|
|
1138 |
}
|
1139 |
if (FALSE === file_put_contents($path, $content)) {
|
1140 |
wpstg_save_options(); // we have to die hier @to do write function
|
1141 |
-
|
1142 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fatal error: </span>Can not modify ' . $path . ' !', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1143 |
}else{
|
1144 |
wpstg_save_options();
|
1145 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] ' . $path . ' has been successfully modified!', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1146 |
}
|
1147 |
} else {
|
1148 |
-
|
1149 |
wpstg_save_options();
|
1150 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span>' . $path . ' is not writable', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1151 |
}
|
@@ -1197,14 +1195,14 @@ function wpstg_reset_index_php($progress){
|
|
1197 |
|
1198 |
if (FALSE === file_put_contents($path, $content)) {
|
1199 |
wpstg_save_options(); // we should throw fatal error here to die @todo create function()
|
1200 |
-
|
1201 |
wpstg_return_json('wpstg_wp_in_subdirectory', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fatal error: </span>Can not modify ' . $path . ' !', $progress, wpstg_get_runtime());
|
1202 |
} else {
|
1203 |
wpstg_save_options();
|
1204 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] ' . $path . ' has been successfully modified!', $progress, wpstg_get_runtime());
|
1205 |
}
|
1206 |
} else {
|
1207 |
-
|
1208 |
wpstg_save_options();
|
1209 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span>' . $path . ' is not writable', $progress, wpstg_get_runtime());
|
1210 |
}
|
@@ -1221,13 +1219,13 @@ function wpstg_clear_options() {
|
|
1221 |
if (wp_is_writable($path)) {
|
1222 |
file_put_contents($path, '');
|
1223 |
}
|
1224 |
-
|
1225 |
|
1226 |
$path = wpstg_get_upload_dir() . '/remaining_files.json';
|
1227 |
if (wp_is_writable($path)) {
|
1228 |
file_put_contents($path, '');
|
1229 |
}
|
1230 |
-
|
1231 |
}
|
1232 |
|
1233 |
/** Check the files before removing
|
@@ -1327,7 +1325,7 @@ function wpstg_remove_clone($isAjax = true) {
|
|
1327 |
$clone = $_POST['cloneID'];
|
1328 |
|
1329 |
if (empty ($clone) || $clone === '' ) {
|
1330 |
-
|
1331 |
//wp_die(-1);
|
1332 |
wp_die('cloneID does not exist or is empty');
|
1333 |
}
|
@@ -1338,24 +1336,26 @@ function wpstg_remove_clone($isAjax = true) {
|
|
1338 |
$unchecked_tables = isset($_POST['uncheckedTables']) ? $_POST['uncheckedTables'] : array();
|
1339 |
$tables = array_diff($tables, $unchecked_tables);
|
1340 |
foreach ($tables as $table) {
|
1341 |
-
if (! wpstg_is_root_table($table, $wpdb->prefix))
|
1342 |
$result = $db_helper->query("drop table `$table`");
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
|
|
|
|
1349 |
}
|
1350 |
|
1351 |
//remove clone folder
|
1352 |
$excluded_folders = isset($_POST['excludedFolders']) ? $_POST['excludedFolders'] : array();
|
1353 |
$result = wpstgDeleteDirectory(get_home_path() . $clone, $excluded_folders);
|
1354 |
if (! $result) {
|
1355 |
-
|
1356 |
wp_die(-1);
|
1357 |
}
|
1358 |
-
|
1359 |
$existing_clones = get_option('wpstg_existing_clones', array());
|
1360 |
$key = array_search($clone, $existing_clones);
|
1361 |
|
@@ -1366,7 +1366,8 @@ function wpstg_remove_clone($isAjax = true) {
|
|
1366 |
|
1367 |
do_action('wpstg_remove_clone', $clone);
|
1368 |
if ($isAjax) {
|
1369 |
-
|
|
|
1370 |
wp_die(0);
|
1371 |
}
|
1372 |
}
|
@@ -1459,7 +1460,7 @@ function wpstg_save_options() {
|
|
1459 |
$file = 'clone_details.json';
|
1460 |
file_put_contents($path . '/' . $file, json_encode($wpstg_clone_details));
|
1461 |
}else {
|
1462 |
-
|
1463 |
}
|
1464 |
}
|
1465 |
|
@@ -1469,7 +1470,7 @@ function wpstg_save_options() {
|
|
1469 |
function wpstg_error_processing() {
|
1470 |
$msg = sanitize_text_field($_POST['wpstg_error_msg']);
|
1471 |
if (! empty($msg))
|
1472 |
-
|
1473 |
wp_die();
|
1474 |
}
|
1475 |
add_action('wp_ajax_wpstg_error_processing', 'wpstg_error_processing');
|
@@ -1693,18 +1694,6 @@ function wpstg_check_diskspace($clone_size) {
|
|
1693 |
return $overflow ? '<br>' . __('Probably not enough free disk space to create a staging site. <br> You can continue but its likely that the copying process will fail.', 'wpstg') : '';
|
1694 |
}
|
1695 |
|
1696 |
-
/**
|
1697 |
-
* Write extended debug messsages into logfiles
|
1698 |
-
*
|
1699 |
-
* @param string $error
|
1700 |
-
*/
|
1701 |
-
function wpstg_debug_log($error){
|
1702 |
-
global $wpstg_options;
|
1703 |
-
|
1704 |
-
if ( isset($wpstg_options['debug_mode']) )
|
1705 |
-
WPSTG()->logger->info($error);
|
1706 |
-
}
|
1707 |
-
|
1708 |
/**
|
1709 |
* Get URL of staging site
|
1710 |
*
|
35 |
ob_start();
|
36 |
?>
|
37 |
<div id="wpstg-clonepage-wrapper">
|
38 |
+
<span class="wp-staginglogo"><img src="<?php echo WPSTG_PLUGIN_URL . 'assets/images/logo_clean_small_212_25.png';?>"></span><span class="wpstg-version"><?php if (WPSTG_SLUG === 'wp-staging-pro') {echo 'Pro';} ?> Version <?php echo WPSTG_VERSION . ''; ?></span>
|
39 |
<div class="wpstg-header">
|
|
|
|
|
|
|
|
|
40 |
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwordpress.org%2Fplugins%2Fwp-staging%2F&width=100&layout=button&action=like&show_faces=false&share=true&height=35&appId=449277011881884" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:96px; height:20px;" allowTransparency="true"></iframe>
|
41 |
+
<a class="twitter-follow-button" href="https://twitter.com/wpstg" data-size="small" id="twitter-wjs" style="display: block;">Follow @wpstg</a>
|
42 |
+
<a class="twitter-follow-button" href="https://twitter.com/renehermenau" data-size="small" id="twitter-wjs" style="display: block;">Follow @renehermenau</a>
|
43 |
+
<a href="https://twitter.com/intent/tweet?button_hashtag=wpstaging&text=Check%20out%20this%20plugin%20for%20creating%20a%20one%20click%20WordPress%20testing%20site&via=wpstg" class="twitter-hashtag-button" data-size="small" data-related="ReneHermenau" data-url="https://wordpress.org/plugins/wp-staging/" data-dnt="true">Tweet #wpstaging</a>
|
44 |
</div>
|
45 |
<?php do_action('wpstg_notifications');?>
|
46 |
<?php if (is_multisite()) {
|
101 |
<?php foreach ($existing_clones as $clone) : ?>
|
102 |
<div class="wpstg-clone" id="<?php echo $clone; ?>">
|
103 |
<a href="<?php echo get_home_url() . "/$clone/wp-login.php"; ?>" class="wpstg-clone-title" target="_blank"><?php echo $clone; ?></a>
|
104 |
+
<?php echo apply_filters('wpstg_before_stage_buttons', $html = '', $clone); ?>
|
105 |
<a href="<?php echo get_home_url() . "/$clone/wp-login.php"; ?>" class="wpstg-open-clone wpstg-clone-action" target="_blank"><?php _e('Open', 'wpstg'); ?></a>
|
106 |
<a href="#" class="wpstg-execute-clone wpstg-clone-action" data-clone="<?php echo $clone; ?>"><?php _e('Edit', 'wpstg'); ?></a>
|
107 |
<a href="#" class="wpstg-remove-clone wpstg-clone-action" data-clone="<?php echo $clone; ?>"><?php _e('Delete', 'wpstg'); ?></a>
|
108 |
<!--<a href="#" class="wpstg-edit-clone wpstg-clone-action" data-clone="<?php //echo $clone; ?>"><?php //_e('Edit', 'wpstg'); ?></a>-->
|
109 |
+
<?php echo apply_filters('wpstg_after_stage_buttons', $html = '', $clone); ?>
|
110 |
</div> <!-- .wpstg-clone -->
|
111 |
<?php endforeach; ?>
|
112 |
<?php endif; ?>
|
158 |
//Scan Files
|
159 |
$wpstg_clone_details['total_size'] = 0;
|
160 |
unset($wpstg_clone_details['large_files']);
|
|
|
|
|
161 |
$folders = wpstg_scan_files(wpstg_get_clone_root_path());
|
162 |
|
163 |
array_pop($folders);
|
191 |
<div class="wpstg-tab-section" id="wpstg-scanning-db">
|
192 |
<?php
|
193 |
do_action('wpstg_scanning_db');
|
194 |
+
echo '<h4 style="margin:0px;">' . __('Uncheck the tables you do not want to copy. (If the copy process was previously interrupted, succesfull copied tables are greyed out and copy process will skip these ones)', 'wpstg') . '<h4>';
|
195 |
wpstg_show_tables($tables, $unchecked_tables); ?>
|
196 |
</div> <!-- #wpstg-scanning-db -->
|
197 |
|
202 |
<div class="wpstg-tab-section" id="wpstg-scanning-files">
|
203 |
|
204 |
<?php
|
205 |
+
echo '<h4 style="margin:0px;">' . __('Uncheck the folders you do not want to copy. Click on them for expanding!', 'wpstg') . '<h4>';
|
206 |
wpstg_directory_structure($folders, null, false, false, $excluded_folders);
|
207 |
wpstg_show_large_files();
|
208 |
echo '<p><span id=wpstg-file-summary>' . __('Files will be copied into subfolder of: ','wpstg') . wpstg_get_clone_root_path() . '</span>';
|
516 |
<div class="wpstg-progress" id="wpstg-files-progress" style="width: <?php echo 100 * $wpstg_clone_details['files_progress']; ?>%;"></div>
|
517 |
</div>
|
518 |
</div>
|
519 |
+
<div class="wpstg-cloning-section"><?php echo __('Replace Data', 'wpstg');?>
|
520 |
<div class="wpstg-progress-bar">
|
521 |
<div class="wpstg-progress" id="wpstg-links-progress" style="width: <?php echo 100 * $wpstg_clone_details['links_progress']; ?>%"></div>
|
522 |
</div>
|
648 |
if (empty($tables)) { //exit condition
|
649 |
$wpstg_clone_details['db_progress'] = 1;
|
650 |
wpstg_save_options();
|
651 |
+
wpstg_log('DB has been cloned successfully');
|
652 |
+
|
653 |
wpstg_return_json('wpstg_clone_db_internal', 'success', 'DB has been cloned successfully', 1, wpstg_get_runtime());
|
654 |
}
|
655 |
$table = reset($tables);
|
701 |
$wpstg_clone_details['db_progress'] = $cloned_tables_count / $all_tables_count;
|
702 |
wpstg_save_options();
|
703 |
$log_data .= '[' . date('d-m-Y H:i:s') . '] Copy database table: ' . $table . '<br>';
|
704 |
+
wpstg_log( 'Query limit exceeded. Starting new query batch! Table: ' . $table);
|
705 |
wpstg_return_json('wpstg_clone_db_internal', 'success', wpstg_get_log_data($progress) . $log_data, $wpstg_clone_details['db_progress'], wpstg_get_runtime());
|
706 |
}
|
707 |
} else {
|
708 |
+
wpstg_log('Table ' . $new_table . ' has been created, but inserting rows failed! Rows will be skipped. Offset: ' . $offset . '');
|
709 |
wpstg_save_options();
|
710 |
//wpstg_return_json('wpstg_clone_db_internal', 'fail', 'Table ' . $new_table . ' has been created, BUT inserting rows failed. This happens sometimes when a table had been updated during staging process. Exclude this table from copying and try again. Offset: ' . $offset, $wpstg_clone_details['db_progress'] . ' ', wpstg_get_runtime());
|
711 |
}
|
712 |
} else {
|
713 |
+
wpstg_log('Creating table ' . $table . ' has been failed.');
|
714 |
wpstg_save_options();
|
715 |
wpstg_return_json('wpstg_clone_db_internal', 'fail', 'Copying table ' . $table . ' has been failed.', $wpstg_clone_details['db_progress'], wpstg_get_runtime());
|
716 |
}
|
752 |
if (empty($tables)) { //exit condition
|
753 |
$wpstg_clone_details['db_progress'] = 1;
|
754 |
wpstg_save_options();
|
755 |
+
wpstg_log('DB has been cloned successfully');
|
756 |
wp_die(1);
|
757 |
}
|
758 |
$table = reset($tables);
|
808 |
$cloned_tables_count = count($wpstg_clone_details['cloned_tables']);
|
809 |
$wpstg_clone_details['db_progress'] = $cloned_tables_count / $all_tables_count;
|
810 |
wpstg_save_options();
|
811 |
+
wpstg_log('Query limit is exceeded. Current Table: ' . $table);
|
812 |
wp_die($wpstg_clone_details['db_progress']);
|
813 |
}
|
814 |
} else {
|
815 |
+
wpstg_log('Table ' . $new_table . ' has been created, BUT inserting rows failed. Offset: ' . $offset);
|
816 |
wpstg_save_options();
|
817 |
//wp_die(-1);
|
818 |
wp_die('Table ' . $new_table . ' has been created, BUT inserting rows failed. Offset: ' . $offset);
|
819 |
}
|
820 |
} else {
|
821 |
+
wpstg_log('Creating table ' . $table . ' has been failed.');
|
822 |
wpstg_save_options();
|
823 |
//wp_die(-1);
|
824 |
wp_die('Creating table ' . $table . ' has been failed.');
|
884 |
if ( is_file($files[$i]) && file_exists($files[$i]) && $size > $batch_size ) { // is_file() checks if its a symlink or real file
|
885 |
//if ( is_file($files[$i] && file_exists($files[$i] && $size > $batch_size) ) ) { // is_file() checks if its a symlink or real file
|
886 |
if (wpstg_copy_large_file($files[$i], $new_file, $batch_size)) {
|
887 |
+
//wpstg_log('Copy LARGE file: ' . $files[$i] . '. Batch size: ' . wpstg_short_size($batch + $size) . ' (' . ($batch + $size) . ' bytes)');
|
888 |
$wpstg_clone_details['file_index'] = $i + 1;
|
889 |
//$part = ($batch + $size) / $wpstg_clone_details['total_size'];
|
890 |
$part = $batch / $wpstg_clone_details['total_size'];
|
892 |
wpstg_save_options();
|
893 |
wpstg_return_json('wpstg_copy_files', 'success', '<br> [' . date('d-m-Y H:i:s') . '] Copy LARGE file: ' . $files[$i] . '. Batch size: ' . wpstg_short_size($batch + $size) . ' (' . ($batch + $size) . ' bytes)', $wpstg_clone_details['files_progress'], wpstg_get_runtime());
|
894 |
} else {
|
895 |
+
wpstg_log('Copying LARGE file has been failed and will be skipped: ' . $files[$i]);
|
896 |
$wpstg_clone_details['file_index'] = $i + 1; //increment it because we want to skip this file when it can not be copied successfully
|
897 |
$part = $batch / $wpstg_clone_details['total_size'];
|
898 |
$wpstg_clone_details['files_progress'] += $part;
|
904 |
//if ( is_readable( $files[$i] ) && is_file($files[$i]) && copy($files[$i], $new_file)) {
|
905 |
if ( is_readable( $files[$i] ) && copy($files[$i], $new_file)) {
|
906 |
$batch += $size;
|
907 |
+
wpstg_log('Copy file no: ' . $i . ' Total files:' . count($files) .' File: ' . $files[$i] . ' to ' . $new_file);
|
908 |
//wpstg_return_json('wpstg_copy_files', 'success', '[' . date('d-m-Y H:i:s') . '] Copy file no: ' . $i . ' Total files:' . count($files) .' File: ' . $files[$i] . ' to ' . $new_file, $wpstg_clone_details['files_progress'], wpstg_get_runtime());
|
909 |
} else {
|
910 |
+
wpstg_log('Copying file has been failed and will be skipped: ' . $files[$i]);
|
911 |
$wpstg_clone_details['file_index'] = $i + 1; //increment it because we want to skip this file when it can not be copied successfully
|
912 |
$part = $batch / $wpstg_clone_details['total_size'];
|
913 |
$wpstg_clone_details['files_progress'] += $part;
|
917 |
wpstg_return_json('wpstg_copy_files', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span> Copying file has been failed and will be skipped: ' . $files[$i], $wpstg_clone_details['files_progress'], wpstg_get_runtime());
|
918 |
}
|
919 |
} else {
|
920 |
+
wpstg_log('Batch size: ' . wpstg_short_size($batch) . ' (' . $batch . ' bytes)' . '. Current File: ' . $files[$i]);
|
921 |
$wpstg_clone_details['file_index'] = $i;
|
922 |
$part = $batch / $wpstg_clone_details['total_size'];
|
923 |
$wpstg_clone_details['files_progress'] += $part;
|
1030 |
if (!$result) {
|
1031 |
$wpstg_clone_details['links_progress'] = 0.33;
|
1032 |
$error = isset($db_helper->dbh->error) ? $db_helper->dbh->error : '';
|
1033 |
+
wpstg_log_error('Replacing site url has been failed. ' . $error);
|
1034 |
//wp_die($db_helper->dbh->error);
|
1035 |
wpstg_save_options();
|
1036 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span>Replacing site url has been failed. DB Error: ' . $error, $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1037 |
} else {
|
1038 |
$wpstg_clone_details['links_progress'] = 0.33;
|
1039 |
+
wpstg_log('Replacing siteurl has been done succesfully');
|
1040 |
wpstg_save_options();
|
1041 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Replacing "siteurl" has been done succesfully', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1042 |
}
|
1051 |
);
|
1052 |
if (!$result) {
|
1053 |
$wpstg_clone_details['links_progress'] = 0.43;
|
1054 |
+
wpstg_log('Updating db table ' . $new_prefix . 'options where option_name = wpstg_is_staging_site has been failed');
|
1055 |
//wp_die(-1);
|
1056 |
//wp_die('Updating option[wpstg_is_staging_site] has been failed');
|
1057 |
wpstg_save_options();
|
1058 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span> Updating db' . $new_prefix . 'options where option_name = wpstg_is_staging_site has been failed', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1059 |
} else {
|
1060 |
$wpstg_clone_details['links_progress'] = 0.43;
|
1061 |
+
wpstg_log('Updating option [wpstg_is_staging_site] has been done succesfully');
|
1062 |
wpstg_save_options();
|
1063 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Updating option [wpstg_is_staging_site] has been done succesfully', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1064 |
}
|
1073 |
)
|
1074 |
);
|
1075 |
if (!$result) {
|
1076 |
+
wpstg_log_error('Updating option[rewrite_rules] not successfull, likely the main site is not using permalinks');
|
1077 |
$wpstg_clone_details['links_progress'] = 0.45;
|
1078 |
// Do not die here. This db option is not available on sites with permalinks disabled, so we want to continue
|
1079 |
//wp_die(-1);
|
1081 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] Updating option[rewrite_rules] was not possible. Will be skipped! Usually this is no problem and happens only when main site has no permalinks enabled!', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1082 |
} else {
|
1083 |
$wpstg_clone_details['links_progress'] = 0.45;
|
1084 |
+
wpstg_log('Updating option [rewrite_rules] has been done succesfully');
|
1085 |
wpstg_save_options();
|
1086 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Updating option [rewrite_rules] has been done succesfully', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1087 |
|
1108 |
);
|
1109 |
if (!$result_options || !$result_usermeta) {
|
1110 |
$wpstg_clone_details['links_progress'] = 0.66;
|
1111 |
+
wpstg_log_error('Updating table ' . $new_prefix . ' has been failed.');
|
1112 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . ']<span style="color:red;">Fatal error!</span> Updating table ' . $new_prefix . ' has been failed.', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1113 |
//wp_die(.51);
|
1114 |
//wp_die('Updating table ' . $new_prefix . ' has been failed.');
|
1115 |
} else {
|
1116 |
$wpstg_clone_details['links_progress'] = 0.66;
|
1117 |
+
wpstg_log('Updating db prefix "' . $wpdb->prefix . '" to "' . $new_prefix . '" has been done succesfully.');
|
1118 |
wpstg_save_options();
|
1119 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] Updating prefix name ' . $wpdb->prefix . ' to ' . $new_prefix . ' has been done succesfully.', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1120 |
}
|
1136 |
}
|
1137 |
if (FALSE === file_put_contents($path, $content)) {
|
1138 |
wpstg_save_options(); // we have to die hier @to do write function
|
1139 |
+
wpstg_log($path . ' is not writable');
|
1140 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fatal error: </span>Can not modify ' . $path . ' !', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1141 |
}else{
|
1142 |
wpstg_save_options();
|
1143 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] ' . $path . ' has been successfully modified!', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1144 |
}
|
1145 |
} else {
|
1146 |
+
wpstg_log_error($path . ' is not readable.');
|
1147 |
wpstg_save_options();
|
1148 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span>' . $path . ' is not writable', $wpstg_clone_details['links_progress'], wpstg_get_runtime());
|
1149 |
}
|
1195 |
|
1196 |
if (FALSE === file_put_contents($path, $content)) {
|
1197 |
wpstg_save_options(); // we should throw fatal error here to die @todo create function()
|
1198 |
+
wpstg_log_error($path . ' is not writable');
|
1199 |
wpstg_return_json('wpstg_wp_in_subdirectory', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fatal error: </span>Can not modify ' . $path . ' !', $progress, wpstg_get_runtime());
|
1200 |
} else {
|
1201 |
wpstg_save_options();
|
1202 |
wpstg_return_json('wpstg_replace_links', 'success', '[' . date('d-m-Y H:i:s') . '] ' . $path . ' has been successfully modified!', $progress, wpstg_get_runtime());
|
1203 |
}
|
1204 |
} else {
|
1205 |
+
wpstg_log($path . ' is not readable.');
|
1206 |
wpstg_save_options();
|
1207 |
wpstg_return_json('wpstg_replace_links', 'fail', '[' . date('d-m-Y H:i:s') . '] <span style="color:red;">Fail: </span>' . $path . ' is not writable', $progress, wpstg_get_runtime());
|
1208 |
}
|
1219 |
if (wp_is_writable($path)) {
|
1220 |
file_put_contents($path, '');
|
1221 |
}
|
1222 |
+
wpstg_log(wpstg_get_upload_dir() . '/clone_details.json has been purged successfully');
|
1223 |
|
1224 |
$path = wpstg_get_upload_dir() . '/remaining_files.json';
|
1225 |
if (wp_is_writable($path)) {
|
1226 |
file_put_contents($path, '');
|
1227 |
}
|
1228 |
+
wpstg_log(wpstg_get_upload_dir() . '/remaining_files.json has been purged successfully');
|
1229 |
}
|
1230 |
|
1231 |
/** Check the files before removing
|
1325 |
$clone = $_POST['cloneID'];
|
1326 |
|
1327 |
if (empty ($clone) || $clone === '' ) {
|
1328 |
+
wpstg_log('cloneID does not exist or is empty');
|
1329 |
//wp_die(-1);
|
1330 |
wp_die('cloneID does not exist or is empty');
|
1331 |
}
|
1336 |
$unchecked_tables = isset($_POST['uncheckedTables']) ? $_POST['uncheckedTables'] : array();
|
1337 |
$tables = array_diff($tables, $unchecked_tables);
|
1338 |
foreach ($tables as $table) {
|
1339 |
+
if (! wpstg_is_root_table($table, $wpdb->prefix) && !empty($table) ) {
|
1340 |
$result = $db_helper->query("drop table `$table`");
|
1341 |
+
if ( !isset($result) || false === $result | 0 === $result ) {
|
1342 |
+
wpstg_log('Droping table ' . $table . ' has been failed.');
|
1343 |
+
//wp_die(-1);
|
1344 |
+
wp_die('Droping table ' . $table . ' has been failed.');
|
1345 |
+
}
|
1346 |
+
wpstg_log('Droping table ' . $table . ' was successfull');
|
1347 |
+
}
|
1348 |
+
|
1349 |
}
|
1350 |
|
1351 |
//remove clone folder
|
1352 |
$excluded_folders = isset($_POST['excludedFolders']) ? $_POST['excludedFolders'] : array();
|
1353 |
$result = wpstgDeleteDirectory(get_home_path() . $clone, $excluded_folders);
|
1354 |
if (! $result) {
|
1355 |
+
wpstg_log('Removing clone folder '.get_home_path() . $clone.' has been failed.');
|
1356 |
wp_die(-1);
|
1357 |
}
|
1358 |
+
wpstg_log('Clone folder '.get_home_path() . $clone.' has been removed successfully.');
|
1359 |
$existing_clones = get_option('wpstg_existing_clones', array());
|
1360 |
$key = array_search($clone, $existing_clones);
|
1361 |
|
1366 |
|
1367 |
do_action('wpstg_remove_clone', $clone);
|
1368 |
if ($isAjax) {
|
1369 |
+
//wpstg_log('Clone( ' . $clone . ' ) has been removed successfully.');
|
1370 |
+
wpstg_log('Clone( ' . $clone . ' ) has been removed successfully.');
|
1371 |
wp_die(0);
|
1372 |
}
|
1373 |
}
|
1460 |
$file = 'clone_details.json';
|
1461 |
file_put_contents($path . '/' . $file, json_encode($wpstg_clone_details));
|
1462 |
}else {
|
1463 |
+
wpstg_log($path . '/' . $file . ' is not writeable! ');
|
1464 |
}
|
1465 |
}
|
1466 |
|
1470 |
function wpstg_error_processing() {
|
1471 |
$msg = sanitize_text_field($_POST['wpstg_error_msg']);
|
1472 |
if (! empty($msg))
|
1473 |
+
wpstg_log($msg);
|
1474 |
wp_die();
|
1475 |
}
|
1476 |
add_action('wp_ajax_wpstg_error_processing', 'wpstg_error_processing');
|
1694 |
return $overflow ? '<br>' . __('Probably not enough free disk space to create a staging site. <br> You can continue but its likely that the copying process will fail.', 'wpstg') : '';
|
1695 |
}
|
1696 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1697 |
/**
|
1698 |
* Get URL of staging site
|
1699 |
*
|
readme.txt
CHANGED
@@ -8,8 +8,8 @@ License: GPLv2 or later
|
|
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: 4.
|
12 |
-
Stable tag: 1.0.
|
13 |
|
14 |
A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
|
15 |
|
@@ -141,6 +141,15 @@ After installation goto the settings page 'Staging' and do your adjustments ther
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
= 1.0.3 =
|
145 |
* Fix: Missing const MASHFS_VERSION
|
146 |
* Fix: Remove error "table XY has been created, BUT inserting rows failed."
|
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: 4.5
|
12 |
+
Stable tag: 1.0.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 |
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= 1.0.4 =
|
145 |
+
* New: Tested up to WP 4.5
|
146 |
+
* Fix: Download system log not working
|
147 |
+
* Fix: Click on Optimizer "Select all | none | invert" links leads to jumping
|
148 |
+
* Tweak: Make clear that unselecting a checkbox will exlude table or file from copy process
|
149 |
+
* Tweak: Remove unnecessary text
|
150 |
+
* Tweak: Change beta notice in dashboard. WP Staging is stable
|
151 |
+
* Tweak: Change twitter handle to @wpstg
|
152 |
+
|
153 |
= 1.0.3 =
|
154 |
* Fix: Missing const MASHFS_VERSION
|
155 |
* Fix: Remove error "table XY has been created, BUT inserting rows failed."
|
templates/wpstg.min.css
DELETED
File without changes
|
wp-staging.php
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
* Plugin Name: WP Staging
|
4 |
* Plugin URI: wordpress.org/plugins/wp-staging
|
5 |
-
* Description:
|
6 |
* Author: WP-Staging, René Hermenau
|
7 |
* Author URI: https://wordpress.org/plugins/wp-staging
|
8 |
-
* Version: 1.0.
|
9 |
* Text Domain: wpstg
|
10 |
* Domain Path: languages
|
11 |
|
@@ -28,19 +29,32 @@
|
|
28 |
* @author René Hermenau
|
29 |
*/
|
30 |
// Exit if accessed directly
|
31 |
-
if (!defined('ABSPATH'))
|
32 |
exit;
|
33 |
|
34 |
// Plugin version
|
35 |
-
if (!defined('WPSTG_VERSION')) {
|
36 |
-
define('WPSTG_VERSION', '1.0.
|
37 |
}
|
38 |
-
//
|
39 |
-
if (!defined('WPSTG_WP_COMPATIBLE')) {
|
40 |
define('WPSTG_WP_COMPATIBLE', '4.4.2');
|
41 |
}
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
/**
|
46 |
* Main wpstg Class
|
@@ -48,82 +62,19 @@ if (!class_exists('wpstaging')) :
|
|
48 |
* @since 0.9.0
|
49 |
*/
|
50 |
final class wpstaging {
|
51 |
-
/** Singleton ************************************************************ */
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @var WP-Staging The one and only WP-Staging
|
55 |
-
* @since 1.0
|
56 |
-
*/
|
57 |
-
private static $instance;
|
58 |
|
59 |
/**
|
60 |
-
*
|
61 |
-
*
|
62 |
-
* @var object
|
63 |
-
* @since 2.0.0
|
64 |
-
*/
|
65 |
-
//public $html;
|
66 |
-
|
67 |
-
/* WPSTG LOGGER Class
|
68 |
*
|
69 |
-
*/
|
70 |
-
public $logger;
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Main WP-Staging Instance
|
76 |
-
*
|
77 |
-
* Insures that only one instance of wp-staging exists in memory at any one
|
78 |
-
* time. Also prevents needing to define globals all over the place.
|
79 |
-
*
|
80 |
* @since 1.0
|
81 |
* @static
|
82 |
-
* @staticvar array $instance
|
83 |
-
* @uses wp-staging::setup_constants() Setup the constants needed
|
84 |
-
* @uses wp-staging::includes() Include the required files
|
85 |
-
* @uses wp-staging::load_textdomain() load the language files
|
86 |
-
* @see WPSTG()
|
87 |
-
* @return The one true wp-staging
|
88 |
*/
|
89 |
-
public
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
self::$instance->includes();
|
94 |
-
self::$instance->load_textdomain();
|
95 |
-
//self::$instance->html = new WPSTG_HTML_Elements();
|
96 |
-
self::$instance->logger = new wpstgLogger("wpstglog_" . date("Y-m-d") . ".log", wpstgLogger::INFO);
|
97 |
-
}
|
98 |
-
return self::$instance;
|
99 |
}
|
100 |
|
101 |
-
/**
|
102 |
-
* Throw error on object clone
|
103 |
-
*
|
104 |
-
* The whole idea of the singleton design pattern is that there is a single
|
105 |
-
* object therefore, we don't want the object to be cloned.
|
106 |
-
*
|
107 |
-
* @since 1.0
|
108 |
-
* @access protected
|
109 |
-
* @return void
|
110 |
-
*/
|
111 |
-
public function __clone() {
|
112 |
-
// Cloning instances of the class is forbidden
|
113 |
-
_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'WPSTG'), '1.0');
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Disable unserializing of the class
|
118 |
-
*
|
119 |
-
* @since 1.0
|
120 |
-
* @access protected
|
121 |
-
* @return void
|
122 |
-
*/
|
123 |
-
public function __wakeup() {
|
124 |
-
// Unserializing instances of the class is forbidden
|
125 |
-
_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'WPSTG'), '1.0');
|
126 |
-
}
|
127 |
|
128 |
/**
|
129 |
* Setup plugin constants
|
@@ -133,27 +84,29 @@ if (!class_exists('wpstaging')) :
|
|
133 |
* @return void
|
134 |
*/
|
135 |
private function setup_constants() {
|
136 |
-
global $wpdb;
|
137 |
|
138 |
// Plugin Folder Path
|
139 |
-
if (!defined('WPSTG_PLUGIN_DIR')) {
|
140 |
define('WPSTG_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
141 |
}
|
142 |
|
143 |
// Plugin Folder URL
|
144 |
-
if (!defined('WPSTG_PLUGIN_URL')) {
|
145 |
define('WPSTG_PLUGIN_URL', plugin_dir_url(__FILE__));
|
146 |
}
|
147 |
|
148 |
// Plugin Root File
|
149 |
-
if (!defined('WPSTG_PLUGIN_FILE')) {
|
150 |
define('WPSTG_PLUGIN_FILE', __FILE__);
|
151 |
}
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
157 |
}
|
158 |
}
|
159 |
|
@@ -166,10 +119,10 @@ if (!class_exists('wpstaging')) :
|
|
166 |
*/
|
167 |
private function includes() {
|
168 |
global $wpstg_options;
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
if (is_admin() || ( defined('WP_CLI') && WP_CLI )) {
|
173 |
require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
|
174 |
$wpstg_options = wpstg_get_settings(); // Load it on top of all
|
175 |
require_once WPSTG_PLUGIN_DIR . 'includes/admin/admin-actions.php';
|
@@ -188,6 +141,7 @@ if (!class_exists('wpstaging')) :
|
|
188 |
require_once WPSTG_PLUGIN_DIR . 'includes/debug/classes/wpstgDebug.class.php';
|
189 |
require_once WPSTG_PLUGIN_DIR . 'includes/wpstg-sanitize.php';
|
190 |
require_once WPSTG_PLUGIN_DIR . 'includes/template-functions.php';
|
|
|
191 |
}
|
192 |
}
|
193 |
|
@@ -211,10 +165,10 @@ if (!class_exists('wpstaging')) :
|
|
211 |
$mofile_local = $wpstg_lang_dir . $mofile;
|
212 |
$mofile_global = WP_LANG_DIR . '/wpstg/' . $mofile;
|
213 |
|
214 |
-
if (file_exists($mofile_global)) {
|
215 |
// Look in global /wp-content/languages/WPSTG folder
|
216 |
load_textdomain('wpstg', $mofile_global);
|
217 |
-
} elseif (file_exists($mofile_local)) {
|
218 |
// Look in local /wp-content/plugins/wp-staging/languages/ folder
|
219 |
load_textdomain('wpstg', $mofile_local);
|
220 |
} else {
|
@@ -228,27 +182,35 @@ if (!class_exists('wpstaging')) :
|
|
228 |
endif; // End if class_exists check
|
229 |
|
230 |
/**
|
231 |
-
*
|
232 |
-
* Instance to functions everywhere.
|
233 |
-
*
|
234 |
-
* Use this function like you would a global variable, except without needing
|
235 |
-
* to declare the global.
|
236 |
*
|
237 |
-
*
|
238 |
-
*
|
239 |
-
* @since 0.9.0
|
240 |
-
* @return object The one true wpstaging Instance
|
241 |
*/
|
242 |
-
function
|
243 |
-
return wpstaging::instance();
|
244 |
-
}
|
245 |
|
246 |
-
|
247 |
-
WPSTG();
|
248 |
|
249 |
-
if ( !
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
// Deactivate WPSTG (Pro)
|
254 |
-
add_action(
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
+
* Plugin Name: WP Staging
|
5 |
* Plugin URI: wordpress.org/plugins/wp-staging
|
6 |
+
* Description: Create a staging clone site for testing & developing
|
7 |
* Author: WP-Staging, René Hermenau
|
8 |
* Author URI: https://wordpress.org/plugins/wp-staging
|
9 |
+
* Version: 1.0.4
|
10 |
* Text Domain: wpstg
|
11 |
* Domain Path: languages
|
12 |
|
29 |
* @author René Hermenau
|
30 |
*/
|
31 |
// Exit if accessed directly
|
32 |
+
if ( !defined('ABSPATH') )
|
33 |
exit;
|
34 |
|
35 |
// Plugin version
|
36 |
+
if ( !defined('WPSTG_VERSION') ) {
|
37 |
+
define('WPSTG_VERSION', '1.0.4');
|
38 |
}
|
39 |
+
// Is compatible up to WordPress version
|
40 |
+
if ( !defined('WPSTG_WP_COMPATIBLE') ) {
|
41 |
define('WPSTG_WP_COMPATIBLE', '4.4.2');
|
42 |
}
|
43 |
|
44 |
+
// Plugin Folder Path
|
45 |
+
if ( !defined('WPSTG_PLUGIN_DIR') ) {
|
46 |
+
define('WPSTG_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
47 |
+
}
|
48 |
+
|
49 |
+
// Files that needs to be loaded early
|
50 |
+
if ( !class_exists('WPSTG_Utils') ) {
|
51 |
+
require dirname(__FILE__) . '/includes/wpstg-utils.php';
|
52 |
+
}
|
53 |
+
|
54 |
+
/*
|
55 |
+
* Main class wpstaging
|
56 |
+
*/
|
57 |
+
if ( !class_exists('wpstaging') ) :
|
58 |
|
59 |
/**
|
60 |
* Main wpstg Class
|
62 |
* @since 0.9.0
|
63 |
*/
|
64 |
final class wpstaging {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
/**
|
67 |
+
* Main WP Staging __construct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
* @since 1.0
|
70 |
* @static
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
*/
|
72 |
+
public function __construct() {
|
73 |
+
self::setup_constants();
|
74 |
+
self::includes();
|
75 |
+
self::load_textdomain();
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
/**
|
80 |
* Setup plugin constants
|
84 |
* @return void
|
85 |
*/
|
86 |
private function setup_constants() {
|
87 |
+
//global $wpdb;
|
88 |
|
89 |
// Plugin Folder Path
|
90 |
+
if ( !defined('WPSTG_PLUGIN_DIR') ) {
|
91 |
define('WPSTG_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
92 |
}
|
93 |
|
94 |
// Plugin Folder URL
|
95 |
+
if ( !defined('WPSTG_PLUGIN_URL') ) {
|
96 |
define('WPSTG_PLUGIN_URL', plugin_dir_url(__FILE__));
|
97 |
}
|
98 |
|
99 |
// Plugin Root File
|
100 |
+
if ( !defined('WPSTG_PLUGIN_FILE') ) {
|
101 |
define('WPSTG_PLUGIN_FILE', __FILE__);
|
102 |
}
|
103 |
|
104 |
+
if ( !defined('WPSTG_NAME') ) {
|
105 |
+
define('WPSTG_NAME', 'WP Staging');
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( !defined('WPSTG_SLUG') ) {
|
109 |
+
define('WPSTG_SLUG', 'wp-staging');
|
110 |
}
|
111 |
}
|
112 |
|
119 |
*/
|
120 |
private function includes() {
|
121 |
global $wpstg_options;
|
122 |
+
require_once WPSTG_PLUGIN_DIR . 'includes/logger.php';
|
123 |
+
require_once WPSTG_PLUGIN_DIR . 'includes/scripts.php';
|
124 |
+
require_once WPSTG_PLUGIN_DIR . 'includes/staging-functions.php';
|
125 |
+
if ( is_admin() || ( defined('WP_CLI') && WP_CLI ) ) {
|
126 |
require_once WPSTG_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
|
127 |
$wpstg_options = wpstg_get_settings(); // Load it on top of all
|
128 |
require_once WPSTG_PLUGIN_DIR . 'includes/admin/admin-actions.php';
|
141 |
require_once WPSTG_PLUGIN_DIR . 'includes/debug/classes/wpstgDebug.class.php';
|
142 |
require_once WPSTG_PLUGIN_DIR . 'includes/wpstg-sanitize.php';
|
143 |
require_once WPSTG_PLUGIN_DIR . 'includes/template-functions.php';
|
144 |
+
require_once WPSTG_PLUGIN_DIR . 'includes/error-handling.php';
|
145 |
}
|
146 |
}
|
147 |
|
165 |
$mofile_local = $wpstg_lang_dir . $mofile;
|
166 |
$mofile_global = WP_LANG_DIR . '/wpstg/' . $mofile;
|
167 |
|
168 |
+
if ( file_exists($mofile_global) ) {
|
169 |
// Look in global /wp-content/languages/WPSTG folder
|
170 |
load_textdomain('wpstg', $mofile_global);
|
171 |
+
} elseif ( file_exists($mofile_local) ) {
|
172 |
// Look in local /wp-content/plugins/wp-staging/languages/ folder
|
173 |
load_textdomain('wpstg', $mofile_local);
|
174 |
} else {
|
182 |
endif; // End if class_exists check
|
183 |
|
184 |
/**
|
185 |
+
* Populate the $wpstg global with an instance of the wpstaging class and return it.
|
|
|
|
|
|
|
|
|
186 |
*
|
187 |
+
* @return $wpstg a global instance class of the wpstaging class.
|
|
|
|
|
|
|
188 |
*/
|
189 |
+
function wp_staging_loaded() {
|
|
|
|
|
190 |
|
191 |
+
global $wpstg;
|
|
|
192 |
|
193 |
+
if ( !is_null($wpstg) ) {
|
194 |
+
return $wpstg;
|
195 |
+
}
|
196 |
+
|
197 |
+
$wpstg = new wpstaging();
|
198 |
+
return $wpstg;
|
199 |
+
//WPSTG();
|
200 |
}
|
201 |
|
202 |
+
add_action('plugins_loaded', 'wp_staging_loaded');
|
203 |
+
|
204 |
+
/* function WPSTG() {
|
205 |
+
global $wpstg;
|
206 |
+
|
207 |
+
if ( !is_null($wpstg) ) {
|
208 |
+
return $wpstg;
|
209 |
+
}
|
210 |
+
|
211 |
+
$wpstg = new wpstaging();
|
212 |
+
return $wpstg;
|
213 |
+
} */
|
214 |
+
|
215 |
// Deactivate WPSTG (Pro)
|
216 |
+
add_action('activated_plugin', array('WPSTG_Utils', 'deactivate_other_instances'));
|