Migrate Guru: Migrate & Clone WordPress Free - Version 4.69

Version Description

  • Improved network call efficiency for site info callbacks
Download this release

Release Info

Developer ritesh.soni36
Plugin Icon 128x128 Migrate Guru: Migrate & Clone WordPress Free
Version 4.69
Comparing to
See all releases

Code changes from version 4.68 to 4.69

Files changed (5) hide show
  1. callback/base.php +1 -1
  2. callback/wings/info.php +103 -9
  3. info.php +1 -1
  4. migrateguru.php +1 -1
  5. readme.txt +4 -1
callback/base.php CHANGED
@@ -10,7 +10,7 @@ class BVCallbackBase {
10
  "ACCOUNT_WING_VERSION" => '1.0',
11
  "MISC_WING_VERSION" => '1.1',
12
  "FS_WING_VERSION" => '1.0',
13
- "INFO_WING_VERSION" => '1.0',
14
  );
15
 
16
  public function objectToArray($obj) {
10
  "ACCOUNT_WING_VERSION" => '1.0',
11
  "MISC_WING_VERSION" => '1.1',
12
  "FS_WING_VERSION" => '1.0',
13
+ "INFO_WING_VERSION" => '1.1',
14
  );
15
 
16
  public function objectToArray($obj) {
callback/wings/info.php CHANGED
@@ -9,7 +9,7 @@ class BVInfoCallback extends BVCallbackBase {
9
  public $siteinfo;
10
  public $bvinfo;
11
 
12
- const INFO_WING_VERSION = 1.0;
13
 
14
  public function __construct($callback_handler) {
15
  $this->db = $callback_handler->db;
@@ -118,7 +118,7 @@ class BVInfoCallback extends BVCallbackBase {
118
  $sys_info['webuid'] = posix_getuid();
119
  $sys_info['webgid'] = posix_getgid();
120
  }
121
- return array("sys" => $sys_info);
122
  }
123
 
124
  public function getWpInfo() {
@@ -178,7 +178,7 @@ class BVInfoCallback extends BVCallbackBase {
178
  $results[] = $result;
179
  }
180
  }
181
- return array("users" => $results);
182
  }
183
 
184
  public function availableFunctions(&$info) {
@@ -258,6 +258,100 @@ class BVInfoCallback extends BVCallbackBase {
258
  return array('host_info' => $host_info);
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  public function process($request) {
262
  $db = $this->db;
263
  $params = $request->params;
@@ -284,7 +378,7 @@ class BVInfoCallback extends BVCallbackBase {
284
  $resp = $this->getThemes();
285
  break;
286
  case "gtsym":
287
- $resp = $this->getSystemInfo();
288
  break;
289
  case "gtwp":
290
  $resp = $this->getWpInfo();
@@ -303,13 +397,10 @@ class BVInfoCallback extends BVCallbackBase {
303
  $full = false;
304
  if (array_key_exists('full', $params))
305
  $full = true;
306
- $resp = $this->getUsers($full, $params['args']);
307
  break;
308
  case "gttrnsnt":
309
- $transient = $this->settings->getTransient($params['name']);
310
- if ($transient && array_key_exists('asarray', $params))
311
- $transient = $this->objectToArray($transient);
312
- $resp = array("transient" => $transient);
313
  break;
314
  case "gthost":
315
  $resp = $this->getHostInfo();
@@ -324,6 +415,9 @@ class BVInfoCallback extends BVCallbackBase {
324
  $data = apply_filters('plugins_api', false, $action, $args);
325
  $resp = array("plugins_info" => $data);
326
  break;
 
 
 
327
  default:
328
  $resp = false;
329
  }
9
  public $siteinfo;
10
  public $bvinfo;
11
 
12
+ const INFO_WING_VERSION = 1.1;
13
 
14
  public function __construct($callback_handler) {
15
  $this->db = $callback_handler->db;
118
  $sys_info['webuid'] = posix_getuid();
119
  $sys_info['webgid'] = posix_getgid();
120
  }
121
+ return $sys_info;
122
  }
123
 
124
  public function getWpInfo() {
178
  $results[] = $result;
179
  }
180
  }
181
+ return $results;
182
  }
183
 
184
  public function availableFunctions(&$info) {
258
  return array('host_info' => $host_info);
259
  }
260
 
261
+ function refreshUpdatesInfo() {
262
+ global $wp_current_filter;
263
+ $wp_current_filter[] = 'load-update-core.php';
264
+
265
+ if (function_exists('wp_clean_update_cache')) {
266
+ wp_clean_update_cache();
267
+ } else {
268
+ $this->settings->deleteTransient('update_plugins');
269
+ $this->settings->deleteTransient('update_themes');
270
+ $this->settings->deleteTransient('update_core');
271
+ }
272
+
273
+ wp_update_plugins();
274
+ wp_update_themes();
275
+
276
+ array_pop($wp_current_filter);
277
+
278
+ wp_update_plugins();
279
+ wp_update_themes();
280
+
281
+ wp_version_check();
282
+ wp_version_check(array(), true);
283
+
284
+ return true;
285
+ }
286
+
287
+ function getUsersHandler($args = array()) {
288
+ $db = $this->db;
289
+ $table = "{$db->dbprefix()}users";
290
+ $count = $db->rowsCount($table);
291
+ $result = array("count" => $count);
292
+
293
+ $max_users = array_key_exists('max_users', $args) ? $args['max_users'] : 500;
294
+ $roles = array_key_exists('roles', $args) ? $args['roles'] : array();
295
+
296
+ $users = array();
297
+ if (($count > $max_users) && !empty($roles)) {
298
+ foreach ($roles as $role) {
299
+ if ($max_users <= 0)
300
+ break;
301
+ $args['number'] = $max_users;
302
+ $args['role'] = $role;
303
+ $fetched = $this->getUsers($args['full'], $args);
304
+ $max_users -= sizeof($fetched);
305
+ $users = array_merge($users, $fetched);
306
+ }
307
+ } else {
308
+ $args['number'] = $max_users;
309
+ $users = $this->getUsers($args['full'], $args);
310
+ }
311
+ $result['users_info'] = $users;
312
+
313
+ return $result;
314
+ }
315
+
316
+ function getTransient($name, $asarray = true) {
317
+ $transient = $this->settings->getTransient($name);
318
+ if ($transient && $asarray)
319
+ $transient = $this->objectToArray($transient);
320
+ return array("transient" => $transient);
321
+ }
322
+
323
+ function getPluginsHandler() {
324
+ return array_merge($this->getPlugins(), $this->getTransient('update_plugins'));
325
+ }
326
+
327
+ function getThemesHandler() {
328
+ return array_merge($this->getThemes(), $this->getTransient('update_themes'));
329
+ }
330
+
331
+ public function getSiteInfo($args) {
332
+ $result = array();
333
+
334
+ if (array_key_exists('refresh', $args))
335
+ $result['refreshed'] = $this->refreshUpdatesInfo();
336
+
337
+ if (array_key_exists('users', $args))
338
+ $result['users'] = $this->getUsersHandler($args['users']);
339
+
340
+ if (array_key_exists('plugins', $args))
341
+ $result['plugins'] = $this->getPluginsHandler();
342
+
343
+ if (array_key_exists('themes', $args))
344
+ $result['themes'] = $this->getThemesHandler();
345
+
346
+ if (array_key_exists('core', $args))
347
+ $result['core'] = $this->getTransient('update_core');
348
+
349
+ if (array_key_exists('sys', $args))
350
+ $result['sys'] = $this->getSystemInfo();
351
+
352
+ return $result;
353
+ }
354
+
355
  public function process($request) {
356
  $db = $this->db;
357
  $params = $request->params;
378
  $resp = $this->getThemes();
379
  break;
380
  case "gtsym":
381
+ $resp = array('sys' => $this->getSystemInfo());
382
  break;
383
  case "gtwp":
384
  $resp = $this->getWpInfo();
397
  $full = false;
398
  if (array_key_exists('full', $params))
399
  $full = true;
400
+ $resp = array('users' => $this->getUsers($full, $params['args']));
401
  break;
402
  case "gttrnsnt":
403
+ $resp = $this->getTransient($params['name'], array_key_exists('asarray', $params));
 
 
 
404
  break;
405
  case "gthost":
406
  $resp = $this->getHostInfo();
415
  $data = apply_filters('plugins_api', false, $action, $args);
416
  $resp = array("plugins_info" => $data);
417
  break;
418
+ case "gtsteinfo":
419
+ $resp = $this->getSiteInfo($params);
420
+ break;
421
  default:
422
  $resp = false;
423
  }
info.php CHANGED
@@ -10,7 +10,7 @@ if (!class_exists('MGInfo')) :
10
  public $badgeinfo = 'bvmgbadge';
11
  public $ip_header_option = 'bvmgipheader';
12
  public $brand_option = 'bvmgbrand';
13
- public $version = '4.68';
14
  public $webpage = 'https://www.migrateguru.com';
15
  public $appurl = 'https://mg.blogvault.net';
16
  public $slug = 'migrate-guru/migrateguru.php';
10
  public $badgeinfo = 'bvmgbadge';
11
  public $ip_header_option = 'bvmgipheader';
12
  public $brand_option = 'bvmgbrand';
13
+ public $version = '4.69';
14
  public $webpage = 'https://www.migrateguru.com';
15
  public $appurl = 'https://mg.blogvault.net';
16
  public $slug = 'migrate-guru/migrateguru.php';
migrateguru.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.migrateguru.com
5
  Description: Migrating your site(s) to any WordPress Hosting platform has never been so easy.
6
  Author: Migrate Guru
7
  Author URI: http://www.migrateguru.com
8
- Version: 4.68
9
  Network: True
10
  */
11
 
5
  Description: Migrating your site(s) to any WordPress Hosting platform has never been so easy.
6
  Author: Migrate Guru
7
  Author URI: http://www.migrateguru.com
8
+ Version: 4.69
9
  Network: True
10
  */
11
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://www.migrateguru.com/
6
  Requires at least: 4.0
7
  Tested up to: 5.8
8
  Requires PHP: 5.4.0
9
- Stable tag: 4.68
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
 
@@ -132,6 +132,9 @@ Yes, we do. You can access it here: https://migrateguru.freshdesk.com/support/ho
132
  6. Click ‘Migrate’.
133
 
134
  == Changelog =
 
 
 
135
  = 4.68 =
136
  * Removing use of constants for arrays for PHP 5.4 support.
137
 
6
  Requires at least: 4.0
7
  Tested up to: 5.8
8
  Requires PHP: 5.4.0
9
+ Stable tag: 4.69
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
 
132
  6. Click ‘Migrate’.
133
 
134
  == Changelog =
135
+ = 4.69 =
136
+ * Improved network call efficiency for site info callbacks
137
+
138
  = 4.68 =
139
  * Removing use of constants for arrays for PHP 5.4 support.
140