Version Description
- Fix: Disable the WP-Spamshield Plugin on staging site because it prevents login to staging site
- Fix: Lower the memory consumption when cloning scan process is started
- New: Show PHP user in system info log
Download this release
Release Info
Developer | ReneHermi |
Plugin | WP Staging – DB & File Duplicator & Migration |
Version | 2.5.3 |
Comparing to | |
See all releases |
Code changes from version 2.5.2 to 2.5.3
- apps/Backend/Administrator.php +10 -6
- apps/Backend/Modules/Jobs/Cloning.php +2 -1
- apps/Backend/Modules/Jobs/Data.php +1 -1
- apps/Backend/Modules/Jobs/Files.php +6 -6
- apps/Backend/Modules/Jobs/Multisite/Data.php +1 -1
- apps/Backend/Modules/Jobs/Multisite/DataExternal.php +1 -1
- apps/Backend/Modules/Jobs/Multisite/Database.php +1 -1
- apps/Backend/Modules/Jobs/Multisite/DatabaseExternal.php +1 -1
- apps/Backend/Modules/Jobs/Multisite/SearchReplace.php +2 -2
- apps/Backend/Modules/Jobs/Multisite/SearchReplaceExternal.php +2 -2
- apps/Backend/Modules/Jobs/Scan.php +404 -400
- apps/Backend/Modules/Jobs/SearchReplace.php +2 -2
- apps/Backend/Modules/SystemInfo.php +2 -2
- apps/Backend/views/_includes/messages/cache-directory-permission-problem.php +1 -1
- apps/Backend/views/_includes/messages/logs-directory-permission-problem.php +1 -1
- apps/Backend/views/_includes/messages/uploads-cache-directory-permission-problem.php +1 -1
- apps/Backend/views/_includes/messages/vars-directory-permission-problem.php +1 -1
- apps/Core/WPStaging.php +1 -1
- readme.txt +6 -1
- wp-staging.php +2 -2
apps/Backend/Administrator.php
CHANGED
@@ -238,7 +238,6 @@ class Administrator extends InjectionAware {
|
|
238 |
public function getToolsPage() {
|
239 |
// Tabs
|
240 |
$tabs = new Tabs( array(
|
241 |
-
|
242 |
"system_info" => __( "System Info", "wp-staging" ),
|
243 |
"import_export" => __( "Import/Export", "wp-staging" )
|
244 |
) );
|
@@ -641,7 +640,7 @@ class Administrator extends InjectionAware {
|
|
641 |
) {
|
642 |
wp_send_json( true );
|
643 |
}
|
644 |
-
return wp_send_json(false);
|
645 |
}
|
646 |
|
647 |
/**
|
@@ -785,10 +784,15 @@ class Administrator extends InjectionAware {
|
|
785 |
|
786 |
|
787 |
// Can not connect to database
|
788 |
-
$sql = "SHOW DATABASES LIKE '{$database}';";
|
789 |
-
$results = $db->query( $sql );
|
790 |
-
if( empty( $results ) ) {
|
791 |
-
echo json_encode( array('errors' => " Database {$database} does not exist. You need to create it first. ") );
|
|
|
|
|
|
|
|
|
|
|
792 |
exit;
|
793 |
}
|
794 |
echo json_encode( array('success' => 'true') );
|
238 |
public function getToolsPage() {
|
239 |
// Tabs
|
240 |
$tabs = new Tabs( array(
|
|
|
241 |
"system_info" => __( "System Info", "wp-staging" ),
|
242 |
"import_export" => __( "Import/Export", "wp-staging" )
|
243 |
) );
|
640 |
) {
|
641 |
wp_send_json( true );
|
642 |
}
|
643 |
+
return wp_send_json( false );
|
644 |
}
|
645 |
|
646 |
/**
|
784 |
|
785 |
|
786 |
// Can not connect to database
|
787 |
+
// $sql = "SHOW DATABASES LIKE '{$database}';";
|
788 |
+
// $results = $db->query( $sql );
|
789 |
+
// if( empty( $results ) ) {
|
790 |
+
// echo json_encode( array('errors' => " Database {$database} does not exist. You need to create it first. ") );
|
791 |
+
// exit;
|
792 |
+
// }
|
793 |
+
$db->select( $database );
|
794 |
+
if( !$db->ready ) {
|
795 |
+
echo json_encode( array('errors' => "Error: Can't select {$database} [" . print_r( $db->error, true ) . "] Either it does not exist or you don't have privileges to access it. ") );
|
796 |
exit;
|
797 |
}
|
798 |
echo json_encode( array('success' => 'true') );
|
apps/Backend/Modules/Jobs/Cloning.php
CHANGED
@@ -96,6 +96,7 @@ class Cloning extends Job {
|
|
96 |
\WPStaging\WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wps-hide-login',
|
97 |
\WPStaging\WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wp-super-cache',
|
98 |
\WPStaging\WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'peters-login-redirect',
|
|
|
99 |
);
|
100 |
|
101 |
$this->options->excludedDirectories = array_merge( $excludedDirectories, $this->options->excludedDirectories );
|
@@ -271,7 +272,7 @@ class Cloning extends Job {
|
|
271 |
$sql = "SHOW TABLE STATUS LIKE '{$this->options->prefix}%'";
|
272 |
$tables = $this->db->get_results( $sql );
|
273 |
|
274 |
-
// Prefix does not
|
275 |
if( !$tables ) {
|
276 |
return $this->options->prefix;
|
277 |
}
|
96 |
\WPStaging\WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wps-hide-login',
|
97 |
\WPStaging\WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wp-super-cache',
|
98 |
\WPStaging\WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'peters-login-redirect',
|
99 |
+
\WPStaging\WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wp-spamshield',
|
100 |
);
|
101 |
|
102 |
$this->options->excludedDirectories = array_merge( $excludedDirectories, $this->options->excludedDirectories );
|
272 |
$sql = "SHOW TABLE STATUS LIKE '{$this->options->prefix}%'";
|
273 |
$tables = $this->db->get_results( $sql );
|
274 |
|
275 |
+
// Prefix does not exist. We can use it
|
276 |
if( !$tables ) {
|
277 |
return $this->options->prefix;
|
278 |
}
|
apps/Backend/Modules/Jobs/Data.php
CHANGED
@@ -176,7 +176,7 @@ class Data extends JobExecutable {
|
|
176 |
*/
|
177 |
protected function isTable( $table ) {
|
178 |
if( $this->db->get_var( "SHOW TABLES LIKE '{$table}'" ) != $table ) {
|
179 |
-
$this->log( "Table {$table} does not
|
180 |
return false;
|
181 |
}
|
182 |
return true;
|
176 |
*/
|
177 |
protected function isTable( $table ) {
|
178 |
if( $this->db->get_var( "SHOW TABLES LIKE '{$table}'" ) != $table ) {
|
179 |
+
$this->log( "Table {$table} does not exist", Logger::TYPE_ERROR );
|
180 |
return false;
|
181 |
}
|
182 |
return true;
|
apps/Backend/Modules/Jobs/Files.php
CHANGED
@@ -224,6 +224,9 @@ class Files extends JobExecutable {
|
|
224 |
return $this->copyBig( $file, $destination, $this->settings->batchSize );
|
225 |
}
|
226 |
|
|
|
|
|
|
|
227 |
// Attempt to copy
|
228 |
if( !@copy( $file, $destination ) ) {
|
229 |
$errors = error_get_last();
|
@@ -250,10 +253,10 @@ class Files extends JobExecutable {
|
|
250 |
$uploads = wp_upload_dir();
|
251 |
|
252 |
// Get absolute upload dir from ABSPATH
|
253 |
-
$uploadsAbsPath = trailingslashit($uploads['basedir']);
|
254 |
|
255 |
// Get absolute custom wp-content dir
|
256 |
-
$wpContentDir = trailingslashit(WP_CONTENT_DIR);
|
257 |
|
258 |
// Check if there is a custom upload directory and do a search $ replace
|
259 |
$file = str_replace( $uploadsAbsPath, ABSPATH . 'wp-content/uploads/', $file, $count );
|
@@ -401,13 +404,10 @@ class Files extends JobExecutable {
|
|
401 |
if( false !== strpos( $directory, 'wp-staging' ) || false !== strpos( $directory, 'wp-staging-pro' ) ) {
|
402 |
return false;
|
403 |
}
|
404 |
-
|
405 |
-
// $directory = trailingslashit( $directory );
|
406 |
$directory = trailingslashit( $this->sanitizeDirectorySeparator( $directory ) );
|
407 |
|
408 |
foreach ( $this->options->excludedDirectories as $excludedDirectory ) {
|
409 |
-
// $excludedDirectory = wpstg_replace_windows_directory_separator( $excludedDirectory );
|
410 |
-
// $excludedDirectory = trailingslashit( $excludedDirectory );
|
411 |
$excludedDirectory = trailingslashit( $this->sanitizeDirectorySeparator( $excludedDirectory ) );
|
412 |
if( strpos( $directory, $excludedDirectory ) === 0 && !$this->isExtraDirectory( $directory ) ) {
|
413 |
return true;
|
224 |
return $this->copyBig( $file, $destination, $this->settings->batchSize );
|
225 |
}
|
226 |
|
227 |
+
$this->debugLog( "Try to copy: {$file} to {$destination}", Logger::TYPE_INFO );
|
228 |
+
|
229 |
+
|
230 |
// Attempt to copy
|
231 |
if( !@copy( $file, $destination ) ) {
|
232 |
$errors = error_get_last();
|
253 |
$uploads = wp_upload_dir();
|
254 |
|
255 |
// Get absolute upload dir from ABSPATH
|
256 |
+
$uploadsAbsPath = trailingslashit( $uploads['basedir'] );
|
257 |
|
258 |
// Get absolute custom wp-content dir
|
259 |
+
$wpContentDir = trailingslashit( WP_CONTENT_DIR );
|
260 |
|
261 |
// Check if there is a custom upload directory and do a search $ replace
|
262 |
$file = str_replace( $uploadsAbsPath, ABSPATH . 'wp-content/uploads/', $file, $count );
|
404 |
if( false !== strpos( $directory, 'wp-staging' ) || false !== strpos( $directory, 'wp-staging-pro' ) ) {
|
405 |
return false;
|
406 |
}
|
407 |
+
|
|
|
408 |
$directory = trailingslashit( $this->sanitizeDirectorySeparator( $directory ) );
|
409 |
|
410 |
foreach ( $this->options->excludedDirectories as $excludedDirectory ) {
|
|
|
|
|
411 |
$excludedDirectory = trailingslashit( $this->sanitizeDirectorySeparator( $excludedDirectory ) );
|
412 |
if( strpos( $directory, $excludedDirectory ) === 0 && !$this->isExtraDirectory( $directory ) ) {
|
413 |
return true;
|
apps/Backend/Modules/Jobs/Multisite/Data.php
CHANGED
@@ -171,7 +171,7 @@ class Data extends JobExecutable {
|
|
171 |
*/
|
172 |
protected function isTable( $table ) {
|
173 |
if( $this->db->get_var( "SHOW TABLES LIKE '{$table}'" ) != $table ) {
|
174 |
-
$this->log( "Table {$table} does not
|
175 |
return false;
|
176 |
}
|
177 |
return true;
|
171 |
*/
|
172 |
protected function isTable( $table ) {
|
173 |
if( $this->db->get_var( "SHOW TABLES LIKE '{$table}'" ) != $table ) {
|
174 |
+
$this->log( "Table {$table} does not exist", Logger::TYPE_ERROR );
|
175 |
return false;
|
176 |
}
|
177 |
return true;
|
apps/Backend/Modules/Jobs/Multisite/DataExternal.php
CHANGED
@@ -178,7 +178,7 @@ class DataExternal extends JobExecutable {
|
|
178 |
*/
|
179 |
protected function isTable( $table ) {
|
180 |
if( $this->db->get_var( "SHOW TABLES LIKE '{$table}'" ) != $table ) {
|
181 |
-
$this->log( "Table {$table} does not
|
182 |
return false;
|
183 |
}
|
184 |
return true;
|
178 |
*/
|
179 |
protected function isTable( $table ) {
|
180 |
if( $this->db->get_var( "SHOW TABLES LIKE '{$table}'" ) != $table ) {
|
181 |
+
$this->log( "Table {$table} does not exist", Logger::TYPE_ERROR );
|
182 |
return false;
|
183 |
}
|
184 |
return true;
|
apps/Backend/Modules/Jobs/Multisite/Database.php
CHANGED
@@ -284,7 +284,7 @@ class Database extends JobExecutable {
|
|
284 |
return true;
|
285 |
}
|
286 |
|
287 |
-
// Table does not
|
288 |
$result = $this->db->query( "SHOW TABLES LIKE '{$old}'" );
|
289 |
if( !$result || 0 === $result ) {
|
290 |
return true;
|
284 |
return true;
|
285 |
}
|
286 |
|
287 |
+
// Table does not exist
|
288 |
$result = $this->db->query( "SHOW TABLES LIKE '{$old}'" );
|
289 |
if( !$result || 0 === $result ) {
|
290 |
return true;
|
apps/Backend/Modules/Jobs/Multisite/DatabaseExternal.php
CHANGED
@@ -310,7 +310,7 @@ class DatabaseExternal extends JobExecutable {
|
|
310 |
return true;
|
311 |
}
|
312 |
|
313 |
-
// Table does not
|
314 |
$table = str_replace( $this->db->dbname . '.', null, $old );
|
315 |
$result = $this->db->query( "SHOW TABLES LIKE '{$table}'" );
|
316 |
if( !$result || 0 === $result ) {
|
310 |
return true;
|
311 |
}
|
312 |
|
313 |
+
// Table does not exist
|
314 |
$table = str_replace( $this->db->dbname . '.', null, $old );
|
315 |
$result = $this->db->query( "SHOW TABLES LIKE '{$table}'" );
|
316 |
if( !$result || 0 === $result ) {
|
apps/Backend/Modules/Jobs/Multisite/SearchReplace.php
CHANGED
@@ -240,7 +240,7 @@ class SearchReplace extends JobExecutable {
|
|
240 |
*/
|
241 |
private function get_pages_in_table( $table ) {
|
242 |
|
243 |
-
// Table does not
|
244 |
$result = $this->db->query( "SHOW TABLES LIKE '{$table}'" );
|
245 |
if( !$result || 0 === $result ) {
|
246 |
return 0;
|
@@ -699,7 +699,7 @@ class SearchReplace extends JobExecutable {
|
|
699 |
return true;
|
700 |
}
|
701 |
|
702 |
-
// Table does not
|
703 |
$result = $this->db->query( "SHOW TABLES LIKE '{$old}'" );
|
704 |
if( !$result || 0 === $result ) {
|
705 |
return false;
|
240 |
*/
|
241 |
private function get_pages_in_table( $table ) {
|
242 |
|
243 |
+
// Table does not exist
|
244 |
$result = $this->db->query( "SHOW TABLES LIKE '{$table}'" );
|
245 |
if( !$result || 0 === $result ) {
|
246 |
return 0;
|
699 |
return true;
|
700 |
}
|
701 |
|
702 |
+
// Table does not exist
|
703 |
$result = $this->db->query( "SHOW TABLES LIKE '{$old}'" );
|
704 |
if( !$result || 0 === $result ) {
|
705 |
return false;
|
apps/Backend/Modules/Jobs/Multisite/SearchReplaceExternal.php
CHANGED
@@ -248,7 +248,7 @@ class SearchReplaceExternal extends JobExecutable {
|
|
248 |
*/
|
249 |
private function get_pages_in_table( $table ) {
|
250 |
|
251 |
-
// Table does not
|
252 |
$table = str_replace( $this->options->prefix . '.', null, $table );
|
253 |
$result = $this->productionDb->query( "SHOW TABLES LIKE '{$table}'" );
|
254 |
if( !$result || 0 === $result ) {
|
@@ -706,7 +706,7 @@ class SearchReplaceExternal extends JobExecutable {
|
|
706 |
return false;
|
707 |
}
|
708 |
|
709 |
-
// Table does not
|
710 |
$result = $this->productionDb->query( "SHOW TABLES LIKE '{$old}'" );
|
711 |
if( !$result || 0 === $result ) {
|
712 |
return false;
|
248 |
*/
|
249 |
private function get_pages_in_table( $table ) {
|
250 |
|
251 |
+
// Table does not exist
|
252 |
$table = str_replace( $this->options->prefix . '.', null, $table );
|
253 |
$result = $this->productionDb->query( "SHOW TABLES LIKE '{$table}'" );
|
254 |
if( !$result || 0 === $result ) {
|
706 |
return false;
|
707 |
}
|
708 |
|
709 |
+
// Table does not exist
|
710 |
$result = $this->productionDb->query( "SHOW TABLES LIKE '{$old}'" );
|
711 |
if( !$result || 0 === $result ) {
|
712 |
return false;
|
apps/Backend/Modules/Jobs/Scan.php
CHANGED
@@ -4,12 +4,13 @@ namespace WPStaging\Backend\Modules\Jobs;
|
|
4 |
|
5 |
// No Direct Access
|
6 |
if( !defined( "WPINC" ) ) {
|
7 |
-
|
8 |
}
|
9 |
|
10 |
use WPStaging\WPStaging;
|
11 |
use WPStaging\Utils\Directories;
|
12 |
use WPStaging\Backend\Optimizer\Optimizer;
|
|
|
13 |
|
14 |
/**
|
15 |
* Class Scan
|
@@ -17,409 +18,412 @@ use WPStaging\Backend\Optimizer\Optimizer;
|
|
17 |
*/
|
18 |
class Scan extends Job {
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
$output .= "</div>";
|
198 |
-
}
|
199 |
-
|
200 |
-
return $output;
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Checks if there is enough free disk space to create staging site
|
205 |
-
* Returns null when can't run disk_free_space function one way or another
|
206 |
-
* @return bool|null
|
207 |
-
*/
|
208 |
-
public function hasFreeDiskSpace() {
|
209 |
-
if( !function_exists( "disk_free_space" ) ) {
|
210 |
-
return null;
|
211 |
-
}
|
212 |
-
|
213 |
-
$freeSpace = @disk_free_space( \WPStaging\WPStaging::getWPpath() );
|
214 |
-
|
215 |
-
if( false === $freeSpace ) {
|
216 |
-
$data = array(
|
217 |
-
'freespace' => false,
|
218 |
-
'usedspace' => $this->formatSize( $this->getDirectorySizeInclSubdirs( \WPStaging\WPStaging::getWPpath() ) )
|
219 |
-
);
|
220 |
-
echo json_encode( $data );
|
221 |
-
die();
|
222 |
-
}
|
223 |
-
|
224 |
-
|
225 |
-
$data = array(
|
226 |
-
'freespace' => $this->formatSize( $freeSpace ),
|
227 |
-
'usedspace' => $this->formatSize( $this->getDirectorySizeInclSubdirs( \WPStaging\WPStaging::getWPpath() ) )
|
228 |
-
);
|
229 |
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
// if (0 === strpos($table->Name, "wp-staging"))
|
258 |
// {
|
259 |
// continue;
|
260 |
// }
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
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 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
|
|
|
|
|
|
|
|
424 |
|
425 |
}
|
4 |
|
5 |
// No Direct Access
|
6 |
if( !defined( "WPINC" ) ) {
|
7 |
+
die;
|
8 |
}
|
9 |
|
10 |
use WPStaging\WPStaging;
|
11 |
use WPStaging\Utils\Directories;
|
12 |
use WPStaging\Backend\Optimizer\Optimizer;
|
13 |
+
use WPStaging\Iterators;
|
14 |
|
15 |
/**
|
16 |
* Class Scan
|
18 |
*/
|
19 |
class Scan extends Job {
|
20 |
|
21 |
+
/**
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
private $directories = array();
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var Directories
|
28 |
+
*/
|
29 |
+
private $objDirectories;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Upon class initialization
|
33 |
+
*/
|
34 |
+
protected function initialize() {
|
35 |
+
$this->objDirectories = new Directories();
|
36 |
+
|
37 |
+
// Database Tables
|
38 |
+
$this->getTables();
|
39 |
+
|
40 |
+
// Get directories
|
41 |
+
$this->getDirectories();
|
42 |
+
|
43 |
+
// Install Optimizer
|
44 |
+
$this->installOptimizer();
|
45 |
+
|
46 |
+
|
47 |
+
$this->db = WPStaging::getInstance()->get( 'wpdb' );
|
48 |
+
$this->prefix = $this->db->prefix;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Start Module
|
53 |
+
* @return $this
|
54 |
+
*/
|
55 |
+
public function start() {
|
56 |
+
// Basic Options
|
57 |
+
$this->options->root = str_replace( array("\\", '/'), DIRECTORY_SEPARATOR, \WPStaging\WPStaging::getWPpath() );
|
58 |
+
$this->options->existingClones = get_option( "wpstg_existing_clones_beta", array() );
|
59 |
+
$this->options->current = null;
|
60 |
+
|
61 |
+
if( isset( $_POST["clone"] ) && array_key_exists( $_POST["clone"], $this->options->existingClones ) ) {
|
62 |
+
$this->options->current = $_POST["clone"];
|
63 |
+
}
|
64 |
+
|
65 |
+
// Tables
|
66 |
+
//$this->options->excludedTables = array();
|
67 |
+
$this->options->clonedTables = array();
|
68 |
+
|
69 |
+
// Files
|
70 |
+
$this->options->totalFiles = 0;
|
71 |
+
$this->options->totalFileSize = 0;
|
72 |
+
$this->options->copiedFiles = 0;
|
73 |
+
|
74 |
+
|
75 |
+
// Directories
|
76 |
+
$this->options->includedDirectories = array();
|
77 |
+
$this->options->includedExtraDirectories = array();
|
78 |
+
$this->options->excludedDirectories = array();
|
79 |
+
$this->options->extraDirectories = array();
|
80 |
+
$this->options->directoriesToCopy = array();
|
81 |
+
$this->options->scannedDirectories = array();
|
82 |
+
|
83 |
+
// Job
|
84 |
+
$this->options->currentJob = "database";
|
85 |
+
//$this->options->currentJob = "directories";
|
86 |
+
$this->options->currentStep = 0;
|
87 |
+
$this->options->totalSteps = 0;
|
88 |
+
|
89 |
+
// Define mainJob to differentiate between cloning, updating and pushing
|
90 |
+
$this->options->mainJob = 'cloning';
|
91 |
+
|
92 |
+
// Delete previous cached files
|
93 |
+
$this->cache->delete( "files_to_copy" );
|
94 |
+
$this->cache->delete( "clone_options" );
|
95 |
+
|
96 |
+
// Save options
|
97 |
+
$this->saveOptions();
|
98 |
+
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Make sure the Optimizer mu plugin is installed before cloning or pushing
|
104 |
+
*/
|
105 |
+
private function installOptimizer() {
|
106 |
+
$optimizer = new Optimizer();
|
107 |
+
$optimizer->installOptimizer();
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Format bytes into human readable form
|
112 |
+
* @param int $bytes
|
113 |
+
* @param int $precision
|
114 |
+
* @return string
|
115 |
+
*/
|
116 |
+
public function formatSize( $bytes, $precision = 2 ) {
|
117 |
+
if( ( double ) $bytes < 1 ) {
|
118 |
+
return '';
|
119 |
+
}
|
120 |
+
|
121 |
+
$units = array('B', "KB", "MB", "GB", "TB");
|
122 |
+
|
123 |
+
$bytes = ( double ) $bytes;
|
124 |
+
$base = log( $bytes ) / log( 1000 ); // 1024 would be for MiB KiB etc
|
125 |
+
$pow = pow( 1000, $base - floor( $base ) ); // Same rule for 1000
|
126 |
+
|
127 |
+
return round( $pow, $precision ) . ' ' . $units[( int ) floor( $base )];
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param null|string $directories
|
132 |
+
* @param bool $forceDisabled
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
public function directoryListing( $directories = null, $forceDisabled = false ) {
|
136 |
+
if( null == $directories ) {
|
137 |
+
$directories = $this->directories;
|
138 |
+
}
|
139 |
+
|
140 |
+
// Sort results
|
141 |
+
uksort( $directories, 'strcasecmp' );
|
142 |
+
|
143 |
+
$output = '';
|
144 |
+
foreach ( $directories as $name => $directory ) {
|
145 |
+
// Not a directory, possibly a symlink, therefore we will skip it
|
146 |
+
if( !is_array( $directory ) ) {
|
147 |
+
continue;
|
148 |
+
}
|
149 |
+
|
150 |
+
// Need to preserve keys so no array_shift()
|
151 |
+
$data = reset( $directory );
|
152 |
+
unset( $directory[key( $directory )] );
|
153 |
+
|
154 |
+
|
155 |
+
$isChecked = (
|
156 |
+
empty( $this->options->includedDirectories ) ||
|
157 |
+
in_array( $data["path"], $this->options->includedDirectories )
|
158 |
+
);
|
159 |
+
|
160 |
+
|
161 |
+
// Include wp core folders and their sub dirs.
|
162 |
+
// Exclude all other folders (default setting)
|
163 |
+
$dataPath = isset( $data["path"] ) ? $data["path"] : '';
|
164 |
+
$dataSize = isset( $data["size"] ) ? $data["size"] : '';
|
165 |
+
$isDisabled = ($name !== 'wp-admin' &&
|
166 |
+
$name !== 'wp-includes' &&
|
167 |
+
$name !== 'wp-content') &&
|
168 |
+
false === strpos( strrev( $dataPath ), strrev( "wp-admin" ) ) &&
|
169 |
+
false === strpos( strrev( $dataPath ), strrev( "wp-includes" ) ) &&
|
170 |
+
false === strpos( strrev( $dataPath ), strrev( "wp-content" ) ) ? true : false;
|
171 |
+
|
172 |
+
// Extra class to differentiate between wp core and non core folders
|
173 |
+
$class = !$isDisabled ? 'wpstg-root' : 'wpstg-extra';
|
174 |
+
|
175 |
+
$output .= "<div class='wpstg-dir'>";
|
176 |
+
$output .= "<input type='checkbox' class='wpstg-check-dir " . $class . "'";
|
177 |
+
|
178 |
+
if( $isChecked && !$isDisabled && !$forceDisabled )
|
179 |
+
$output .= " checked";
|
180 |
+
//if ($forceDisabled || $isDisabled) $output .= " disabled";
|
181 |
+
|
182 |
+
$output .= " name='selectedDirectories[]' value='{$dataPath}'>";
|
183 |
+
|
184 |
+
$output .= "<a href='#' class='wpstg-expand-dirs ";
|
185 |
+
if( !$isChecked || $isDisabled ) {
|
186 |
+
$output .= " disabled";
|
187 |
+
}
|
188 |
+
$output .= "'>{$name}";
|
189 |
+
$output .= "</a>";
|
190 |
+
$output .= "<span class='wpstg-size-info'>{$this->formatSize( $dataSize )}</span>";
|
191 |
+
|
192 |
+
if( !empty( $directory ) ) {
|
193 |
+
$output .= "<div class='wpstg-dir wpstg-subdir'>";
|
194 |
+
$output .= $this->directoryListing( $directory, $isDisabled );
|
195 |
+
$output .= "</div>";
|
196 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
+
$output .= "</div>";
|
199 |
+
}
|
200 |
+
|
201 |
+
return $output;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Checks if there is enough free disk space to create staging site
|
206 |
+
* Returns null when can't run disk_free_space function one way or another
|
207 |
+
* @return bool|null
|
208 |
+
*/
|
209 |
+
public function hasFreeDiskSpace() {
|
210 |
+
if( !function_exists( "disk_free_space" ) ) {
|
211 |
+
return null;
|
212 |
+
}
|
213 |
+
|
214 |
+
$freeSpace = @disk_free_space( \WPStaging\WPStaging::getWPpath() );
|
215 |
+
|
216 |
+
if( false === $freeSpace ) {
|
217 |
+
$data = array(
|
218 |
+
'freespace' => false,
|
219 |
+
'usedspace' => $this->formatSize( $this->getDirectorySizeInclSubdirs( \WPStaging\WPStaging::getWPpath() ) )
|
220 |
+
);
|
221 |
+
echo json_encode( $data );
|
222 |
+
die();
|
223 |
+
}
|
224 |
+
|
225 |
+
|
226 |
+
$data = array(
|
227 |
+
'freespace' => $this->formatSize( $freeSpace ),
|
228 |
+
'usedspace' => $this->formatSize( $this->getDirectorySizeInclSubdirs( \WPStaging\WPStaging::getWPpath() ) )
|
229 |
+
);
|
230 |
+
|
231 |
+
echo json_encode( $data );
|
232 |
+
die();
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Get Database Tables
|
237 |
+
*/
|
238 |
+
protected function getTables() {
|
239 |
+
$wpDB = WPStaging::getInstance()->get( "wpdb" );
|
240 |
+
|
241 |
+
if( strlen( $wpDB->prefix ) > 0 ) {
|
242 |
+
//$prefix = str_replace('_', '', $wpDB->prefix);
|
243 |
+
$sql = "SHOW TABLE STATUS LIKE '{$wpDB->prefix}%'";
|
244 |
+
} else {
|
245 |
+
$sql = "SHOW TABLE STATUS";
|
246 |
+
}
|
247 |
+
|
248 |
+
$tables = $wpDB->get_results( $sql );
|
249 |
+
|
250 |
+
$currentTables = array();
|
251 |
+
|
252 |
+
// Reset excluded Tables than loop through all tables
|
253 |
+
$this->options->excludedTables = array();
|
254 |
+
foreach ( $tables as $table ) {
|
255 |
+
|
256 |
+
// Exclude WP Staging Tables
|
257 |
// if (0 === strpos($table->Name, "wp-staging"))
|
258 |
// {
|
259 |
// continue;
|
260 |
// }
|
261 |
+
// Create array of unchecked tables
|
262 |
+
if( !empty( $wpDB->prefix ) && 0 !== strpos( $table->Name, $wpDB->prefix ) ) {
|
263 |
+
$this->options->excludedTables[] = $table->Name;
|
264 |
+
}
|
265 |
+
|
266 |
+
|
267 |
+
$currentTables[] = array(
|
268 |
+
"name" => $table->Name,
|
269 |
+
"size" => ($table->Data_length + $table->Index_length)
|
270 |
+
);
|
271 |
+
}
|
272 |
+
|
273 |
+
$this->options->tables = json_decode( json_encode( $currentTables ) );
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Get directories and main meta data about'em recursively
|
278 |
+
*/
|
279 |
+
protected function getDirectories() {
|
280 |
+
|
281 |
+
|
282 |
+
//$directories = new \DirectoryIterator( \WPStaging\WPStaging::getWPpath() );
|
283 |
+
$directories = new Iterators\RecursiveDirectoryIterator( \WPStaging\WPStaging::getWPpath() );
|
284 |
+
|
285 |
+
|
286 |
+
foreach ( $directories as $directory ) {
|
287 |
+
// Not a valid directory
|
288 |
+
if( false === ($path = $this->getPath( $directory )) ) {
|
289 |
+
continue;
|
290 |
+
}
|
291 |
+
|
292 |
+
$this->handleDirectory( $path );
|
293 |
+
|
294 |
+
// Get Sub-directories
|
295 |
+
$this->getSubDirectories( $directory->getRealPath() );
|
296 |
+
}
|
297 |
+
|
298 |
+
// Gather Plugins
|
299 |
+
$this->getSubDirectories( WP_PLUGIN_DIR );
|
300 |
+
|
301 |
+
// Gather Themes
|
302 |
+
$this->getSubDirectories( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . "themes" );
|
303 |
+
|
304 |
+
// Gather Default Uploads Folder
|
305 |
+
//$this->getSubDirectories(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . "uploads");
|
306 |
+
// Gather Custom Uploads Folder if there is one
|
307 |
+
$this->getSubDirectories( $this->getUploadDir() );
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* @param string $path
|
312 |
+
*/
|
313 |
+
protected function getSubDirectories( $path ) {
|
314 |
+
|
315 |
+
if( !is_readable( $path ) ) {
|
316 |
+
return false;
|
317 |
+
}
|
318 |
+
|
319 |
+
$directories = new \DirectoryIterator( $path );
|
320 |
+
|
321 |
+
foreach ( $directories as $directory ) {
|
322 |
+
// Not a valid directory
|
323 |
+
if( false === ($path = $this->getPath( $directory )) ) {
|
324 |
+
continue;
|
325 |
+
}
|
326 |
+
|
327 |
+
$this->handleDirectory( $path );
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Get Path from $directory
|
333 |
+
* @param \SplFileInfo $directory
|
334 |
+
* @return string|false
|
335 |
+
*/
|
336 |
+
protected function getPath( $directory ) {
|
337 |
+
|
338 |
+
/*
|
339 |
+
* Do not follow root path like src/web/..
|
340 |
+
* This must be done before \SplFileInfo->isDir() is used!
|
341 |
+
* Prevents open base dir restriction fatal errors
|
342 |
+
*/
|
343 |
+
|
344 |
+
if( strpos( $directory->getRealPath(), \WPStaging\WPStaging::getWPpath() ) !== 0 ) {
|
345 |
+
return false;
|
346 |
+
}
|
347 |
+
$path = str_replace( \WPStaging\WPStaging::getWPpath(), null, $directory->getRealPath() );
|
348 |
+
|
349 |
+
// Using strpos() for symbolic links as they could create nasty stuff in nix stuff for directory structures
|
350 |
+
if( !$directory->isDir() || strlen( $path ) < 1 ) {
|
351 |
+
return false;
|
352 |
+
}
|
353 |
+
|
354 |
+
return $path;
|
355 |
+
}
|
356 |
+
|
357 |
+
/**
|
358 |
+
* Organizes $this->directories
|
359 |
+
* @param string $path
|
360 |
+
*/
|
361 |
+
protected function handleDirectory( $path ) {
|
362 |
+
$directoryArray = explode( DIRECTORY_SEPARATOR, $path );
|
363 |
+
$total = is_array( $directoryArray ) || $directoryArray instanceof Countable ? count( $directoryArray ) : 0;
|
364 |
+
|
365 |
+
if( $total < 1 ) {
|
366 |
+
return;
|
367 |
+
}
|
368 |
+
|
369 |
+
$total = $total - 1;
|
370 |
+
$currentArray = &$this->directories;
|
371 |
+
|
372 |
+
for ( $i = 0; $i <= $total; $i++ ) {
|
373 |
+
if( !isset( $currentArray[$directoryArray[$i]] ) ) {
|
374 |
+
$currentArray[$directoryArray[$i]] = array();
|
375 |
+
}
|
376 |
+
|
377 |
+
$currentArray = &$currentArray[$directoryArray[$i]];
|
378 |
+
|
379 |
+
// Attach meta data to the end
|
380 |
+
if( $i < $total ) {
|
381 |
+
continue;
|
382 |
+
}
|
383 |
+
|
384 |
+
$fullPath = \WPStaging\WPStaging::getWPpath() . $path;
|
385 |
+
$size = $this->getDirectorySize( $fullPath );
|
386 |
+
|
387 |
+
$currentArray["metaData"] = array(
|
388 |
+
"size" => $size,
|
389 |
+
"path" => \WPStaging\WPStaging::getWPpath() . $path,
|
390 |
+
);
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Gets size of given directory
|
396 |
+
* @param string $path
|
397 |
+
* @return int|null
|
398 |
+
*/
|
399 |
+
protected function getDirectorySize( $path ) {
|
400 |
+
if( !isset( $this->settings->checkDirectorySize ) || '1' !== $this->settings->checkDirectorySize ) {
|
401 |
+
return null;
|
402 |
+
}
|
403 |
+
|
404 |
+
return $this->objDirectories->size( $path );
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Get total size of a directory including all its subdirectories
|
409 |
+
* @param string $dir
|
410 |
+
* @return int
|
411 |
+
*/
|
412 |
+
function getDirectorySizeInclSubdirs( $dir ) {
|
413 |
+
$size = 0;
|
414 |
+
foreach ( glob( rtrim( $dir, '/' ) . '/*', GLOB_NOSORT ) as $each ) {
|
415 |
+
$size += is_file( $each ) ? filesize( $each ) : $this->getDirectorySizeInclSubdirs( $each );
|
416 |
+
}
|
417 |
+
return $size;
|
418 |
+
}
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Get absolute WP uploads path e.g. /var/www/htdocs/example.com/wp-content/uploads/sites/1
|
422 |
+
* @return string
|
423 |
+
*/
|
424 |
+
protected function getUploadDir() {
|
425 |
+
$uploads = wp_upload_dir();
|
426 |
+
return $uploads['basedir'];
|
427 |
+
}
|
428 |
|
429 |
}
|
apps/Backend/Modules/Jobs/SearchReplace.php
CHANGED
@@ -237,7 +237,7 @@ class SearchReplace extends JobExecutable {
|
|
237 |
*/
|
238 |
private function get_pages_in_table( $table ) {
|
239 |
|
240 |
-
// Table does not
|
241 |
$table = str_replace( $this->options->prefix . '.', null, $table );
|
242 |
$result = $this->db->query( "SHOW TABLES LIKE '{$table}'" );
|
243 |
if( !$result || 0 === $result ) {
|
@@ -664,7 +664,7 @@ class SearchReplace extends JobExecutable {
|
|
664 |
return false;
|
665 |
}
|
666 |
|
667 |
-
// Table does not
|
668 |
$result = $this->db->query( "SHOW TABLES LIKE '{$old}'" );
|
669 |
if( !$result || 0 === $result ) {
|
670 |
return false;
|
237 |
*/
|
238 |
private function get_pages_in_table( $table ) {
|
239 |
|
240 |
+
// Table does not exist
|
241 |
$table = str_replace( $this->options->prefix . '.', null, $table );
|
242 |
$result = $this->db->query( "SHOW TABLES LIKE '{$table}'" );
|
243 |
if( !$result || 0 === $result ) {
|
664 |
return false;
|
665 |
}
|
666 |
|
667 |
+
// Table does not exist
|
668 |
$result = $this->db->query( "SHOW TABLES LIKE '{$old}'" );
|
669 |
if( !$result || 0 === $result ) {
|
670 |
return false;
|
apps/Backend/Modules/SystemInfo.php
CHANGED
@@ -428,7 +428,7 @@ class SystemInfo extends InjectionAware {
|
|
428 |
$output .= $this->info( "Upload Max Filesize:", ini_get( "upload_max_filesize" ) );
|
429 |
$output .= $this->info( "Time Limit:", ini_get( "max_execution_time" ) );
|
430 |
$output .= $this->info( "Max Input Vars:", ini_get( "max_input_vars" ) );
|
431 |
-
|
432 |
|
433 |
$displayErrors = ini_get( "display_errors" );
|
434 |
$output .= $this->info( "Display Errors:", ($displayErrors) ? "On ({$displayErrors})" : "N/A" );
|
@@ -444,7 +444,7 @@ class SystemInfo extends InjectionAware {
|
|
444 |
|
445 |
$user = '';
|
446 |
|
447 |
-
if( extension_loaded( 'posix' ) ) {
|
448 |
$file = WPSTG_PLUGIN_DIR . 'wp-staging.php';
|
449 |
$user = posix_getpwuid( fileowner( $file ) );
|
450 |
return isset($user['name']) ? $user['name'] : 'can not detect php user name';
|
428 |
$output .= $this->info( "Upload Max Filesize:", ini_get( "upload_max_filesize" ) );
|
429 |
$output .= $this->info( "Time Limit:", ini_get( "max_execution_time" ) );
|
430 |
$output .= $this->info( "Max Input Vars:", ini_get( "max_input_vars" ) );
|
431 |
+
$output .= $this->info( "PHP User:", $this->getPHPUser() );
|
432 |
|
433 |
$displayErrors = ini_get( "display_errors" );
|
434 |
$output .= $this->info( "Display Errors:", ($displayErrors) ? "On ({$displayErrors})" : "N/A" );
|
444 |
|
445 |
$user = '';
|
446 |
|
447 |
+
if( extension_loaded( 'posix' ) && function_exists('posix_getpwuid') ) {
|
448 |
$file = WPSTG_PLUGIN_DIR . 'wp-staging.php';
|
449 |
$user = posix_getpwuid( fileowner( $file ) );
|
450 |
return isset($user['name']) ? $user['name'] : 'can not detect php user name';
|
apps/Backend/views/_includes/messages/cache-directory-permission-problem.php
CHANGED
@@ -2,6 +2,6 @@
|
|
2 |
<p>
|
3 |
<strong>WP Staging Folder Permission error: </strong> <?php echo "{$varsDirectory}cache"?> is not write and/or readable.
|
4 |
<br>
|
5 |
-
Check if the folder <strong><?php echo "{$varsDirectory}cache"?></strong> exists!
|
6 |
</p>
|
7 |
</div>
|
2 |
<p>
|
3 |
<strong>WP Staging Folder Permission error: </strong> <?php echo "{$varsDirectory}cache"?> is not write and/or readable.
|
4 |
<br>
|
5 |
+
Check if the folder <strong><?php echo "{$varsDirectory}cache"?></strong> exists! Folder permissions should be chmod 755 or higher.
|
6 |
</p>
|
7 |
</div>
|
apps/Backend/views/_includes/messages/logs-directory-permission-problem.php
CHANGED
@@ -2,6 +2,6 @@
|
|
2 |
<p>
|
3 |
<strong>WP Staging Folder Permission error: </strong> <?php echo "{$varsDirectory}logs"?> is not write and/or readable.
|
4 |
<br>
|
5 |
-
Check if the folder <strong><?php echo "{$varsDirectory}logs"?></strong> exists!
|
6 |
</p>
|
7 |
</div>
|
2 |
<p>
|
3 |
<strong>WP Staging Folder Permission error: </strong> <?php echo "{$varsDirectory}logs"?> is not write and/or readable.
|
4 |
<br>
|
5 |
+
Check if the folder <strong><?php echo "{$varsDirectory}logs"?></strong> exists! Folder permissions should be chmod 755 or higher.
|
6 |
</p>
|
7 |
</div>
|
apps/Backend/views/_includes/messages/uploads-cache-directory-permission-problem.php
CHANGED
@@ -5,6 +5,6 @@
|
|
5 |
is not write and/or readable.
|
6 |
<br>
|
7 |
Check if the folder <strong><?php echo \WPStaging\WPStaging::getContentDir()?></strong> exists!
|
8 |
-
|
9 |
</p>
|
10 |
</div>
|
5 |
is not write and/or readable.
|
6 |
<br>
|
7 |
Check if the folder <strong><?php echo \WPStaging\WPStaging::getContentDir()?></strong> exists!
|
8 |
+
Folder permissions should be chmod 755 or higher.
|
9 |
</p>
|
10 |
</div>
|
apps/Backend/views/_includes/messages/vars-directory-permission-problem.php
CHANGED
@@ -2,6 +2,6 @@
|
|
2 |
<p>
|
3 |
<strong>WP Staging Folder Permission error: </strong> <?php echo "{$varsDirectory}"?> is not write and/or readable.
|
4 |
<br>
|
5 |
-
Check if the folder <strong><?php echo "{$varsDirectory}"?></strong> exists!
|
6 |
</p>
|
7 |
</div>
|
2 |
<p>
|
3 |
<strong>WP Staging Folder Permission error: </strong> <?php echo "{$varsDirectory}"?> is not write and/or readable.
|
4 |
<br>
|
5 |
+
Check if the folder <strong><?php echo "{$varsDirectory}"?></strong> exists! Folder permissions should be chmod 755 or 777.
|
6 |
</p>
|
7 |
</div>
|
apps/Core/WPStaging.php
CHANGED
@@ -29,7 +29,7 @@ final class WPStaging {
|
|
29 |
/**
|
30 |
* Plugin version
|
31 |
*/
|
32 |
-
const VERSION = "2.5.
|
33 |
|
34 |
/**
|
35 |
* Plugin name
|
29 |
/**
|
30 |
* Plugin version
|
31 |
*/
|
32 |
+
const VERSION = "2.5.3";
|
33 |
|
34 |
/**
|
35 |
* Plugin name
|
readme.txt
CHANGED
@@ -9,7 +9,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
9 |
Tags: staging, duplication, cloning, clone, migration, sandbox, test site, testing, backup, post, admin, administration, duplicate posts
|
10 |
Requires at least: 3.6+
|
11 |
Tested up to: 5.1
|
12 |
-
Stable tag: 2.5.
|
13 |
Requires PHP: 5.3
|
14 |
|
15 |
A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
|
@@ -146,6 +146,11 @@ https://wp-staging.com
|
|
146 |
|
147 |
== Changelog ==
|
148 |
|
|
|
|
|
|
|
|
|
|
|
149 |
= 2.5.2 =
|
150 |
* New: Tested up to WordPress 5.1.1
|
151 |
|
9 |
Tags: staging, duplication, cloning, clone, migration, sandbox, test site, testing, backup, post, admin, administration, duplicate posts
|
10 |
Requires at least: 3.6+
|
11 |
Tested up to: 5.1
|
12 |
+
Stable tag: 2.5.3
|
13 |
Requires PHP: 5.3
|
14 |
|
15 |
A duplicator plugin! Clone, duplicate and migrate live sites to independent staging and development sites that are available only to administrators.
|
146 |
|
147 |
== Changelog ==
|
148 |
|
149 |
+
= 2.5.3 =
|
150 |
+
* Fix: Disable the WP-Spamshield Plugin on staging site because it prevents login to staging site
|
151 |
+
* Fix: Lower the memory consumption when cloning scan process is started
|
152 |
+
* New: Show PHP user in system info log
|
153 |
+
|
154 |
= 2.5.2 =
|
155 |
* New: Tested up to WordPress 5.1.1
|
156 |
|
wp-staging.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* Author: WP-Staging
|
8 |
* Author URI: https://wp-staging.com
|
9 |
* Contributors: ReneHermi, ilgityildirim
|
10 |
-
* Version: 2.5.
|
11 |
* Text Domain: wp-staging
|
12 |
* Domain Path: /languages/
|
13 |
|
@@ -51,7 +51,7 @@ if( !defined( 'WPSTG_PLUGIN_URL' ) ) {
|
|
51 |
|
52 |
// Version
|
53 |
if( !defined( 'WPSTG_VERSION' ) ) {
|
54 |
-
define( 'WPSTG_VERSION', '2.5.
|
55 |
}
|
56 |
|
57 |
// Must use version of the optimizer
|
7 |
* Author: WP-Staging
|
8 |
* Author URI: https://wp-staging.com
|
9 |
* Contributors: ReneHermi, ilgityildirim
|
10 |
+
* Version: 2.5.3
|
11 |
* Text Domain: wp-staging
|
12 |
* Domain Path: /languages/
|
13 |
|
51 |
|
52 |
// Version
|
53 |
if( !defined( 'WPSTG_VERSION' ) ) {
|
54 |
+
define( 'WPSTG_VERSION', '2.5.3' );
|
55 |
}
|
56 |
|
57 |
// Must use version of the optimizer
|