All-in-One WP Migration - Version 5.51

Version Description

  • Add support for utf8mb4_unicode_520_ci database collation
Download this release

Release Info

Developer bangelov
Plugin Icon 128x128 All-in-One WP Migration
Version 5.51
Comparing to
See all releases

Code changes from version 5.50 to 5.51

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: 5.50
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: 5.51
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
constants.php CHANGED
@@ -38,7 +38,7 @@ if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
38
  // ==================
39
  // = Plugin Version =
40
  // ==================
41
- define( 'AI1WM_VERSION', '5.50' );
42
 
43
  // ===============
44
  // = Plugin Name =
38
  // ==================
39
  // = Plugin Version =
40
  // ==================
41
+ define( 'AI1WM_VERSION', '5.51' );
42
 
43
  // ===============
44
  // = Plugin Name =
lib/vendor/servmask/database/class-ai1wm-database.php CHANGED
@@ -522,9 +522,6 @@ abstract class Ai1wm_Database {
522
  */
523
  public function import( $file_name ) {
524
 
525
- // Set collation name
526
- $collation = $this->get_collation( 'utf8mb4_general_ci' );
527
-
528
  // Set max allowed packet
529
  $max_allowed_packet = $this->get_max_allowed_packet();
530
 
@@ -554,10 +551,8 @@ abstract class Ai1wm_Database {
554
  // Replace table values
555
  $query = $this->replace_table_values( $query, true );
556
 
557
- // Replace table collation
558
- if ( empty( $collation ) ) {
559
- $query = $this->replace_table_collation( $query );
560
- }
561
 
562
  try {
563
 
@@ -781,13 +776,29 @@ abstract class Ai1wm_Database {
781
  }
782
 
783
  /**
784
- * Replace table collation
785
  *
786
  * @param string $input SQL statement
787
  * @return string
788
  */
789
- protected function replace_table_collation($input) {
790
- return str_ireplace( 'utf8mb4', 'utf8', $input );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
791
  }
792
 
793
  /**
@@ -796,7 +807,7 @@ abstract class Ai1wm_Database {
796
  * @param string $input SQL statement
797
  * @return string
798
  */
799
- protected function strip_table_constraints($input) {
800
  $pattern = array(
801
  '/\s+CONSTRAINT(.+)REFERENCES(.+),/i',
802
  '/,\s+CONSTRAINT(.+)REFERENCES(.+)/i',
522
  */
523
  public function import( $file_name ) {
524
 
 
 
 
525
  // Set max allowed packet
526
  $max_allowed_packet = $this->get_max_allowed_packet();
527
 
551
  // Replace table values
552
  $query = $this->replace_table_values( $query, true );
553
 
554
+ // Replace table collations
555
+ $query = $this->replace_table_collations( $query );
 
 
556
 
557
  try {
558
 
776
  }
777
 
778
  /**
779
+ * Replace table collations
780
  *
781
  * @param string $input SQL statement
782
  * @return string
783
  */
784
+ protected function replace_table_collations( $input ) {
785
+ static $search = array();
786
+ static $replace = array();
787
+
788
+ // Replace table collations
789
+ if ( empty( $search ) || empty( $replace ) ) {
790
+ if ( ! $this->wpdb->has_cap( 'utf8mb4_520' ) ) {
791
+ if ( ! $this->wpdb->has_cap( 'utf8mb4' ) ) {
792
+ $search = array( 'utf8mb4_unicode_520_ci', 'utf8mb4' );
793
+ $replace = array( 'utf8_unicode_ci', 'utf8' );
794
+ } else {
795
+ $search = array( 'utf8mb4_unicode_520_ci' );
796
+ $replace = array( 'utf8mb4_unicode_ci' );
797
+ }
798
+ }
799
+ }
800
+
801
+ return str_ireplace( $search, $replace, $input );
802
  }
803
 
804
  /**
807
  * @param string $input SQL statement
808
  * @return string
809
  */
810
+ protected function strip_table_constraints( $input ) {
811
  $pattern = array(
812
  '/\s+CONSTRAINT(.+)REFERENCES(.+),/i',
813
  '/,\s+CONSTRAINT(.+)REFERENCES(.+)/i',
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: yani.iliev, bangelov, pimjitsawang
3
  Tags: db migration, migration, wordpress migration, db backup, db restore, website backup, website restore, website migration, website deploy, wordpress deploy, db backup, database export, database serialization, database find replace
4
  Requires at least: 3.3
5
  Tested up to: 4.6
6
- Stable tag: 5.50
7
  License: GPLv2 or later
8
 
9
  All-in-One WP Migration is the only tool that you will ever need to migrate a WordPress site.
@@ -78,6 +78,9 @@ All in One WP Plugin is the first plugin to offer true mobile experience on Word
78
  3. Plugin Menu
79
 
80
  == Changelog ==
 
 
 
81
  = 5.50 =
82
  * Improve database export process
83
  * Simplify export and import cron
3
  Tags: db migration, migration, wordpress migration, db backup, db restore, website backup, website restore, website migration, website deploy, wordpress deploy, db backup, database export, database serialization, database find replace
4
  Requires at least: 3.3
5
  Tested up to: 4.6
6
+ Stable tag: 5.51
7
  License: GPLv2 or later
8
 
9
  All-in-One WP Migration is the only tool that you will ever need to migrate a WordPress site.
78
  3. Plugin Menu
79
 
80
  == Changelog ==
81
+ = 5.51 =
82
+ * Add support for utf8mb4_unicode_520_ci database collation
83
+
84
  = 5.50 =
85
  * Improve database export process
86
  * Simplify export and import cron