WP Engine Automated Migration - Version 4.65

Version Description

  • Robust handling of requests params.
  • Callback wing versioning.
Download this release

Release Info

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

Code changes from version 4.62 to 4.65

callback/base.php CHANGED
@@ -4,6 +4,15 @@ if (!defined('ABSPATH')) exit;
4
  if (!class_exists('BVCallbackBase')) :
5
 
6
  class BVCallbackBase {
 
 
 
 
 
 
 
 
 
7
  public function objectToArray($obj) {
8
  return json_decode(json_encode($obj), true);
9
  }
4
  if (!class_exists('BVCallbackBase')) :
5
 
6
  class BVCallbackBase {
7
+
8
+ const WING_INFOS = array("BRAND_WING_VERSION" => '1.0',
9
+ "DB_WING_VERSION" => '1.0',
10
+ "ACCOUNT_WING_VERSION" => '1.0',
11
+ "MISC_WING_VERSION" => '1.0',
12
+ "FS_WING_VERSION" => '1.0',
13
+ "INFO_WING_VERSION" => '1.0',
14
+ );
15
+
16
  public function objectToArray($obj) {
17
  return json_decode(json_encode($obj), true);
18
  }
callback/request.php CHANGED
@@ -40,6 +40,46 @@ if (!class_exists('BVCallbackRequest')) :
40
  return array_key_exists('apicall', $this->params);
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  public function info() {
44
  $info = array(
45
  "requestedsig" => $this->sig,
@@ -70,11 +110,6 @@ if (!class_exists('BVCallbackRequest')) :
70
  if (array_key_exists('op_reset', $in_params) && function_exists('output_reset_rewrite_vars'))
71
  @output_reset_rewrite_vars();
72
 
73
- if (array_key_exists('binhead', $in_params)) {
74
- header("Content-type: application/binary");
75
- header('Content-Transfer-Encoding: binary');
76
- }
77
-
78
  if (array_key_exists('concat', $in_params)) {
79
  foreach ($in_params['concat'] as $key) {
80
  $concated = '';
@@ -86,6 +121,13 @@ if (!class_exists('BVCallbackRequest')) :
86
  }
87
  }
88
 
 
 
 
 
 
 
 
89
  if (array_key_exists('bvprms', $in_params) && isset($in_params['bvprms']) &&
90
  array_key_exists('bvprmsmac', $in_params) && isset($in_params['bvprmsmac'])) {
91
  $digest_algo = 'SHA1';
40
  return array_key_exists('apicall', $this->params);
41
  }
42
 
43
+ public function curlRequest($url, $body) {
44
+ $ch = curl_init($url);
45
+ curl_setopt($ch, CURLOPT_POST, 1);
46
+ curl_setopt($ch, CURLOPT_TIMEOUT, 15);
47
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($body));
48
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
49
+ return curl_exec($ch);
50
+ }
51
+
52
+ public function fileGetContentRequest($url, $body) {
53
+ $options = array(
54
+ 'http' => array(
55
+ 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
56
+ 'method' => 'POST',
57
+ 'content' => http_build_query($body)
58
+ )
59
+ );
60
+
61
+ $context = stream_context_create($options);
62
+ return file_get_contents($url, false, $context);
63
+ }
64
+
65
+ public function http_request($url, $body) {
66
+ if (in_array('curl', get_loaded_extensions())) {
67
+ return $this->curlRequest($url, $body);
68
+ } else {
69
+ return $this->fileGetContentRequest($url, $body);
70
+ }
71
+ }
72
+
73
+ public function get_params_via_api($params_key, $apiurl) {
74
+ $res = $this->http_request($apiurl, array('bvkey' => $params_key));
75
+
76
+ if ($res === FALSE) {
77
+ return false;
78
+ }
79
+
80
+ return $res;
81
+ }
82
+
83
  public function info() {
84
  $info = array(
85
  "requestedsig" => $this->sig,
110
  if (array_key_exists('op_reset', $in_params) && function_exists('output_reset_rewrite_vars'))
111
  @output_reset_rewrite_vars();
112
 
 
 
 
 
 
113
  if (array_key_exists('concat', $in_params)) {
114
  foreach ($in_params['concat'] as $key) {
115
  $concated = '';
121
  }
122
  }
123
 
124
+ if (isset($in_params['bvpdataviaapi']) && isset($in_params['bvapiurl'])) {
125
+ $pdata = $this->get_params_via_api($in_params['bvpdataviaapi'], $in_params['bvapiurl']);
126
+ if ($pdata !== false) {
127
+ $in_params["bvprms"] = $pdata;
128
+ }
129
+ }
130
+
131
  if (array_key_exists('bvprms', $in_params) && isset($in_params['bvprms']) &&
132
  array_key_exists('bvprmsmac', $in_params) && isset($in_params['bvprmsmac'])) {
133
  $digest_algo = 'SHA1';
callback/wings/account.php CHANGED
@@ -5,6 +5,8 @@ if (!class_exists('BVAccountCallback')) :
5
  class BVAccountCallback extends BVCallbackBase {
6
  public $account;
7
  public $settings;
 
 
8
 
9
  public function __construct($callback_handler) {
10
  $this->account = $callback_handler->account;
5
  class BVAccountCallback extends BVCallbackBase {
6
  public $account;
7
  public $settings;
8
+
9
+ const ACCOUNT_WING_VERSION = 1.0;
10
 
11
  public function __construct($callback_handler) {
12
  $this->account = $callback_handler->account;
callback/wings/brand.php CHANGED
@@ -6,6 +6,8 @@ if (!class_exists('BVBrandCallback')) :
6
  class BVBrandCallback extends BVCallbackBase {
7
  public $settings;
8
 
 
 
9
  public function __construct($callback_handler) {
10
  $this->settings = $callback_handler->settings;
11
  }
6
  class BVBrandCallback extends BVCallbackBase {
7
  public $settings;
8
 
9
+ const BRAND_WING_VERSION = 1.0;
10
+
11
  public function __construct($callback_handler) {
12
  $this->settings = $callback_handler->settings;
13
  }
callback/wings/db.php CHANGED
@@ -11,6 +11,8 @@ class BVDBCallback extends BVCallbackBase {
11
 
12
  public static $bvTables = array("fw_requests", "lp_requests", "ip_store");
13
 
 
 
14
  public function __construct($callback_handler) {
15
  $this->db = $callback_handler->db;
16
  $this->account = $callback_handler->account;
@@ -203,6 +205,32 @@ class BVDBCallback extends BVCallbackBase {
203
  $result["rows"] = $rows;
204
  $resp = $result;
205
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  case "tableinfo":
207
  $table = urldecode($params['table']);
208
  $offset = intval(urldecode($params['offset']));
11
 
12
  public static $bvTables = array("fw_requests", "lp_requests", "ip_store");
13
 
14
+ const DB_WING_VERSION = 1.0;
15
+
16
  public function __construct($callback_handler) {
17
  $this->db = $callback_handler->db;
18
  $this->account = $callback_handler->account;
205
  $result["rows"] = $rows;
206
  $resp = $result;
207
  break;
208
+ case "multitablecontent":
209
+ $tableParams = $params['table_params'];
210
+ $resp = array();
211
+ foreach($tableParams as $tableParam) {
212
+ $result = array();
213
+ $identifier = $tableParam['identifier'];
214
+ $table = $tableParam['table'];
215
+ $tname = $tableParam['tname'];
216
+ $fields = $tableParam['fields'];
217
+ $filter = (array_key_exists('filter', $tableParam)) ? $tableParam['filter'] : "";
218
+ $limit = $tableParam['limit'];
219
+ $offset = $tableParam['offset'];
220
+ $pkeys = (array_key_exists('pkeys', $tableParam)) ? $tableParam['pkeys'] : array();
221
+ $result['timestamp'] = time();
222
+ $result['table_name'] = $tname;
223
+ $rows = $db->getTableContent($table, $fields, $filter, $limit, $offset);
224
+ $srows = sizeof($rows);
225
+ if (!empty($pkeys) && $srows > 0) {
226
+ $end_row = end($rows);
227
+ $result['last_ids'] = $this->getLastID($pkeys, $end_row);
228
+ }
229
+ $result["rows"] = $rows;
230
+ $result["size"] = $srows;
231
+ $resp[$identifier] = $result;
232
+ }
233
+ break;
234
  case "tableinfo":
235
  $table = urldecode($params['table']);
236
  $offset = intval(urldecode($params['offset']));
callback/wings/fs.php CHANGED
@@ -9,6 +9,7 @@ class BVFSCallback extends BVCallbackBase {
9
  public $account;
10
 
11
  public static $cwAllowedFiles = array(".htaccess", ".user.ini", "malcare-waf.php");
 
12
 
13
  public function __construct($callback_handler) {
14
  $this->account = $callback_handler->account;
9
  public $account;
10
 
11
  public static $cwAllowedFiles = array(".htaccess", ".user.ini", "malcare-waf.php");
12
+ const FS_WING_VERSION = 1.0;
13
 
14
  public function __construct($callback_handler) {
15
  $this->account = $callback_handler->account;
callback/wings/info.php CHANGED
@@ -8,6 +8,8 @@ class BVInfoCallback extends BVCallbackBase {
8
  public $settings;
9
  public $siteinfo;
10
  public $bvinfo;
 
 
11
 
12
  public function __construct($callback_handler) {
13
  $this->db = $callback_handler->db;
@@ -156,7 +158,7 @@ class BVInfoCallback extends BVCallbackBase {
156
  return array("wp" => $wp_info);
157
  }
158
 
159
- public function getUsers($args = array(), $full) {
160
  $results = array();
161
  $users = get_users($args);
162
  if ('true' == $full) {
@@ -205,9 +207,6 @@ class BVInfoCallback extends BVCallbackBase {
205
 
206
  public function servicesInfo(&$data) {
207
  $settings = $this->settings;
208
- $data['dynsync'] = $settings->getOption('bvDynSyncActive');
209
- $data['woodyn'] = $settings->getOption('bvWooDynSync');
210
- $data['dynplug'] = $settings->getOption('bvdynplug');
211
  $data['protect'] = $settings->getOption('bvptconf');
212
  $data['brand'] = $settings->getOption($this->bvinfo->brand_option);
213
  $data['badgeinfo'] = $settings->getOption($this->bvinfo->badgeinfo);
@@ -304,7 +303,7 @@ class BVInfoCallback extends BVCallbackBase {
304
  $full = false;
305
  if (array_key_exists('full', $params))
306
  $full = true;
307
- $resp = $this->getUsers($params['args'], $full);
308
  break;
309
  case "gttrnsnt":
310
  $transient = $this->settings->getTransient($params['name']);
8
  public $settings;
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;
158
  return array("wp" => $wp_info);
159
  }
160
 
161
+ public function getUsers($full, $args = array()) {
162
  $results = array();
163
  $users = get_users($args);
164
  if ('true' == $full) {
207
 
208
  public function servicesInfo(&$data) {
209
  $settings = $this->settings;
 
 
 
210
  $data['protect'] = $settings->getOption('bvptconf');
211
  $data['brand'] = $settings->getOption($this->bvinfo->brand_option);
212
  $data['badgeinfo'] = $settings->getOption($this->bvinfo->badgeinfo);
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']);
callback/wings/misc.php CHANGED
@@ -9,11 +9,15 @@ class BVMiscCallback extends BVCallbackBase {
9
  public $siteinfo;
10
  public $account;
11
  public $bvapi;
 
 
 
12
 
13
  public function __construct($callback_handler) {
14
  $this->settings = $callback_handler->settings;
15
  $this->siteinfo = $callback_handler->siteinfo;
16
  $this->account = $callback_handler->account;
 
17
  $this->bvinfo = new WPEInfo($callback_handler->settings);
18
  $this->bvapi = new WPEWPAPI($callback_handler->settings);
19
  }
@@ -44,6 +48,54 @@ class BVMiscCallback extends BVCallbackBase {
44
  return array("wpupdatethemes" => true);
45
  }
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  public function process($request) {
48
  $bvinfo = $this->bvinfo;
49
  $settings = $this->settings;
@@ -54,6 +106,7 @@ class BVMiscCallback extends BVCallbackBase {
54
  $resp = array_merge($resp, $this->siteinfo->info());
55
  $resp = array_merge($resp, $this->account->info());
56
  $resp = array_merge($resp, $this->bvinfo->info());
 
57
  break;
58
  case "pngbv":
59
  $info = array();
@@ -123,6 +176,21 @@ class BVMiscCallback extends BVCallbackBase {
123
  $resp["updated_configs"] = $updated_configs;
124
  $resp["deleted_configs"] = $deleted_configs;
125
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  default:
127
  $resp = false;
128
  }
9
  public $siteinfo;
10
  public $account;
11
  public $bvapi;
12
+ public $db;
13
+
14
+ const MISC_WING_VERSION = 1.0;
15
 
16
  public function __construct($callback_handler) {
17
  $this->settings = $callback_handler->settings;
18
  $this->siteinfo = $callback_handler->siteinfo;
19
  $this->account = $callback_handler->account;
20
+ $this->db = $callback_handler->db;
21
  $this->bvinfo = new WPEInfo($callback_handler->settings);
22
  $this->bvapi = new WPEWPAPI($callback_handler->settings);
23
  }
48
  return array("wpupdatethemes" => true);
49
  }
50
 
51
+ public function getWingInfo() {
52
+ return array('wing_info' => self::WING_INFOS);
53
+ }
54
+
55
+ public function post_types_data($post_params) {
56
+ $result = array();
57
+ $get_post_types_args = $post_params['get_post_types_args'];
58
+ $post_types = get_post_types($get_post_types_args);
59
+ $post_types = array_merge($post_types, $post_params['include_post_types']);
60
+ $post_types = array_diff( $post_types, $post_params['exclude_post_types']);
61
+ $result['post_types'] = $post_types;
62
+ $post_types = esc_sql($post_types);
63
+ $post_types = "'" . implode("','", $post_types) . "'";
64
+ $post_table = $post_params['table'];
65
+ $post_select_columns = implode(", ", $post_params['select_column']);
66
+ $post_query = "SELECT MAX(ID) as $post_select_columns FROM ( SELECT
67
+ $post_select_columns FROM $post_table WHERE post_type IN ( $post_types )
68
+ AND post_status='publish' ORDER BY post_date DESC ) AS posts GROUP BY post_type";
69
+ $posts = $this->db->getResult($post_query);
70
+ foreach ( $posts as $key => $post ) {
71
+ $posts[$key]['url'] = get_permalink($post);
72
+ }
73
+ $result['posts'] = $posts;
74
+ return $result;
75
+ }
76
+
77
+ public function taxonomy_data($taxonomy_params) {
78
+ $result = array();
79
+ $get_taxonomies_args = $taxonomy_params['get_taxonomies_args'];
80
+ $taxonomies = get_taxonomies($get_taxonomies_args);
81
+ $taxonomies = array_diff($taxonomies, $taxonomy_params['exclude_taxonomies']);
82
+ $result['taxonomies'] = $taxonomies;
83
+ $taxonomies = esc_sql( $taxonomies );
84
+ $taxonomies = "'" . implode( "','", $taxonomies ) . "'";
85
+ $taxonomy_table = $taxonomy_params['table'];
86
+ $taxonomy_select_columns = implode(", ", $taxonomy_params['select_column']);
87
+ $taxonomy_query = "SELECT MAX( term_id ) AS $taxonomy_select_columns FROM (
88
+ SELECT $taxonomy_select_columns FROM $taxonomy_table WHERE taxonomy IN (
89
+ $taxonomies ) AND count > 0) AS taxonomies GROUP BY taxonomy";
90
+
91
+ $taxonomies = $this->db->getResult($taxonomy_query);
92
+ foreach($taxonomies as $key => $taxonomy) {
93
+ $taxonomies[$key]['url'] = get_term_link((int)$taxonomy['term_id'], $taxonomy['taxonomy']);
94
+ }
95
+ $result['taxonomy_data'] = $taxonomies;
96
+ return $result;
97
+ }
98
+
99
  public function process($request) {
100
  $bvinfo = $this->bvinfo;
101
  $settings = $this->settings;
106
  $resp = array_merge($resp, $this->siteinfo->info());
107
  $resp = array_merge($resp, $this->account->info());
108
  $resp = array_merge($resp, $this->bvinfo->info());
109
+ $resp = array_merge($resp, $this->getWingInfo());
110
  break;
111
  case "pngbv":
112
  $info = array();
176
  $resp["updated_configs"] = $updated_configs;
177
  $resp["deleted_configs"] = $deleted_configs;
178
  break;
179
+ case "critical_css_data":
180
+ $resp = array();
181
+ if (array_key_exists('fetch_post_data', $params) && $params['fetch_post_data'] == true) {
182
+ $post_params = $params['post_params'];
183
+ $post_result = $this->post_types_data($post_params);
184
+ $resp['post_cp_results'] = $post_result['posts'];
185
+ $resp['post_types'] = $post_result['post_types'];
186
+ }
187
+ if (array_key_exists('fetch_taxonomy_data', $params) && $params['fetch_taxonomy_data'] == true) {
188
+ $taxonomy_params = $params['taxonomy_params'];
189
+ $taxonomy_result = $this->taxonomy_data($taxonomy_params);
190
+ $resp['taxonomy_cp_results'] = $taxonomy_result['taxonomy_data'];
191
+ $resp['taxonomies'] = $taxonomy_result['taxonomies'];
192
+ }
193
+ break;
194
  default:
195
  $resp = false;
196
  }
info.php CHANGED
@@ -10,7 +10,7 @@ if (!class_exists('WPEInfo')) :
10
  public $badgeinfo = 'wpebadge';
11
  public $ip_header_option = 'wpeipheader';
12
  public $brand_option = 'wpebrand';
13
- public $version = '4.62';
14
  public $webpage = 'https://wpengine.com';
15
  public $appurl = 'https://wpengine.blogvault.net';
16
  public $slug = 'wp-site-migrate/wpengine.php';
@@ -108,8 +108,13 @@ if (!class_exists('WPEInfo')) :
108
  }
109
 
110
  public function isDynSyncModuleEnabled() {
111
- return ($this->settings->getOption('bvdynplug') === $this->plugname) &&
112
- $this->isActivePlugin();
 
 
 
 
 
113
  }
114
 
115
  public function isServiceActive($service) {
10
  public $badgeinfo = 'wpebadge';
11
  public $ip_header_option = 'wpeipheader';
12
  public $brand_option = 'wpebrand';
13
+ public $version = '4.65';
14
  public $webpage = 'https://wpengine.com';
15
  public $appurl = 'https://wpengine.blogvault.net';
16
  public $slug = 'wp-site-migrate/wpengine.php';
108
  }
109
 
110
  public function isDynSyncModuleEnabled() {
111
+ if ($this->isServiceActive("dynsync")) {
112
+ $dynconfig = $this->config['dynsync'];
113
+ if (array_key_exists('dynplug', $dynconfig) && ($dynconfig['dynplug'] === $this->plugname)) {
114
+ return true;
115
+ }
116
+ }
117
+ return false;
118
  }
119
 
120
  public function isServiceActive($service) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: wpe, wpengine, migration
4
  Requires at least: 4.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.4.0
7
- Stable tag: 4.62
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -79,6 +79,10 @@ That's easy! [Signup here](http://wpengine.com/plans/).
79
  2. BlogVault dashboard showing live updates.
80
 
81
  == Changelog ==
 
 
 
 
82
  = 4.62 =
83
  * MultiTable Sync in single callback functionality added.
84
  * Improved host info
4
  Requires at least: 4.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.4.0
7
+ Stable tag: 4.65
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.65 =
83
+ * Robust handling of requests params.
84
+ * Callback wing versioning.
85
+
86
  = 4.62 =
87
  * MultiTable Sync in single callback functionality added.
88
  * Improved host info
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.62
9
  Network: True
10
  */
11
 
@@ -28,6 +28,7 @@ Network: True
28
  /* Global response array */
29
 
30
  if (!defined('ABSPATH')) exit;
 
31
 
32
  require_once dirname( __FILE__ ) . '/wp_settings.php';
33
  require_once dirname( __FILE__ ) . '/wp_site_info.php';
@@ -98,6 +99,7 @@ if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "
98
  ##BVBASEPATH##
99
 
100
  require_once dirname( __FILE__ ) . '/callback/handler.php';
 
101
  $params = $request->processParams($_REQUEST);
102
  if ($params === false) {
103
  $resp = array(
5
  Description: The easiest way to migrate your site to WP Engine
6
  Author: WPEngine
7
  Author URI: https://wpengine.com
8
+ Version: 4.65
9
  Network: True
10
  */
11
 
28
  /* Global response array */
29
 
30
  if (!defined('ABSPATH')) exit;
31
+ ##OLDWPR##
32
 
33
  require_once dirname( __FILE__ ) . '/wp_settings.php';
34
  require_once dirname( __FILE__ ) . '/wp_site_info.php';
99
  ##BVBASEPATH##
100
 
101
  require_once dirname( __FILE__ ) . '/callback/handler.php';
102
+
103
  $params = $request->processParams($_REQUEST);
104
  if ($params === false) {
105
  $resp = array(