WP Engine Automated Migration - Version 4.35

Version Description

  • Improved scanfiles and filelist api
Download this release

Release Info

Developer ritesh.soni36
Plugin Icon 128x128 WP Engine Automated Migration
Version 4.35
Comparing to
See all releases

Code changes from version 4.31 to 4.35

Files changed (4) hide show
  1. callback/wings/fs.php +62 -20
  2. info.php +1 -1
  3. readme.txt +5 -2
  4. wpengine.php +1 -1
callback/wings/fs.php CHANGED
@@ -14,7 +14,7 @@ class BVFSCallback extends BVCallbackBase {
14
  $this->account = $callback_handler->account;
15
  }
16
 
17
- function fileStat($relfile) {
18
  $absfile = ABSPATH.$relfile;
19
  $fdata = array();
20
  $fdata["filename"] = $relfile;
@@ -26,6 +26,9 @@ class BVFSCallback extends BVCallbackBase {
26
  if (is_link($absfile)) {
27
  $fdata["link"] = @readlink($absfile);
28
  }
 
 
 
29
  } else {
30
  $fdata["failed"] = true;
31
  }
@@ -78,8 +81,9 @@ class BVFSCallback extends BVCallbackBase {
78
  return array("status" => "done");
79
  }
80
 
81
- function scanFiles($initdir = "./", $offset = 0, $limit = 0, $bsize = 512, $recurse = true) {
82
  $i = 0;
 
83
  $dirs = array();
84
  $dirs[] = $initdir;
85
  $bfc = 0;
@@ -93,6 +97,9 @@ class BVFSCallback extends BVCallbackBase {
93
  if ($file == '.' || $file == '..') { continue; }
94
  $relfile = $dir.$file;
95
  $absfile = ABSPATH.$relfile;
 
 
 
96
  if (is_dir($absfile) && !is_link($absfile)) {
97
  $dirs[] = $relfile."/";
98
  }
@@ -103,7 +110,7 @@ class BVFSCallback extends BVCallbackBase {
103
  $i = count($dirs);
104
  break;
105
  }
106
- $bfa[] = $this->fileStat($relfile);
107
  $bfc++;
108
  if ($bfc == $bsize) {
109
  $str = serialize($bfa);
@@ -122,7 +129,8 @@ class BVFSCallback extends BVCallbackBase {
122
  $str = serialize($bfa);
123
  $this->stream->writeStream($str);
124
  }
125
- return array("status" => "done");
 
126
  }
127
 
128
  function calculateMd5($absfile, $fdata, $offset, $limit, $bsize) {
@@ -256,15 +264,29 @@ class BVFSCallback extends BVCallbackBase {
256
  $resp = $this->scanFilesUsingGlob($initdir, $offset, $limit, $bsize, $recurse, $regex);
257
  break;
258
  case "scanfiles":
259
- $initdir = urldecode($params['initdir']);
260
- $offset = intval(urldecode($params['offset']));
261
- $limit = intval(urldecode($params['limit']));
 
 
262
  $bsize = intval(urldecode($params['bsize']));
263
- $recurse = true;
264
- if (array_key_exists('recurse', $params) && $params["recurse"] == "false") {
265
- $recurse = false;
 
 
 
 
 
 
 
 
 
 
 
 
266
  }
267
- $resp = $this->scanFiles($initdir, $offset, $limit, $bsize, $recurse);
268
  break;
269
  case "getfilesstats":
270
  $files = $params['files'];
@@ -285,17 +307,37 @@ class BVFSCallback extends BVCallbackBase {
285
  $resp = $this->uploadFiles($files, $offset, $limit, $bsize);
286
  break;
287
  case "filelist":
288
- $initdir = $params['initdir'];
289
- $glob_option = GLOB_MARK;
290
- if(array_key_exists('onlydir', $params)) {
291
- $glob_option = GLOB_ONLYDIR;
 
 
292
  }
293
- $regex = "*";
294
- if(array_key_exists('regex', $params)){
295
- $regex = $params['regex'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
- $directoryList = glob($initdir.$regex, $glob_option);
298
- $resp = $this->getFilesStats($directoryList);
299
  break;
300
  case "dirsexists":
301
  $resp = array();
14
  $this->account = $callback_handler->account;
15
  }
16
 
17
+ function fileStat($relfile, $md5 = false) {
18
  $absfile = ABSPATH.$relfile;
19
  $fdata = array();
20
  $fdata["filename"] = $relfile;
26
  if (is_link($absfile)) {
27
  $fdata["link"] = @readlink($absfile);
28
  }
29
+ if ($md5 === true) {
30
+ $fdata["md5"] = $this->calculateMd5($absfile, array(), 0, 0, 0);
31
+ }
32
  } else {
33
  $fdata["failed"] = true;
34
  }
81
  return array("status" => "done");
82
  }
83
 
84
+ function scanFiles($initdir = "./", $offset = 0, $limit = 0, $bsize = 512, $recurse = true, $md5 = false) {
85
  $i = 0;
86
+ $links = array();
87
  $dirs = array();
88
  $dirs[] = $initdir;
89
  $bfc = 0;
97
  if ($file == '.' || $file == '..') { continue; }
98
  $relfile = $dir.$file;
99
  $absfile = ABSPATH.$relfile;
100
+ if (is_link($absfile)) {
101
+ $links[] = $relfile;
102
+ }
103
  if (is_dir($absfile) && !is_link($absfile)) {
104
  $dirs[] = $relfile."/";
105
  }
110
  $i = count($dirs);
111
  break;
112
  }
113
+ $bfa[] = $this->fileStat($relfile, $md5);
114
  $bfc++;
115
  if ($bfc == $bsize) {
116
  $str = serialize($bfa);
129
  $str = serialize($bfa);
130
  $this->stream->writeStream($str);
131
  }
132
+
133
+ return $links;
134
  }
135
 
136
  function calculateMd5($absfile, $fdata, $offset, $limit, $bsize) {
264
  $resp = $this->scanFilesUsingGlob($initdir, $offset, $limit, $bsize, $recurse, $regex);
265
  break;
266
  case "scanfiles":
267
+ $links = array();
268
+ $dir_options = array();
269
+ if (array_key_exists('dir_options', $params)) {
270
+ $dir_options = $params['dir_options'];
271
+ }
272
  $bsize = intval(urldecode($params['bsize']));
273
+ foreach($dir_options as $option) {
274
+ $dir = urldecode($option['dir']);
275
+ $offset = intval(urldecode($option['offset']));
276
+ $limit = intval(urldecode($option['limit']));
277
+ $recurse = true;
278
+ if (array_key_exists('recurse', $option) && $option["recurse"] == "false") {
279
+ $recurse = false;
280
+ }
281
+ $md5 = true;
282
+ if (array_key_exists('md5', $option) && $option["md5"] == "false") {
283
+ $md5 = false;
284
+ }
285
+
286
+ $_links = $this->scanFiles($dir, $offset, $limit, $bsize, $recurse, $md5);
287
+ $links = array_merge($links, $_links);
288
  }
289
+ $resp = array("status" => "done", "links" => $links);
290
  break;
291
  case "getfilesstats":
292
  $files = $params['files'];
307
  $resp = $this->uploadFiles($files, $offset, $limit, $bsize);
308
  break;
309
  case "filelist":
310
+ $dir_options = array();
311
+ if (array_key_exists('dir_options', $params)) {
312
+ $dir_options = $params['dir_options'];
313
+ }
314
+ if (array_key_exists('chdir', $params)) {
315
+ chdir(ABSPATH);
316
  }
317
+ $resp = array();
318
+ foreach($dir_options as $options) {
319
+ $glob_option = 0;
320
+ if (array_key_exists('onlydir', $options)) {
321
+ $glob_option = GLOB_ONLYDIR;
322
+ }
323
+
324
+ $regexes = array("*", ".*");
325
+ if (array_key_exists('regex', $options)) {
326
+ $regexes = array($options['regex']);
327
+ }
328
+
329
+ $md5 = false;
330
+ if (array_key_exists('md5', $options)) {
331
+ $md5 = $options['md5'];
332
+ }
333
+
334
+ $directoryList = array();
335
+
336
+ foreach($regexes as $regex) {
337
+ $directoryList = array_merge($directoryList, glob($options['dir'].$regex, $glob_option));
338
+ }
339
+ $resp[$options['dir']] = $this->getFilesStats($directoryList, 0, 0, 0, $md5);
340
  }
 
 
341
  break;
342
  case "dirsexists":
343
  $resp = array();
info.php CHANGED
@@ -9,7 +9,7 @@ if (!class_exists('WPEInfo')) :
9
  public $badgeinfo = 'wpebadge';
10
  public $ip_header_option = 'wpeipheader';
11
  public $brand_option = 'wpebrand';
12
- public $version = '4.31';
13
  public $webpage = 'https://wpengine.com';
14
  public $appurl = 'https://wpengine.blogvault.net';
15
  public $slug = 'wp-site-migrate/wpengine.php';
9
  public $badgeinfo = 'wpebadge';
10
  public $ip_header_option = 'wpeipheader';
11
  public $brand_option = 'wpebrand';
12
+ public $version = '4.35';
13
  public $webpage = 'https://wpengine.com';
14
  public $appurl = 'https://wpengine.blogvault.net';
15
  public $slug = 'wp-site-migrate/wpengine.php';
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: wpengine, blogvault, akshatc, taylor4484
3
  Tags: wpe, wpengine, migration
4
  Requires at least: 4.0
5
- Tested up to: 5.4
6
  Requires PHP: 5.4.0
7
- Stable tag: 4.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -79,6 +79,9 @@ That's easy! [Signup here](http://wpengine.com/plans/).
79
  2. BlogVault dashboard showing live updates.
80
 
81
  == Changelog ==
 
 
 
82
  = 4.31 =
83
  * Fetching Mysql Version
84
  * Robust data fetch APIs
2
  Contributors: wpengine, blogvault, akshatc, taylor4484
3
  Tags: wpe, wpengine, migration
4
  Requires at least: 4.0
5
+ Tested up to: 5.6
6
  Requires PHP: 5.4.0
7
+ Stable tag: 4.35
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
79
  2. BlogVault dashboard showing live updates.
80
 
81
  == Changelog ==
82
+ = 4.35 =
83
+ * Improved scanfiles and filelist api
84
+
85
  = 4.31 =
86
  * Fetching Mysql Version
87
  * Robust data fetch APIs
wpengine.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://wpengine.com
5
  Description: The easiest way to migrate your site to WP Engine
6
  Author: WPEngine
7
  Author URI: https://wpengine.com
8
- Version: 4.31
9
  Network: True
10
  */
11
 
5
  Description: The easiest way to migrate your site to WP Engine
6
  Author: WPEngine
7
  Author URI: https://wpengine.com
8
+ Version: 4.35
9
  Network: True
10
  */
11