Version Description
Changed
- Improved URL replacement
- Improved compatibility with some of GoDaddy hosting plans
Download this release
Release Info
| Developer | bangelov |
| Plugin | |
| Version | 6.90 |
| Comparing to | |
| See all releases | |
Code changes from version 6.89 to 6.90
all-in-one-wp-migration.php
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
|
| 6 |
* Author: ServMask
|
| 7 |
* Author URI: https://servmask.com/
|
| 8 |
-
* Version: 6.
|
| 9 |
* Text Domain: all-in-one-wp-migration
|
| 10 |
* Domain Path: /languages
|
| 11 |
* Network: True
|
| 5 |
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
|
| 6 |
* Author: ServMask
|
| 7 |
* Author URI: https://servmask.com/
|
| 8 |
+
* Version: 6.90
|
| 9 |
* Text Domain: all-in-one-wp-migration
|
| 10 |
* Domain Path: /languages
|
| 11 |
* Network: True
|
constants.php
CHANGED
|
@@ -35,7 +35,7 @@ define( 'AI1WM_DEBUG', false );
|
|
| 35 |
// ==================
|
| 36 |
// = Plugin Version =
|
| 37 |
// ==================
|
| 38 |
-
define( 'AI1WM_VERSION', '6.
|
| 39 |
|
| 40 |
// ===============
|
| 41 |
// = Plugin Name =
|
|
@@ -117,6 +117,11 @@ define( 'AI1WM_REPORT_URL', 'https://servmask.com/ai1wm/report/create' );
|
|
| 117 |
// ==============================
|
| 118 |
define( 'AI1WM_ARCHIVE_TOOLS_URL', 'https://servmask.com/archive/tools' );
|
| 119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
// =========================
|
| 121 |
// = ServMask Table Prefix =
|
| 122 |
// =========================
|
| 35 |
// ==================
|
| 36 |
// = Plugin Version =
|
| 37 |
// ==================
|
| 38 |
+
define( 'AI1WM_VERSION', '6.90' );
|
| 39 |
|
| 40 |
// ===============
|
| 41 |
// = Plugin Name =
|
| 117 |
// ==============================
|
| 118 |
define( 'AI1WM_ARCHIVE_TOOLS_URL', 'https://servmask.com/archive/tools' );
|
| 119 |
|
| 120 |
+
// ===========================
|
| 121 |
+
// = ServMask Activation URL =
|
| 122 |
+
// ===========================
|
| 123 |
+
define( 'AI1WM_ACTIVATION_URL', 'https://servmask.com/purchase/activations' );
|
| 124 |
+
|
| 125 |
// =========================
|
| 126 |
// = ServMask Table Prefix =
|
| 127 |
// =========================
|
lib/controller/class-ai1wm-export-controller.php
CHANGED
|
@@ -104,7 +104,9 @@ class Ai1wm_Export_Controller {
|
|
| 104 |
// Do request
|
| 105 |
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
| 106 |
if ( defined( 'WP_CLI' ) ) {
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
if ( isset( $params['ai1wm_manual_export'] ) ) {
|
| 104 |
// Do request
|
| 105 |
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
| 106 |
if ( defined( 'WP_CLI' ) ) {
|
| 107 |
+
if ( ! defined( 'DOING_CRON' ) ) {
|
| 108 |
+
continue;
|
| 109 |
+
}
|
| 110 |
}
|
| 111 |
|
| 112 |
if ( isset( $params['ai1wm_manual_export'] ) ) {
|
lib/controller/class-ai1wm-import-controller.php
CHANGED
|
@@ -112,7 +112,9 @@ class Ai1wm_Import_Controller {
|
|
| 112 |
// Do request
|
| 113 |
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
| 114 |
if ( defined( 'WP_CLI' ) ) {
|
| 115 |
-
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
|
| 118 |
if ( isset( $params['ai1wm_manual_import'] ) || isset( $params['ai1wm_manual_restore'] ) ) {
|
| 112 |
// Do request
|
| 113 |
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
| 114 |
if ( defined( 'WP_CLI' ) ) {
|
| 115 |
+
if ( ! defined( 'DOING_CRON' ) ) {
|
| 116 |
+
continue;
|
| 117 |
+
}
|
| 118 |
}
|
| 119 |
|
| 120 |
if ( isset( $params['ai1wm_manual_import'] ) || isset( $params['ai1wm_manual_restore'] ) ) {
|
lib/model/import/class-ai1wm-import-database.php
CHANGED
|
@@ -237,214 +237,6 @@ class Ai1wm_Import_Database {
|
|
| 237 |
// Get Site URL
|
| 238 |
foreach ( $site_urls as $site_url ) {
|
| 239 |
|
| 240 |
-
// Replace Site URL
|
| 241 |
-
if ( $site_url !== $blog['New']['SiteURL'] ) {
|
| 242 |
-
|
| 243 |
-
// Get www URL
|
| 244 |
-
if ( stripos( $site_url, '//www.' ) !== false ) {
|
| 245 |
-
$site_url_www_inversion = str_ireplace( '//www.', '//', $site_url );
|
| 246 |
-
} else {
|
| 247 |
-
$site_url_www_inversion = str_ireplace( '//', '//www.', $site_url );
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
// Replace Site URL
|
| 251 |
-
foreach ( array( $site_url, $site_url_www_inversion ) as $url ) {
|
| 252 |
-
|
| 253 |
-
// Get domain
|
| 254 |
-
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 255 |
-
$new_domain = parse_url( $blog['New']['SiteURL'], PHP_URL_HOST );
|
| 256 |
-
|
| 257 |
-
// Get path
|
| 258 |
-
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 259 |
-
$new_path = parse_url( $blog['New']['SiteURL'], PHP_URL_PATH );
|
| 260 |
-
|
| 261 |
-
// Get scheme
|
| 262 |
-
$new_scheme = parse_url( $blog['New']['SiteURL'], PHP_URL_SCHEME );
|
| 263 |
-
|
| 264 |
-
// Add domain and path
|
| 265 |
-
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
| 266 |
-
$old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
|
| 267 |
-
$new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
|
| 268 |
-
}
|
| 269 |
-
|
| 270 |
-
// Add domain and path with single quote
|
| 271 |
-
if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 272 |
-
$old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
|
| 273 |
-
$new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
|
| 274 |
-
}
|
| 275 |
-
|
| 276 |
-
// Add domain and path with double quote
|
| 277 |
-
if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 278 |
-
$old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
|
| 279 |
-
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 280 |
-
}
|
| 281 |
-
|
| 282 |
-
// Add Site URL scheme
|
| 283 |
-
$old_schemes = array( 'http', 'https', '' );
|
| 284 |
-
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 285 |
-
|
| 286 |
-
// Replace Site URL scheme
|
| 287 |
-
for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
|
| 288 |
-
|
| 289 |
-
// Add plain Site URL
|
| 290 |
-
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 291 |
-
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 292 |
-
$new_replace_values[] = ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] );
|
| 293 |
-
}
|
| 294 |
-
|
| 295 |
-
// Add URL encoded Site URL
|
| 296 |
-
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 297 |
-
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 298 |
-
$new_replace_values[] = urlencode( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ) );
|
| 299 |
-
}
|
| 300 |
-
|
| 301 |
-
// Add URL raw encoded Site URL
|
| 302 |
-
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 303 |
-
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 304 |
-
$new_replace_values[] = rawurlencode( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ) );
|
| 305 |
-
}
|
| 306 |
-
|
| 307 |
-
// Add JSON escaped Site URL
|
| 308 |
-
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 309 |
-
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 310 |
-
$new_replace_values[] = addcslashes( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ), '/' );
|
| 311 |
-
}
|
| 312 |
-
}
|
| 313 |
-
|
| 314 |
-
// Add email
|
| 315 |
-
if ( ! isset( $config['NoEmailReplace'] ) ) {
|
| 316 |
-
if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) {
|
| 317 |
-
$old_replace_values[] = sprintf( '@%s', $old_domain );
|
| 318 |
-
$new_replace_values[] = sprintf( '@%s', $new_domain );
|
| 319 |
-
}
|
| 320 |
-
}
|
| 321 |
-
}
|
| 322 |
-
}
|
| 323 |
-
}
|
| 324 |
-
|
| 325 |
-
$home_urls = array();
|
| 326 |
-
|
| 327 |
-
// Add Home URL
|
| 328 |
-
if ( ! empty( $blog['Old']['HomeURL'] ) ) {
|
| 329 |
-
$home_urls[] = $blog['Old']['HomeURL'];
|
| 330 |
-
}
|
| 331 |
-
|
| 332 |
-
// Add Internal Home URL
|
| 333 |
-
if ( ! empty( $blog['Old']['InternalHomeURL'] ) ) {
|
| 334 |
-
if ( parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_SCHEME ) && parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_HOST ) ) {
|
| 335 |
-
$home_urls[] = $blog['Old']['InternalHomeURL'];
|
| 336 |
-
}
|
| 337 |
-
}
|
| 338 |
-
|
| 339 |
-
// Get Home URL
|
| 340 |
-
foreach ( $home_urls as $home_url ) {
|
| 341 |
-
|
| 342 |
-
// Replace Home URL
|
| 343 |
-
if ( $home_url !== $blog['New']['HomeURL'] ) {
|
| 344 |
-
|
| 345 |
-
// Get www URL
|
| 346 |
-
if ( stripos( $home_url, '//www.' ) !== false ) {
|
| 347 |
-
$home_url_www_inversion = str_ireplace( '//www.', '//', $home_url );
|
| 348 |
-
} else {
|
| 349 |
-
$home_url_www_inversion = str_ireplace( '//', '//www.', $home_url );
|
| 350 |
-
}
|
| 351 |
-
|
| 352 |
-
// Replace Home URL
|
| 353 |
-
foreach ( array( $home_url, $home_url_www_inversion ) as $url ) {
|
| 354 |
-
|
| 355 |
-
// Get domain
|
| 356 |
-
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 357 |
-
$new_domain = parse_url( $blog['New']['HomeURL'], PHP_URL_HOST );
|
| 358 |
-
|
| 359 |
-
// Get path
|
| 360 |
-
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 361 |
-
$new_path = parse_url( $blog['New']['HomeURL'], PHP_URL_PATH );
|
| 362 |
-
|
| 363 |
-
// Get scheme
|
| 364 |
-
$new_scheme = parse_url( $blog['New']['HomeURL'], PHP_URL_SCHEME );
|
| 365 |
-
|
| 366 |
-
// Add domain and path
|
| 367 |
-
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
| 368 |
-
$old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
|
| 369 |
-
$new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
|
| 370 |
-
}
|
| 371 |
-
|
| 372 |
-
// Add domain and path with single quote
|
| 373 |
-
if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 374 |
-
$old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
|
| 375 |
-
$new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
|
| 376 |
-
}
|
| 377 |
-
|
| 378 |
-
// Add domain and path with double quote
|
| 379 |
-
if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 380 |
-
$old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
|
| 381 |
-
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 382 |
-
}
|
| 383 |
-
|
| 384 |
-
// Set Home URL scheme
|
| 385 |
-
$old_schemes = array( 'http', 'https', '' );
|
| 386 |
-
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 387 |
-
|
| 388 |
-
// Replace Home URL scheme
|
| 389 |
-
for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
|
| 390 |
-
|
| 391 |
-
// Add plain Home URL
|
| 392 |
-
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 393 |
-
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 394 |
-
$new_replace_values[] = ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] );
|
| 395 |
-
}
|
| 396 |
-
|
| 397 |
-
// Add URL encoded Home URL
|
| 398 |
-
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 399 |
-
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 400 |
-
$new_replace_values[] = urlencode( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ) );
|
| 401 |
-
}
|
| 402 |
-
|
| 403 |
-
// Add URL raw encoded Home URL
|
| 404 |
-
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 405 |
-
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 406 |
-
$new_replace_values[] = rawurlencode( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ) );
|
| 407 |
-
}
|
| 408 |
-
|
| 409 |
-
// Add JSON escaped Home URL
|
| 410 |
-
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 411 |
-
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 412 |
-
$new_replace_values[] = addcslashes( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ), '/' );
|
| 413 |
-
}
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
// Add email
|
| 417 |
-
if ( ! isset( $config['NoEmailReplace'] ) ) {
|
| 418 |
-
if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) {
|
| 419 |
-
$old_replace_values[] = sprintf( '@%s', $old_domain );
|
| 420 |
-
$new_replace_values[] = sprintf( '@%s', $new_domain );
|
| 421 |
-
}
|
| 422 |
-
}
|
| 423 |
-
}
|
| 424 |
-
}
|
| 425 |
-
}
|
| 426 |
-
}
|
| 427 |
-
|
| 428 |
-
$site_urls = array();
|
| 429 |
-
|
| 430 |
-
// Add Site URL
|
| 431 |
-
if ( ! empty( $config['SiteURL'] ) ) {
|
| 432 |
-
$site_urls[] = $config['SiteURL'];
|
| 433 |
-
}
|
| 434 |
-
|
| 435 |
-
// Add Internal Site URL
|
| 436 |
-
if ( ! empty( $config['InternalSiteURL'] ) ) {
|
| 437 |
-
if ( parse_url( $config['InternalSiteURL'], PHP_URL_SCHEME ) && parse_url( $config['InternalSiteURL'], PHP_URL_HOST ) ) {
|
| 438 |
-
$site_urls[] = $config['InternalSiteURL'];
|
| 439 |
-
}
|
| 440 |
-
}
|
| 441 |
-
|
| 442 |
-
// Get Site URL
|
| 443 |
-
foreach ( $site_urls as $site_url ) {
|
| 444 |
-
|
| 445 |
-
// Replace Site URL
|
| 446 |
-
if ( $site_url !== site_url() ) {
|
| 447 |
-
|
| 448 |
// Get www URL
|
| 449 |
if ( stripos( $site_url, '//www.' ) !== false ) {
|
| 450 |
$site_url_www_inversion = str_ireplace( '//www.', '//', $site_url );
|
|
@@ -457,14 +249,14 @@ class Ai1wm_Import_Database {
|
|
| 457 |
|
| 458 |
// Get domain
|
| 459 |
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 460 |
-
$new_domain = parse_url(
|
| 461 |
|
| 462 |
// Get path
|
| 463 |
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 464 |
-
$new_path = parse_url(
|
| 465 |
|
| 466 |
// Get scheme
|
| 467 |
-
$new_scheme = parse_url(
|
| 468 |
|
| 469 |
// Add domain and path
|
| 470 |
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
|
@@ -484,7 +276,7 @@ class Ai1wm_Import_Database {
|
|
| 484 |
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 485 |
}
|
| 486 |
|
| 487 |
-
//
|
| 488 |
$old_schemes = array( 'http', 'https', '' );
|
| 489 |
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 490 |
|
|
@@ -494,25 +286,25 @@ class Ai1wm_Import_Database {
|
|
| 494 |
// Add plain Site URL
|
| 495 |
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 496 |
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 497 |
-
$new_replace_values[] = ai1wm_url_scheme(
|
| 498 |
}
|
| 499 |
|
| 500 |
// Add URL encoded Site URL
|
| 501 |
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 502 |
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 503 |
-
$new_replace_values[] = urlencode( ai1wm_url_scheme(
|
| 504 |
}
|
| 505 |
|
| 506 |
// Add URL raw encoded Site URL
|
| 507 |
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 508 |
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 509 |
-
$new_replace_values[] = rawurlencode( ai1wm_url_scheme(
|
| 510 |
}
|
| 511 |
|
| 512 |
// Add JSON escaped Site URL
|
| 513 |
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 514 |
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 515 |
-
$new_replace_values[] = addcslashes( ai1wm_url_scheme(
|
| 516 |
}
|
| 517 |
}
|
| 518 |
|
|
@@ -525,27 +317,23 @@ class Ai1wm_Import_Database {
|
|
| 525 |
}
|
| 526 |
}
|
| 527 |
}
|
| 528 |
-
}
|
| 529 |
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
// Add Home URL
|
| 533 |
-
if ( ! empty( $config['HomeURL'] ) ) {
|
| 534 |
-
$home_urls[] = $config['HomeURL'];
|
| 535 |
-
}
|
| 536 |
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
$home_urls[] = $config['InternalHomeURL'];
|
| 541 |
}
|
| 542 |
-
}
|
| 543 |
|
| 544 |
-
|
| 545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
|
| 547 |
-
//
|
| 548 |
-
|
| 549 |
|
| 550 |
// Get www URL
|
| 551 |
if ( stripos( $home_url, '//www.' ) !== false ) {
|
|
@@ -559,14 +347,14 @@ class Ai1wm_Import_Database {
|
|
| 559 |
|
| 560 |
// Get domain
|
| 561 |
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 562 |
-
$new_domain = parse_url(
|
| 563 |
|
| 564 |
// Get path
|
| 565 |
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 566 |
-
$new_path = parse_url(
|
| 567 |
|
| 568 |
// Get scheme
|
| 569 |
-
$new_scheme = parse_url(
|
| 570 |
|
| 571 |
// Add domain and path
|
| 572 |
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
|
@@ -586,7 +374,7 @@ class Ai1wm_Import_Database {
|
|
| 586 |
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 587 |
}
|
| 588 |
|
| 589 |
-
//
|
| 590 |
$old_schemes = array( 'http', 'https', '' );
|
| 591 |
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 592 |
|
|
@@ -596,25 +384,25 @@ class Ai1wm_Import_Database {
|
|
| 596 |
// Add plain Home URL
|
| 597 |
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 598 |
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 599 |
-
$new_replace_values[] = ai1wm_url_scheme(
|
| 600 |
}
|
| 601 |
|
| 602 |
// Add URL encoded Home URL
|
| 603 |
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 604 |
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 605 |
-
$new_replace_values[] = urlencode( ai1wm_url_scheme(
|
| 606 |
}
|
| 607 |
|
| 608 |
// Add URL raw encoded Home URL
|
| 609 |
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 610 |
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 611 |
-
$new_replace_values[] = rawurlencode( ai1wm_url_scheme(
|
| 612 |
}
|
| 613 |
|
| 614 |
// Add JSON escaped Home URL
|
| 615 |
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 616 |
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 617 |
-
$new_replace_values[] = addcslashes( ai1wm_url_scheme(
|
| 618 |
}
|
| 619 |
}
|
| 620 |
|
|
@@ -629,38 +417,230 @@ class Ai1wm_Import_Database {
|
|
| 629 |
}
|
| 630 |
}
|
| 631 |
|
| 632 |
-
|
| 633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
|
| 635 |
-
|
| 636 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
|
| 638 |
-
//
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 642 |
}
|
| 643 |
|
| 644 |
-
// Add
|
| 645 |
-
if ( ! in_array(
|
| 646 |
-
$old_replace_values[] =
|
| 647 |
-
$new_replace_values[] =
|
| 648 |
}
|
| 649 |
|
| 650 |
-
// Add
|
| 651 |
-
if ( ! in_array(
|
| 652 |
-
$old_replace_values[] =
|
| 653 |
-
$new_replace_values[] =
|
| 654 |
}
|
| 655 |
|
| 656 |
-
//
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 660 |
}
|
| 661 |
}
|
| 662 |
}
|
| 663 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 664 |
// Get replace old and new values
|
| 665 |
if ( isset( $config['Replace'] ) && ( $replace = $config['Replace'] ) ) {
|
| 666 |
for ( $i = 0; $i < count( $replace['OldValues'] ); $i++ ) {
|
|
@@ -708,6 +688,9 @@ class Ai1wm_Import_Database {
|
|
| 708 |
// Get HTTP password
|
| 709 |
$auth_password = get_option( AI1WM_AUTH_PASSWORD );
|
| 710 |
|
|
|
|
|
|
|
|
|
|
| 711 |
// Get backups labels
|
| 712 |
$backups_labels = get_option( AI1WM_BACKUPS_LABELS, array() );
|
| 713 |
|
|
@@ -838,6 +821,9 @@ class Ai1wm_Import_Database {
|
|
| 838 |
// Set the new HTTP password
|
| 839 |
update_option( AI1WM_AUTH_PASSWORD, $auth_password );
|
| 840 |
|
|
|
|
|
|
|
|
|
|
| 841 |
// Set the new backups labels
|
| 842 |
update_option( AI1WM_BACKUPS_LABELS, $backups_labels );
|
| 843 |
|
| 237 |
// Get Site URL
|
| 238 |
foreach ( $site_urls as $site_url ) {
|
| 239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
// Get www URL
|
| 241 |
if ( stripos( $site_url, '//www.' ) !== false ) {
|
| 242 |
$site_url_www_inversion = str_ireplace( '//www.', '//', $site_url );
|
| 249 |
|
| 250 |
// Get domain
|
| 251 |
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 252 |
+
$new_domain = parse_url( $blog['New']['SiteURL'], PHP_URL_HOST );
|
| 253 |
|
| 254 |
// Get path
|
| 255 |
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 256 |
+
$new_path = parse_url( $blog['New']['SiteURL'], PHP_URL_PATH );
|
| 257 |
|
| 258 |
// Get scheme
|
| 259 |
+
$new_scheme = parse_url( $blog['New']['SiteURL'], PHP_URL_SCHEME );
|
| 260 |
|
| 261 |
// Add domain and path
|
| 262 |
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
| 276 |
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 277 |
}
|
| 278 |
|
| 279 |
+
// Add Site URL scheme
|
| 280 |
$old_schemes = array( 'http', 'https', '' );
|
| 281 |
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 282 |
|
| 286 |
// Add plain Site URL
|
| 287 |
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 288 |
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 289 |
+
$new_replace_values[] = ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] );
|
| 290 |
}
|
| 291 |
|
| 292 |
// Add URL encoded Site URL
|
| 293 |
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 294 |
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 295 |
+
$new_replace_values[] = urlencode( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ) );
|
| 296 |
}
|
| 297 |
|
| 298 |
// Add URL raw encoded Site URL
|
| 299 |
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 300 |
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 301 |
+
$new_replace_values[] = rawurlencode( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ) );
|
| 302 |
}
|
| 303 |
|
| 304 |
// Add JSON escaped Site URL
|
| 305 |
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 306 |
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 307 |
+
$new_replace_values[] = addcslashes( ai1wm_url_scheme( $blog['New']['SiteURL'], $new_schemes[ $i ] ), '/' );
|
| 308 |
}
|
| 309 |
}
|
| 310 |
|
| 317 |
}
|
| 318 |
}
|
| 319 |
}
|
|
|
|
| 320 |
|
| 321 |
+
$home_urls = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
|
| 323 |
+
// Add Home URL
|
| 324 |
+
if ( ! empty( $blog['Old']['HomeURL'] ) ) {
|
| 325 |
+
$home_urls[] = $blog['Old']['HomeURL'];
|
|
|
|
| 326 |
}
|
|
|
|
| 327 |
|
| 328 |
+
// Add Internal Home URL
|
| 329 |
+
if ( ! empty( $blog['Old']['InternalHomeURL'] ) ) {
|
| 330 |
+
if ( parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_SCHEME ) && parse_url( $blog['Old']['InternalHomeURL'], PHP_URL_HOST ) ) {
|
| 331 |
+
$home_urls[] = $blog['Old']['InternalHomeURL'];
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
|
| 335 |
+
// Get Home URL
|
| 336 |
+
foreach ( $home_urls as $home_url ) {
|
| 337 |
|
| 338 |
// Get www URL
|
| 339 |
if ( stripos( $home_url, '//www.' ) !== false ) {
|
| 347 |
|
| 348 |
// Get domain
|
| 349 |
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 350 |
+
$new_domain = parse_url( $blog['New']['HomeURL'], PHP_URL_HOST );
|
| 351 |
|
| 352 |
// Get path
|
| 353 |
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 354 |
+
$new_path = parse_url( $blog['New']['HomeURL'], PHP_URL_PATH );
|
| 355 |
|
| 356 |
// Get scheme
|
| 357 |
+
$new_scheme = parse_url( $blog['New']['HomeURL'], PHP_URL_SCHEME );
|
| 358 |
|
| 359 |
// Add domain and path
|
| 360 |
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
| 374 |
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 375 |
}
|
| 376 |
|
| 377 |
+
// Set Home URL scheme
|
| 378 |
$old_schemes = array( 'http', 'https', '' );
|
| 379 |
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 380 |
|
| 384 |
// Add plain Home URL
|
| 385 |
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 386 |
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 387 |
+
$new_replace_values[] = ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] );
|
| 388 |
}
|
| 389 |
|
| 390 |
// Add URL encoded Home URL
|
| 391 |
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 392 |
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 393 |
+
$new_replace_values[] = urlencode( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ) );
|
| 394 |
}
|
| 395 |
|
| 396 |
// Add URL raw encoded Home URL
|
| 397 |
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 398 |
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 399 |
+
$new_replace_values[] = rawurlencode( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ) );
|
| 400 |
}
|
| 401 |
|
| 402 |
// Add JSON escaped Home URL
|
| 403 |
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 404 |
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 405 |
+
$new_replace_values[] = addcslashes( ai1wm_url_scheme( $blog['New']['HomeURL'], $new_schemes[ $i ] ), '/' );
|
| 406 |
}
|
| 407 |
}
|
| 408 |
|
| 417 |
}
|
| 418 |
}
|
| 419 |
|
| 420 |
+
$site_urls = array();
|
| 421 |
+
|
| 422 |
+
// Add Site URL
|
| 423 |
+
if ( ! empty( $config['SiteURL'] ) ) {
|
| 424 |
+
$site_urls[] = $config['SiteURL'];
|
| 425 |
+
}
|
| 426 |
|
| 427 |
+
// Add Internal Site URL
|
| 428 |
+
if ( ! empty( $config['InternalSiteURL'] ) ) {
|
| 429 |
+
if ( parse_url( $config['InternalSiteURL'], PHP_URL_SCHEME ) && parse_url( $config['InternalSiteURL'], PHP_URL_HOST ) ) {
|
| 430 |
+
$site_urls[] = $config['InternalSiteURL'];
|
| 431 |
+
}
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
// Get Site URL
|
| 435 |
+
foreach ( $site_urls as $site_url ) {
|
| 436 |
+
|
| 437 |
+
// Get www URL
|
| 438 |
+
if ( stripos( $site_url, '//www.' ) !== false ) {
|
| 439 |
+
$site_url_www_inversion = str_ireplace( '//www.', '//', $site_url );
|
| 440 |
+
} else {
|
| 441 |
+
$site_url_www_inversion = str_ireplace( '//', '//www.', $site_url );
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
// Replace Site URL
|
| 445 |
+
foreach ( array( $site_url, $site_url_www_inversion ) as $url ) {
|
| 446 |
|
| 447 |
+
// Get domain
|
| 448 |
+
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 449 |
+
$new_domain = parse_url( site_url(), PHP_URL_HOST );
|
| 450 |
+
|
| 451 |
+
// Get path
|
| 452 |
+
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 453 |
+
$new_path = parse_url( site_url(), PHP_URL_PATH );
|
| 454 |
+
|
| 455 |
+
// Get scheme
|
| 456 |
+
$new_scheme = parse_url( site_url(), PHP_URL_SCHEME );
|
| 457 |
+
|
| 458 |
+
// Add domain and path
|
| 459 |
+
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
| 460 |
+
$old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
|
| 461 |
+
$new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
|
| 462 |
}
|
| 463 |
|
| 464 |
+
// Add domain and path with single quote
|
| 465 |
+
if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 466 |
+
$old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
|
| 467 |
+
$new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
|
| 468 |
}
|
| 469 |
|
| 470 |
+
// Add domain and path with double quote
|
| 471 |
+
if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 472 |
+
$old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
|
| 473 |
+
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 474 |
}
|
| 475 |
|
| 476 |
+
// Set Site URL scheme
|
| 477 |
+
$old_schemes = array( 'http', 'https', '' );
|
| 478 |
+
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 479 |
+
|
| 480 |
+
// Replace Site URL scheme
|
| 481 |
+
for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
|
| 482 |
+
|
| 483 |
+
// Add plain Site URL
|
| 484 |
+
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 485 |
+
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 486 |
+
$new_replace_values[] = ai1wm_url_scheme( site_url(), $new_schemes[ $i ] );
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
// Add URL encoded Site URL
|
| 490 |
+
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 491 |
+
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 492 |
+
$new_replace_values[] = urlencode( ai1wm_url_scheme( site_url(), $new_schemes[ $i ] ) );
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
// Add URL raw encoded Site URL
|
| 496 |
+
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 497 |
+
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 498 |
+
$new_replace_values[] = rawurlencode( ai1wm_url_scheme( site_url(), $new_schemes[ $i ] ) );
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
// Add JSON escaped Site URL
|
| 502 |
+
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 503 |
+
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 504 |
+
$new_replace_values[] = addcslashes( ai1wm_url_scheme( site_url(), $new_schemes[ $i ] ), '/' );
|
| 505 |
+
}
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
// Add email
|
| 509 |
+
if ( ! isset( $config['NoEmailReplace'] ) ) {
|
| 510 |
+
if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) {
|
| 511 |
+
$old_replace_values[] = sprintf( '@%s', $old_domain );
|
| 512 |
+
$new_replace_values[] = sprintf( '@%s', $new_domain );
|
| 513 |
+
}
|
| 514 |
}
|
| 515 |
}
|
| 516 |
}
|
| 517 |
|
| 518 |
+
$home_urls = array();
|
| 519 |
+
|
| 520 |
+
// Add Home URL
|
| 521 |
+
if ( ! empty( $config['HomeURL'] ) ) {
|
| 522 |
+
$home_urls[] = $config['HomeURL'];
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
// Add Internal Home URL
|
| 526 |
+
if ( ! empty( $config['InternalHomeURL'] ) ) {
|
| 527 |
+
if ( parse_url( $config['InternalHomeURL'], PHP_URL_SCHEME ) && parse_url( $config['InternalHomeURL'], PHP_URL_HOST ) ) {
|
| 528 |
+
$home_urls[] = $config['InternalHomeURL'];
|
| 529 |
+
}
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
// Get Home URL
|
| 533 |
+
foreach ( $home_urls as $home_url ) {
|
| 534 |
+
|
| 535 |
+
// Get www URL
|
| 536 |
+
if ( stripos( $home_url, '//www.' ) !== false ) {
|
| 537 |
+
$home_url_www_inversion = str_ireplace( '//www.', '//', $home_url );
|
| 538 |
+
} else {
|
| 539 |
+
$home_url_www_inversion = str_ireplace( '//', '//www.', $home_url );
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
// Replace Home URL
|
| 543 |
+
foreach ( array( $home_url, $home_url_www_inversion ) as $url ) {
|
| 544 |
+
|
| 545 |
+
// Get domain
|
| 546 |
+
$old_domain = parse_url( $url, PHP_URL_HOST );
|
| 547 |
+
$new_domain = parse_url( home_url(), PHP_URL_HOST );
|
| 548 |
+
|
| 549 |
+
// Get path
|
| 550 |
+
$old_path = parse_url( $url, PHP_URL_PATH );
|
| 551 |
+
$new_path = parse_url( home_url(), PHP_URL_PATH );
|
| 552 |
+
|
| 553 |
+
// Get scheme
|
| 554 |
+
$new_scheme = parse_url( home_url(), PHP_URL_SCHEME );
|
| 555 |
+
|
| 556 |
+
// Add domain and path
|
| 557 |
+
if ( ! in_array( sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) ), $old_replace_raw_values ) ) {
|
| 558 |
+
$old_replace_raw_values[] = sprintf( "'%s','%s'", $old_domain, trailingslashit( $old_path ) );
|
| 559 |
+
$new_replace_raw_values[] = sprintf( "'%s','%s'", $new_domain, trailingslashit( $new_path ) );
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
// Add domain and path with single quote
|
| 563 |
+
if ( ! in_array( sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 564 |
+
$old_replace_values[] = sprintf( "='%s%s", $old_domain, untrailingslashit( $old_path ) );
|
| 565 |
+
$new_replace_values[] = sprintf( "='%s%s", $new_domain, untrailingslashit( $new_path ) );
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
// Add domain and path with double quote
|
| 569 |
+
if ( ! in_array( sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) ), $old_replace_values ) ) {
|
| 570 |
+
$old_replace_values[] = sprintf( '="%s%s', $old_domain, untrailingslashit( $old_path ) );
|
| 571 |
+
$new_replace_values[] = sprintf( '="%s%s', $new_domain, untrailingslashit( $new_path ) );
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
// Add Home URL scheme
|
| 575 |
+
$old_schemes = array( 'http', 'https', '' );
|
| 576 |
+
$new_schemes = array( $new_scheme, $new_scheme, '' );
|
| 577 |
+
|
| 578 |
+
// Replace Home URL scheme
|
| 579 |
+
for ( $i = 0; $i < count( $old_schemes ); $i++ ) {
|
| 580 |
+
|
| 581 |
+
// Add plain Home URL
|
| 582 |
+
if ( ! in_array( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), $old_replace_values ) ) {
|
| 583 |
+
$old_replace_values[] = ai1wm_url_scheme( $url, $old_schemes[ $i ] );
|
| 584 |
+
$new_replace_values[] = ai1wm_url_scheme( home_url(), $new_schemes[ $i ] );
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
// Add URL encoded Home URL
|
| 588 |
+
if ( ! in_array( urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 589 |
+
$old_replace_values[] = urlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 590 |
+
$new_replace_values[] = urlencode( ai1wm_url_scheme( home_url(), $new_schemes[ $i ] ) );
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
// Add URL raw encoded Home URL
|
| 594 |
+
if ( ! in_array( rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) ), $old_replace_values ) ) {
|
| 595 |
+
$old_replace_values[] = rawurlencode( ai1wm_url_scheme( $url, $old_schemes[ $i ] ) );
|
| 596 |
+
$new_replace_values[] = rawurlencode( ai1wm_url_scheme( home_url(), $new_schemes[ $i ] ) );
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
// Add JSON escaped Home URL
|
| 600 |
+
if ( ! in_array( addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' ), $old_replace_values ) ) {
|
| 601 |
+
$old_replace_values[] = addcslashes( ai1wm_url_scheme( $url, $old_schemes[ $i ] ), '/' );
|
| 602 |
+
$new_replace_values[] = addcslashes( ai1wm_url_scheme( home_url(), $new_schemes[ $i ] ), '/' );
|
| 603 |
+
}
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
// Add email
|
| 607 |
+
if ( ! isset( $config['NoEmailReplace'] ) ) {
|
| 608 |
+
if ( ! in_array( sprintf( '@%s', $old_domain ), $old_replace_values ) ) {
|
| 609 |
+
$old_replace_values[] = sprintf( '@%s', $old_domain );
|
| 610 |
+
$new_replace_values[] = sprintf( '@%s', $new_domain );
|
| 611 |
+
}
|
| 612 |
+
}
|
| 613 |
+
}
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
// Get WordPress Content Dir
|
| 617 |
+
if ( isset( $config['WordPress']['Content'] ) && ( $content_dir = $config['WordPress']['Content'] ) ) {
|
| 618 |
+
|
| 619 |
+
// Add plain WordPress Content
|
| 620 |
+
if ( ! in_array( $content_dir, $old_replace_values ) ) {
|
| 621 |
+
$old_replace_values[] = $content_dir;
|
| 622 |
+
$new_replace_values[] = WP_CONTENT_DIR;
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
// Add URL encoded WordPress Content
|
| 626 |
+
if ( ! in_array( urlencode( $content_dir ), $old_replace_values ) ) {
|
| 627 |
+
$old_replace_values[] = urlencode( $content_dir );
|
| 628 |
+
$new_replace_values[] = urlencode( WP_CONTENT_DIR );
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
// Add URL raw encoded WordPress Content
|
| 632 |
+
if ( ! in_array( rawurlencode( $content_dir ), $old_replace_values ) ) {
|
| 633 |
+
$old_replace_values[] = rawurlencode( $content_dir );
|
| 634 |
+
$new_replace_values[] = rawurlencode( WP_CONTENT_DIR );
|
| 635 |
+
}
|
| 636 |
+
|
| 637 |
+
// Add JSON escaped WordPress Content
|
| 638 |
+
if ( ! in_array( addcslashes( $content_dir, '/' ), $old_replace_values ) ) {
|
| 639 |
+
$old_replace_values[] = addcslashes( $content_dir, '/' );
|
| 640 |
+
$new_replace_values[] = addcslashes( WP_CONTENT_DIR, '/' );
|
| 641 |
+
}
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
// Get replace old and new values
|
| 645 |
if ( isset( $config['Replace'] ) && ( $replace = $config['Replace'] ) ) {
|
| 646 |
for ( $i = 0; $i < count( $replace['OldValues'] ); $i++ ) {
|
| 688 |
// Get HTTP password
|
| 689 |
$auth_password = get_option( AI1WM_AUTH_PASSWORD );
|
| 690 |
|
| 691 |
+
// Get active plugins
|
| 692 |
+
$active_plugins = get_option( AI1WM_ACTIVE_PLUGINS, array() );
|
| 693 |
+
|
| 694 |
// Get backups labels
|
| 695 |
$backups_labels = get_option( AI1WM_BACKUPS_LABELS, array() );
|
| 696 |
|
| 821 |
// Set the new HTTP password
|
| 822 |
update_option( AI1WM_AUTH_PASSWORD, $auth_password );
|
| 823 |
|
| 824 |
+
// Set the new active plugins
|
| 825 |
+
update_option( AI1WM_ACTIVE_PLUGINS, $active_plugins );
|
| 826 |
+
|
| 827 |
// Set the new backups labels
|
| 828 |
update_option( AI1WM_BACKUPS_LABELS, $backups_labels );
|
| 829 |
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Tags: move, transfer, copy, migrate, backup, clone, restore, db migration, wordp
|
|
| 4 |
Requires at least: 3.3
|
| 5 |
Tested up to: 5.1
|
| 6 |
Requires PHP: 5.2.17
|
| 7 |
-
Stable tag: 6.
|
| 8 |
License: GPLv2 or later
|
| 9 |
|
| 10 |
Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
|
|
@@ -108,6 +108,12 @@ Alternatively you can download the plugin using the download button on this page
|
|
| 108 |
All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
|
| 109 |
|
| 110 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
= 6.89 =
|
| 112 |
**Changed**
|
| 113 |
|
| 4 |
Requires at least: 3.3
|
| 5 |
Tested up to: 5.1
|
| 6 |
Requires PHP: 5.2.17
|
| 7 |
+
Stable tag: 6.90
|
| 8 |
License: GPLv2 or later
|
| 9 |
|
| 10 |
Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
|
| 108 |
All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
|
| 109 |
|
| 110 |
== Changelog ==
|
| 111 |
+
= 6.90 =
|
| 112 |
+
**Changed**
|
| 113 |
+
|
| 114 |
+
* Improved URL replacement
|
| 115 |
+
* Improved compatibility with some of GoDaddy hosting plans
|
| 116 |
+
|
| 117 |
= 6.89 =
|
| 118 |
**Changed**
|
| 119 |
|
