WordPress Backup & Security Plugin – BlogVault - Version 4.35

Version Description

  • Improved scanfiles and filelist api
Download this release

Release Info

Developer ritesh.soni36
Plugin Icon 128x128 WordPress Backup & Security Plugin – BlogVault
Version 4.35
Comparing to
See all releases

Code changes from version 4.31 to 4.35

Files changed (5) hide show
  1. blogvault.php +1 -1
  2. callback/wings/fs.php +62 -20
  3. callback/wings/manage.php +5 -5
  4. info.php +1 -1
  5. readme.txt +5 -2
blogvault.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://blogvault.net
5
  Description: Easiest way to backup & secure your WordPress site
6
  Author: Backup by BlogVault
7
  Author URI: https://blogvault.net
8
- Version: 4.31
9
  Network: True
10
  */
11
 
5
  Description: Easiest way to backup & secure your WordPress site
6
  Author: Backup by BlogVault
7
  Author URI: https://blogvault.net
8
+ Version: 4.35
9
  Network: True
10
  */
11
 
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();
callback/wings/manage.php CHANGED
@@ -483,11 +483,11 @@ class BVManageCallback extends BVCallbackBase {
483
 
484
  function upgrade_db(){
485
  if (function_exists('wp_upgrade')) {
486
- wp_upgrade();
487
- return "DONE";
488
- } else {
489
- return "NOUPGRADERFUNCTION";
490
- }
491
  }
492
 
493
  function process($request) {
483
 
484
  function upgrade_db(){
485
  if (function_exists('wp_upgrade')) {
486
+ wp_upgrade();
487
+ return "DONE";
488
+ } else {
489
+ return "NOUPGRADERFUNCTION";
490
+ }
491
  }
492
 
493
  function process($request) {
info.php CHANGED
@@ -9,7 +9,7 @@ if (!class_exists('BVInfo')) :
9
  public $badgeinfo = 'bvbadge';
10
  public $ip_header_option = 'bvipheader';
11
  public $brand_option = 'bvbrand';
12
- public $version = '4.31';
13
  public $webpage = 'https://blogvault.net';
14
  public $appurl = 'https://app.blogvault.net';
15
  public $slug = 'blogvault-real-time-backup/blogvault.php';
9
  public $badgeinfo = 'bvbadge';
10
  public $ip_header_option = 'bvipheader';
11
  public $brand_option = 'bvbrand';
12
+ public $version = '4.35';
13
  public $webpage = 'https://blogvault.net';
14
  public $appurl = 'https://app.blogvault.net';
15
  public $slug = 'blogvault-real-time-backup/blogvault.php';
readme.txt CHANGED
@@ -4,9 +4,9 @@ Tags: backup, wordpress backup, backup plugin, cloud backup, database backup, ba
4
  Plugin URI: https://blogvault.net/
5
  Donate link: https://app.blogvault.net/home/signup
6
  Requires at least: 4.0
7
- Tested up to: 5.4
8
  Requires PHP: 5.4.0
9
- Stable tag: 4.31
10
  License: GPLv2 or later
11
  License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
12
 
@@ -240,6 +240,9 @@ Thank you. We really appreciate these kind words, and it makes our day. We would
240
  9. We power WordPress migration for WPEngine, Pantheon, FlyWheel, LiquidWeb, Cloudways, Savvii and many more. Need we say more?
241
 
242
  == CHANGELOG ==
 
 
 
243
  = 4.31 =
244
  * Update Database after wp-core update
245
  * Handling Child theme updates better code
4
  Plugin URI: https://blogvault.net/
5
  Donate link: https://app.blogvault.net/home/signup
6
  Requires at least: 4.0
7
+ Tested up to: 5.5
8
  Requires PHP: 5.4.0
9
+ Stable tag: 4.35
10
  License: GPLv2 or later
11
  License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
12
 
240
  9. We power WordPress migration for WPEngine, Pantheon, FlyWheel, LiquidWeb, Cloudways, Savvii and many more. Need we say more?
241
 
242
  == CHANGELOG ==
243
+ = 4.35 =
244
+ * Improved scanfiles and filelist api
245
+
246
  = 4.31 =
247
  * Update Database after wp-core update
248
  * Handling Child theme updates better code