All-in-One WP Migration - Version 6.55

Version Description

Added

  • Percentage indicator on "Unpacking archive" step
  • Chunking mechanism when adding database.sql to wpress file on export

Changed

  • Display 2GB+ value if file size cannot be obtained on Backups page
  • Move COMMIT condition after processing all table records

Fixed

  • Directory separator of archiver on Windows
Download this release

Release Info

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

Code changes from version 6.54 to 6.55

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.54
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.55
9
* Text Domain: all-in-one-wp-migration
10
* Domain Path: /languages
11
* Network: True
constants.php CHANGED
@@ -31,7 +31,7 @@ define( 'AI1WM_DEBUG', false );
31
// ==================
32
// = Plugin Version =
33
// ==================
34
- define( 'AI1WM_VERSION', '6.54' );
35
36
// ===============
37
// = Plugin Name =
31
// ==================
32
// = Plugin Version =
33
// ==================
34
+ define( 'AI1WM_VERSION', '6.55' );
35
36
// ===============
37
// = Plugin Name =
functions.php CHANGED
@@ -962,6 +962,32 @@ function ai1wm_find_smaller_number( Math_BigInteger $a, Math_BigInteger $b ) {
962
return $b;
963
}
964
965
/**
966
* Wrapper around fseek
967
*
962
return $b;
963
}
964
965
+ /**
966
+ * Check whether file size is supported by current PHP version
967
+ *
968
+ * @param string $file Path to file
969
+ * @param integer $php_int_size Size of PHP integer
970
+ * @return boolean $php_int_max Max value of PHP integer
971
+ */
972
+ function ai1wm_is_filesize_supported( $file, $php_int_size = PHP_INT_SIZE, $php_int_max = PHP_INT_MAX ) {
973
+ $size_result = true;
974
+
975
+ // Check whether file size is less than 2GB in PHP 32bits
976
+ if ( $php_int_size === 4 ) {
977
+ if ( ( $file_handle = @fopen( $file, 'r' ) ) ) {
978
+ if ( @fseek( $file_handle, $php_int_max, SEEK_SET ) !== -1 ) {
979
+ if ( @fgetc( $file_handle ) !== false ) {
980
+ $size_result = false;
981
+ }
982
+ }
983
+
984
+ @fclose( $file_handle );
985
+ }
986
+ }
987
+
988
+ return $size_result;
989
+ }
990
+
991
/**
992
* Wrapper around fseek
993
*
lib/controller/class-ai1wm-main-controller.php CHANGED
@@ -136,6 +136,7 @@ class Ai1wm_Main_Controller {
136
add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate::execute', 100 );
137
add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 );
138
add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 );
139
add_filter( 'ai1wm_export', 'Ai1wm_Export_Download::execute', 250 );
140
add_filter( 'ai1wm_export', 'Ai1wm_Export_Clean::execute', 300 );
141
@@ -410,7 +411,7 @@ class Ai1wm_Main_Controller {
410
* @return void
411
*/
412
public function register_export_scripts_and_styles( $hook ) {
413
- if ( 'toplevel_page_site-migration-export' !== strtolower( $hook ) ) {
414
return;
415
}
416
@@ -460,7 +461,7 @@ class Ai1wm_Main_Controller {
460
* @return void
461
*/
462
public function register_import_scripts_and_styles( $hook ) {
463
- if ( 'all-in-one-wp-migration_page_site-migration-import' !== strtolower( $hook ) ) {
464
return;
465
}
466
@@ -545,7 +546,7 @@ class Ai1wm_Main_Controller {
545
* @return void
546
*/
547
public function register_backups_scripts_and_styles( $hook ) {
548
- if ( 'all-in-one-wp-migration_page_site-migration-backups' !== strtolower( $hook ) ) {
549
return;
550
}
551
136
add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate::execute', 100 );
137
add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 );
138
add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 );
139
+ add_filter( 'ai1wm_export', 'Ai1wm_Export_Database_File::execute', 220 );
140
add_filter( 'ai1wm_export', 'Ai1wm_Export_Download::execute', 250 );
141
add_filter( 'ai1wm_export', 'Ai1wm_Export_Clean::execute', 300 );
142
411
* @return void
412
*/
413
public function register_export_scripts_and_styles( $hook ) {
414
+ if ( stripos( 'toplevel_page_site-migration-export', $hook ) === false ) {
415
return;
416
}
417
461
* @return void
462
*/
463
public function register_import_scripts_and_styles( $hook ) {
464
+ if ( stripos( 'all-in-one-wp-migration_page_site-migration-import', $hook ) === false ) {
465
return;
466
}
467
546
* @return void
547
*/
548
public function register_backups_scripts_and_styles( $hook ) {
549
+ if ( stripos( 'all-in-one-wp-migration_page_site-migration-backups', $hook ) === false ) {
550
return;
551
}
552
lib/model/class-ai1wm-backups.php CHANGED
@@ -41,16 +41,24 @@ class Ai1wm_Backups {
41
42
foreach ( $iterator as $item ) {
43
try {
44
- $backups[] = array(
45
- 'filename' => $item->getFilename(),
46
- 'mtime' => $item->getMTime(),
47
- 'size' => $item->getSize(),
48
- );
49
} catch ( Exception $e ) {
50
$backups[] = array(
51
'filename' => $item->getFilename(),
52
'mtime' => null,
53
- 'size' => ai1wm_filesize( $item->getPathname() ),
54
);
55
}
56
}
41
42
foreach ( $iterator as $item ) {
43
try {
44
+ if ( ai1wm_is_filesize_supported( $item->getPathname() ) ) {
45
+ $backups[] = array(
46
+ 'filename' => $item->getFilename(),
47
+ 'mtime' => $item->getMTime(),
48
+ 'size' => $item->getSize(),
49
+ );
50
+ } else {
51
+ $backups[] = array(
52
+ 'filename' => $item->getFilename(),
53
+ 'mtime' => $item->getMTime(),
54
+ 'size' => null,
55
+ );
56
+ }
57
} catch ( Exception $e ) {
58
$backups[] = array(
59
'filename' => $item->getFilename(),
60
'mtime' => null,
61
+ 'size' => null,
62
);
63
}
64
}
lib/model/class-ai1wm-extensions.php CHANGED
@@ -76,7 +76,7 @@ class Ai1wm_Extensions {
76
'about' => AI1WMME_PLUGIN_ABOUT,
77
'basename' => AI1WMME_PLUGIN_BASENAME,
78
'version' => AI1WMME_VERSION,
79
- 'requires' => '3.35',
80
'short' => AI1WMME_PLUGIN_SHORT,
81
);
82
}
76
'about' => AI1WMME_PLUGIN_ABOUT,
77
'basename' => AI1WMME_PLUGIN_BASENAME,
78
'version' => AI1WMME_VERSION,
79
+ 'requires' => '3.36',
80
'short' => AI1WMME_PLUGIN_SHORT,
81
);
82
}
lib/model/export/class-ai1wm-export-database-file.php ADDED
@@ -0,0 +1,101 @@
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2014-2017 ServMask Inc.
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
19
+ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
20
+ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
21
+ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
22
+ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
23
+ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
24
+ */
25
+
26
+ class Ai1wm_Export_Database_File {
27
+
28
+ public static function execute( $params ) {
29
+
30
+ // Set exclude database
31
+ if ( isset( $params['options']['no_database'] ) ) {
32
+ return $params;
33
+ }
34
+
35
+ $database_bytes_written = 0;
36
+
37
+ // Set database bytes offset
38
+ if ( isset( $params['database_bytes_offset'] ) ) {
39
+ $database_bytes_offset = (int) $params['database_bytes_offset'];
40
+ } else {
41
+ $database_bytes_offset = 0;
42
+ }
43
+
44
+ // Get total database size
45
+ if ( isset( $params['total_database_size'] ) ) {
46
+ $total_database_size = (int) $params['total_database_size'];
47
+ } else {
48
+ $total_database_size = 1;
49
+ }
50
+
51
+ // What percent of database have we processed?
52
+ $progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 );
53
+
54
+ // Set progress
55
+ Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
56
+
57
+ // Get archive
58
+ $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
59
+
60
+ // Add file to archive
61
+ if ( $archive->add_file( ai1wm_database_path( $params ), AI1WM_DATABASE_NAME, $database_bytes_written, $database_bytes_offset, 10 ) ) {
62
+
63
+ // Set progress
64
+ Ai1wm_Status::info( __( 'Done archiving database.', AI1WM_PLUGIN_NAME ) );
65
+
66
+ // Unset database bytes offset
67
+ unset( $params['database_bytes_offset'] );
68
+
69
+ // Unset total database size
70
+ unset( $params['total_database_size'] );
71
+
72
+ // Unset completed flag
73
+ unset( $params['completed'] );
74
+
75
+ } else {
76
+
77
+ // Get total database size
78
+ $total_database_size = ai1wm_database_bytes( $params );
79
+
80
+ // What percent of database have we processed?
81
+ $progress = (int) min( ( $database_bytes_offset / $total_database_size ) * 100, 100 );
82
+
83
+ // Set progress
84
+ Ai1wm_Status::info( sprintf( __( 'Archiving database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
85
+
86
+ // Set database bytes offset
87
+ $params['database_bytes_offset'] = $database_bytes_offset;
88
+
89
+ // Set total database size
90
+ $params['total_database_size'] = $total_database_size;
91
+
92
+ // Set completed flag
93
+ $params['completed'] = false;
94
+ }
95
+
96
+ // Close the archive file
97
+ $archive->close();
98
+
99
+ return $params;
100
+ }
101
+ }
lib/model/export/class-ai1wm-export-database.php CHANGED
@@ -127,15 +127,8 @@ class Ai1wm_Export_Database {
127
// Export database
128
if ( $mysql->export( ai1wm_database_path( $params ), $table_index, $table_offset, 10 ) ) {
129
130
- // Get archive file
131
- $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
132
-
133
- // Add database to archive
134
- $archive->add_file( ai1wm_database_path( $params ), AI1WM_DATABASE_NAME );
135
- $archive->close();
136
-
137
// Set progress
138
- Ai1wm_Status::info( __( 'Done exporting database...', AI1WM_PLUGIN_NAME ) );
139
140
// Unset table index
141
unset( $params['table_index'] );
127
// Export database
128
if ( $mysql->export( ai1wm_database_path( $params ), $table_index, $table_offset, 10 ) ) {
129
130
// Set progress
131
+ Ai1wm_Status::info( __( 'Done exporting database.', AI1WM_PLUGIN_NAME ) );
132
133
// Unset table index
134
unset( $params['table_index'] );
lib/model/export/class-ai1wm-export-resolve.php CHANGED
@@ -34,7 +34,7 @@ class Ai1wm_Export_Resolve {
34
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
35
36
// Set progress
37
- Ai1wm_Status::info( __( 'Done resolving URL address...', AI1WM_PLUGIN_NAME ) );
38
39
return $params;
40
}
34
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
35
36
// Set progress
37
+ Ai1wm_Status::info( __( 'Done resolving URL address.', AI1WM_PLUGIN_NAME ) );
38
39
return $params;
40
}
lib/model/import/class-ai1wm-import-blogs.php CHANGED
@@ -121,7 +121,7 @@ class Ai1wm_Import_Blogs {
121
ai1wm_close( $handle );
122
123
// Set progress
124
- Ai1wm_Status::info( __( 'Done preparing blogs...', AI1WM_PLUGIN_NAME ) );
125
126
return $params;
127
}
121
ai1wm_close( $handle );
122
123
// Set progress
124
+ Ai1wm_Status::info( __( 'Done preparing blogs.', AI1WM_PLUGIN_NAME ) );
125
126
return $params;
127
}
lib/model/import/class-ai1wm-import-database.php CHANGED
@@ -619,7 +619,7 @@ class Ai1wm_Import_Database {
619
if ( $mysql->import( ai1wm_database_path( $params ), $query_offset, 10 ) ) {
620
621
// Set progress
622
- Ai1wm_Status::info( __( 'Done restoring database...', AI1WM_PLUGIN_NAME ) );
623
624
// Unset query offset
625
unset( $params['query_offset'] );
619
if ( $mysql->import( ai1wm_database_path( $params ), $query_offset, 10 ) ) {
620
621
// Set progress
622
+ Ai1wm_Status::info( __( 'Done restoring database.', AI1WM_PLUGIN_NAME ) );
623
624
// Unset query offset
625
unset( $params['query_offset'] );
lib/model/import/class-ai1wm-import-mu-plugins.php CHANGED
@@ -40,7 +40,7 @@ class Ai1wm_Import_Mu_Plugins {
40
$archive->close();
41
42
// Set progress
43
- Ai1wm_Status::info( __( 'Done activating mu-plugins...', AI1WM_PLUGIN_NAME ) );
44
45
return $params;
46
}
40
$archive->close();
41
42
// Set progress
43
+ Ai1wm_Status::info( __( 'Done activating mu-plugins.', AI1WM_PLUGIN_NAME ) );
44
45
return $params;
46
}
lib/model/import/class-ai1wm-import-resolve.php CHANGED
@@ -34,7 +34,7 @@ class Ai1wm_Import_Resolve {
34
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
35
36
// Set progress
37
- Ai1wm_Status::info( __( 'Done resolving URL address...', AI1WM_PLUGIN_NAME ) );
38
39
return $params;
40
}
34
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
35
36
// Set progress
37
+ Ai1wm_Status::info( __( 'Done resolving URL address.', AI1WM_PLUGIN_NAME ) );
38
39
return $params;
40
}
lib/model/import/class-ai1wm-import-validate.php CHANGED
@@ -27,6 +27,17 @@ class Ai1wm_Import_Validate {
27
28
public static function execute( $params ) {
29
30
// Set file bytes offset
31
if ( isset( $params['file_bytes_offset'] ) ) {
32
$file_bytes_offset = (int) $params['file_bytes_offset'];
@@ -41,8 +52,14 @@ class Ai1wm_Import_Validate {
41
$archive_bytes_offset = 0;
42
}
43
44
// Set progress
45
- Ai1wm_Status::info( __( 'Unpacking archive...', AI1WM_PLUGIN_NAME ) );
46
47
// Open the archive file for reading
48
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
@@ -54,30 +71,17 @@ class Ai1wm_Import_Validate {
54
if ( ! $archive->is_valid() ) {
55
throw new Ai1wm_Import_Exception(
56
__(
57
- 'The archive file is corrupted. Follow this article to resolve the problem: ' .
58
- '<a href="https://help.servmask.com/knowledgebase/corrupted-archive/" target="_blank">https://help.servmask.com/knowledgebase/corrupted-archive/</a>',
59
AI1WM_PLUGIN_NAME
60
)
61
);
62
}
63
64
- // Obtain the name of the archive
65
- $name = ai1wm_archive_name( $params );
66
-
67
- // Obtain the size of the archive
68
- $size = ai1wm_archive_bytes( $params );
69
-
70
- // Check file size of the archive
71
- if ( false === $size ) {
72
- throw new Ai1wm_Not_Accessible_Exception(
73
- sprintf( __( 'Unable to get the file size of <strong>%s</strong>', AI1WM_PLUGIN_NAME ), $name )
74
- );
75
- }
76
-
77
$allowed_size = apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE );
78
79
// Let's check the size of the file to make sure it is less than the maximum allowed
80
- if ( ( $allowed_size > 0 ) && ( $size > $allowed_size ) ) {
81
throw new Ai1wm_Import_Exception(
82
sprintf(
83
__(
@@ -112,10 +116,17 @@ class Ai1wm_Import_Validate {
112
// Check package.json file
113
if ( false === is_file( ai1wm_package_path( $params ) ) ) {
114
throw new Ai1wm_Import_Exception(
115
- __( 'Invalid archive file. It should contain <strong>package.json</strong> file.', AI1WM_PLUGIN_NAME )
116
);
117
}
118
119
// Unset file bytes offset
120
unset( $params['file_bytes_offset'] );
121
@@ -127,6 +138,12 @@ class Ai1wm_Import_Validate {
127
128
} else {
129
130
// Set file bytes offset
131
$params['file_bytes_offset'] = $file_bytes_offset;
132
27
28
public static function execute( $params ) {
29
30
+ // Verify file if size > 2GB and PHP = 32-bit
31
+ if ( ! ai1wm_is_filesize_supported( ai1wm_archive_path( $params ) ) ) {
32
+ throw new Ai1wm_Import_Exception(
33
+ __(
34
+ 'Your PHP is 32-bit. In order to import your file, please change your PHP version to 64-bit and try again. ' .
35
+ '<a href="https://help.servmask.com/knowledgebase/php-32bit/" target="_blank">Technical details</a>',
36
+ AI1WM_PLUGIN_NAME
37
+ )
38
+ );
39
+ }
40
+
41
// Set file bytes offset
42
if ( isset( $params['file_bytes_offset'] ) ) {
43
$file_bytes_offset = (int) $params['file_bytes_offset'];
52
$archive_bytes_offset = 0;
53
}
54
55
+ // Obtain the size of the archive
56
+ $total_files_size = ai1wm_archive_bytes( $params );
57
+
58
+ // What percent of files have we processed?
59
+ $progress = (int) min( ( $archive_bytes_offset / $total_files_size ) * 100, 100 );
60
+
61
// Set progress
62
+ Ai1wm_Status::info( sprintf( __( 'Unpacking archive...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
63
64
// Open the archive file for reading
65
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
71
if ( ! $archive->is_valid() ) {
72
throw new Ai1wm_Import_Exception(
73
__(
74
+ 'The archive file is corrupted. Follow ' .
75
+ '<a href="https://help.servmask.com/knowledgebase/corrupted-archive/" target="_blank">this article</a> to resolve the problem.',
76
AI1WM_PLUGIN_NAME
77
)
78
);
79
}
80
81
$allowed_size = apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE );
82
83
// Let's check the size of the file to make sure it is less than the maximum allowed
84
+ if ( ( $allowed_size > 0 ) && ( $total_files_size > $allowed_size ) ) {
85
throw new Ai1wm_Import_Exception(
86
sprintf(
87
__(
116
// Check package.json file
117
if ( false === is_file( ai1wm_package_path( $params ) ) ) {
118
throw new Ai1wm_Import_Exception(
119
+ __(
120
+ 'Please make sure that your file was exported using <strong>All-in-One WP Migration</strong> plugin. ' .
121
+ '<a href="https://help.servmask.com/knowledgebase/invalid-backup-file/" target="_blank">Technical details</a>',
122
+ AI1WM_PLUGIN_NAME
123
+ )
124
);
125
}
126
127
+ // Set progress
128
+ Ai1wm_Status::info( __( 'Done unpacking archive.', AI1WM_PLUGIN_NAME ) );
129
+
130
// Unset file bytes offset
131
unset( $params['file_bytes_offset'] );
132
138
139
} else {
140
141
+ // What percent of files have we processed?
142
+ $progress = (int) min( ( $archive_bytes_offset / $total_files_size ) * 100, 100 );
143
+
144
+ // Set progress
145
+ Ai1wm_Status::info( sprintf( __( 'Unpacking archive...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
146
+
147
// Set file bytes offset
148
$params['file_bytes_offset'] = $file_bytes_offset;
149
lib/vendor/servmask/archiver/class-ai1wm-compressor.php CHANGED
@@ -53,6 +53,12 @@ class Ai1wm_Compressor extends Ai1wm_Archiver {
53
public function add_file( $file_name, $new_file_name = '', &$file_written = 0, &$file_offset = 0, $timeout = 0 ) {
54
$file_written = 0;
55
56
// Flag to hold if file data has been processed
57
$completed = true;
58
53
public function add_file( $file_name, $new_file_name = '', &$file_written = 0, &$file_offset = 0, $timeout = 0 ) {
54
$file_written = 0;
55
56
+ // Replace / with DIRECTORY_SEPARATOR in file name
57
+ $file_name = str_replace( '/', DIRECTORY_SEPARATOR, $file_name );
58
+
59
+ // Replace \ with \\ in file name (Windows)
60
+ $file_name = str_replace( '\\', '\\\\', $file_name );
61
+
62
// Flag to hold if file data has been processed
63
$completed = true;
64
lib/vendor/servmask/archiver/class-ai1wm-extractor.php CHANGED
@@ -164,6 +164,9 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
164
throw new Ai1wm_Not_Directory_Exception( sprintf( 'Location is not a directory: %s', $location ) );
165
}
166
167
// Flag to hold if file data has been processed
168
$completed = true;
169
@@ -226,15 +229,21 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
226
}
227
}
228
229
// Check if location doesn't exist, then create it
230
- if ( false === is_dir( $location . DIRECTORY_SEPARATOR . $file_path ) ) {
231
- @mkdir( $location . DIRECTORY_SEPARATOR . $file_path, $this->get_permissions_for_directory(), true );
232
}
233
234
$file_written = 0;
235
236
// We have a match, let's extract the file
237
- if ( ( $completed = $this->extract_to( $location . DIRECTORY_SEPARATOR . $file_name, $file_size, $file_mtime, $file_written, $file_offset, $timeout ) ) ) {
238
$file_offset = 0;
239
}
240
} else {
@@ -270,6 +279,9 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
270
throw new Ai1wm_Not_Directory_Exception( sprintf( 'Location is not a directory: %s', $location ) );
271
}
272
273
// Flag to hold if file data has been processed
274
$completed = true;
275
@@ -326,15 +338,21 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
326
// Do we have a match?
327
if ( $should_include_file === true ) {
328
329
// Check if location doesn't exist, then create it
330
- if ( false === is_dir( $location . DIRECTORY_SEPARATOR . $file_path ) ) {
331
- @mkdir( $location . DIRECTORY_SEPARATOR . $file_path, $this->get_permissions_for_directory(), true );
332
}
333
334
$file_written = 0;
335
336
// We have a match, let's extract the file and remove it from the array
337
- if ( ( $completed = $this->extract_to( $location . DIRECTORY_SEPARATOR . $file_name, $file_size, $file_mtime, $file_written, $file_offset, $timeout ) ) ) {
338
$file_offset = 0;
339
}
340
} else {
@@ -491,12 +509,12 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
491
$data['filename'] = ( $data['path'] === '.' ? $data['filename'] : $data['path'] . DIRECTORY_SEPARATOR . $data['filename'] );
492
493
// Set file path
494
- $data['path'] = ( $data['path'] === '.' ? null : $data['path'] );
495
496
- // Replace forward slash with current directory separator
497
$data['filename'] = str_replace( '/', DIRECTORY_SEPARATOR, $data['filename'] );
498
499
- // Replace forward slash with current directory separator
500
$data['path'] = str_replace( '/', DIRECTORY_SEPARATOR, $data['path'] );
501
}
502
164
throw new Ai1wm_Not_Directory_Exception( sprintf( 'Location is not a directory: %s', $location ) );
165
}
166
167
+ // Replace / with DIRECTORY_SEPARATOR in location
168
+ $location = str_replace( '/', DIRECTORY_SEPARATOR, $location );
169
+
170
// Flag to hold if file data has been processed
171
$completed = true;
172
229
}
230
}
231
232
+ // Replace \ with \\ in file path (Windows)
233
+ $file_path = str_replace( '\\', '\\\\', $location . DIRECTORY_SEPARATOR . $file_path );
234
+
235
+ // Replace \ with \\ in file name (Windows)
236
+ $file_name = str_replace( '\\', '\\\\', $location . DIRECTORY_SEPARATOR . $file_name );
237
+
238
// Check if location doesn't exist, then create it
239
+ if ( false === is_dir( $file_path ) ) {
240
+ @mkdir( $file_path, $this->get_permissions_for_directory(), true );
241
}
242
243
$file_written = 0;
244
245
// We have a match, let's extract the file
246
+ if ( ( $completed = $this->extract_to( $file_name, $file_size, $file_mtime, $file_written, $file_offset, $timeout ) ) ) {
247
$file_offset = 0;
248
}
249
} else {
279
throw new Ai1wm_Not_Directory_Exception( sprintf( 'Location is not a directory: %s', $location ) );
280
}
281
282
+ // Replace / with DIRECTORY_SEPARATOR in location
283
+ $location = str_replace( '/', DIRECTORY_SEPARATOR, $location );
284
+
285
// Flag to hold if file data has been processed
286
$completed = true;
287
338
// Do we have a match?
339
if ( $should_include_file === true ) {
340
341
+ // Replace \ with \\ in file path (Windows)
342
+ $file_path = str_replace( '\\', '\\\\', $location . DIRECTORY_SEPARATOR . $file_path );
343
+
344
+ // Replace \ with \\ in file name (Windows)
345
+ $file_name = str_replace( '\\', '\\\\', $location . DIRECTORY_SEPARATOR . $file_name );
346
+
347
// Check if location doesn't exist, then create it
348
+ if ( false === is_dir( $file_path ) ) {
349
+ @mkdir( $file_path, $this->get_permissions_for_directory(), true );
350
}
351
352
$file_written = 0;
353
354
// We have a match, let's extract the file and remove it from the array
355
+ if ( ( $completed = $this->extract_to( $file_name, $file_size, $file_mtime, $file_written, $file_offset, $timeout ) ) ) {
356
$file_offset = 0;
357
}
358
} else {
509
$data['filename'] = ( $data['path'] === '.' ? $data['filename'] : $data['path'] . DIRECTORY_SEPARATOR . $data['filename'] );
510
511
// Set file path
512
+ $data['path'] = ( $data['path'] === '.' ? '' : $data['path'] );
513
514
+ // Replace / with DIRECTORY_SEPARATOR in file name
515
$data['filename'] = str_replace( '/', DIRECTORY_SEPARATOR, $data['filename'] );
516
517
+ // Replace / with DIRECTORY_SEPARATOR in path
518
$data['path'] = str_replace( '/', DIRECTORY_SEPARATOR, $data['path'] );
519
}
520
lib/vendor/servmask/database/class-ai1wm-database.php CHANGED
@@ -558,7 +558,7 @@ abstract class Ai1wm_Database {
558
$table_where = implode( ' AND ', $table_where );
559
560
// Set query with offset and rows count
561
- $query = sprintf( 'SELECT t1.* FROM `%s` AS t1 JOIN (SELECT %s FROM `%s` ORDER BY %s LIMIT %d, %d) AS t2 USING (%s) WHERE %s', $table_name, $table_keys, $table_name, $table_keys, $table_offset, 1000, $table_keys, $table_where );
562
563
} else {
564
@@ -622,12 +622,12 @@ abstract class Ai1wm_Database {
622
ai1wm_write( $file_handler, "COMMIT;\n" );
623
}
624
}
625
626
// Write end of transaction
627
if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION !== 0 ) {
628
ai1wm_write( $file_handler, "COMMIT;\n" );
629
}
630
- } else {
631
632
// Set current table offset
633
$table_offset = 0;
558
$table_where = implode( ' AND ', $table_where );
559
560
// Set query with offset and rows count
561
+ $query = sprintf( 'SELECT t1.* FROM `%s` AS t1 JOIN (SELECT %s FROM `%s` WHERE %s ORDER BY %s LIMIT %d, %d) AS t2 USING (%s)', $table_name, $table_keys, $table_name, $table_where, $table_keys, $table_offset, 1000, $table_keys );
562
563
} else {
564
622
ai1wm_write( $file_handler, "COMMIT;\n" );
623
}
624
}
625
+ } else {
626
627
// Write end of transaction
628
if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION !== 0 ) {
629
ai1wm_write( $file_handler, "COMMIT;\n" );
630
}
631
632
// Set current table offset
633
$table_offset = 0;
lib/view/backups/index.php CHANGED
@@ -52,32 +52,30 @@
52
<i class="ai1wm-icon-file-zip"></i>
53
<?php echo esc_html( $backup['filename'] ); ?>
54
</td>
55
- <?php if ( is_null( $backup['size'] ) ) : ?>
56
- <td class="ai1wm-column-info" colspan="3">
57
- <?php _e( 'The file is too large for your hosting plan.', AI1WM_PLUGIN_NAME ); ?>
58
- </td>
59
- <?php else : ?>
60
- <td class="ai1wm-column-date">
61
- <?php echo human_time_diff( $backup['mtime'] ); ?> <?php _e( 'ago', AI1WM_PLUGIN_NAME ); ?>
62
- </td>
63
- <td class="ai1wm-column-size">
64
<?php echo size_format( $backup['size'], 2 ); ?>
65
- </td>
66
- <td class="ai1wm-column-actions ai1wm-backup-actions">
67
- <a href="<?php echo ai1wm_backups_url( array( 'archive' => esc_attr( $backup['filename'] ) ) ); ?>" class="ai1wm-button-green ai1wm-button-alone ai1wm-backup-download">
68
- <i class="ai1wm-icon-arrow-down ai1wm-icon-alone"></i>
69
- <span><?php _e( 'Download', AI1WM_PLUGIN_NAME ); ?></span>
70
- </a>
71
- <a href="#" data-archive="<?php echo esc_attr( $backup['filename'] ); ?>" class="ai1wm-button-gray ai1wm-button-alone ai1wm-backup-restore">
72
- <i class="ai1wm-icon-cloud-upload ai1wm-icon-alone"></i>
73
- <span><?php _e( 'Restore', AI1WM_PLUGIN_NAME ); ?></span>
74
- </a>
75
- <a href="#" data-archive="<?php echo esc_attr( $backup['filename'] ); ?>" class="ai1wm-button-red ai1wm-button-alone ai1wm-backup-delete">
76
- <i class="ai1wm-icon-close ai1wm-icon-alone"></i>
77
- <span><?php _e( 'Delete', AI1WM_PLUGIN_NAME ); ?></span>
78
- </a>
79
- </td>
80
- <?php endif; ?>
81
</tr>
82
<?php endforeach; ?>
83
</tbody>
52
<i class="ai1wm-icon-file-zip"></i>
53
<?php echo esc_html( $backup['filename'] ); ?>
54
</td>
55
+ <td class="ai1wm-column-date">
56
+ <?php echo human_time_diff( $backup['mtime'] ); ?> <?php _e( 'ago', AI1WM_PLUGIN_NAME ); ?>
57
+ </td>
58
+ <td class="ai1wm-column-size">
59
+ <?php if ( is_null( $backup['size'] ) ) : ?>
60
+ <?php _e( '2GB+', AI1WM_PLUGIN_NAME ); ?>
61
+ <?php else : ?>
62
<?php echo size_format( $backup['size'], 2 ); ?>
63
+ <?php endif; ?>
64
+ </td>
65
+ <td class="ai1wm-column-actions ai1wm-backup-actions">
66
+ <a href="<?php echo ai1wm_backups_url( array( 'archive' => esc_attr( $backup['filename'] ) ) ); ?>" class="ai1wm-button-green ai1wm-button-alone ai1wm-backup-download">
67
+ <i class="ai1wm-icon-arrow-down ai1wm-icon-alone"></i>
68
+ <span><?php _e( 'Download', AI1WM_PLUGIN_NAME ); ?></span>
69
+ </a>
70
+ <a href="#" data-archive="<?php echo esc_attr( $backup['filename'] ); ?>" class="ai1wm-button-gray ai1wm-button-alone ai1wm-backup-restore">
71
+ <i class="ai1wm-icon-cloud-upload ai1wm-icon-alone"></i>
72
+ <span><?php _e( 'Restore', AI1WM_PLUGIN_NAME ); ?></span>
73
+ </a>
74
+ <a href="#" data-archive="<?php echo esc_attr( $backup['filename'] ); ?>" class="ai1wm-button-red ai1wm-button-alone ai1wm-backup-delete">
75
+ <i class="ai1wm-icon-close ai1wm-icon-alone"></i>
76
+ <span><?php _e( 'Delete', AI1WM_PLUGIN_NAME ); ?></span>
77
+ </a>
78
+ </td>
79
</tr>
80
<?php endforeach; ?>
81
</tbody>
loader.php CHANGED
@@ -236,6 +236,10 @@ require_once AI1WM_EXPORT_PATH .
236
DIRECTORY_SEPARATOR .
237
'class-ai1wm-export-database.php';
238
239
require_once AI1WM_EXPORT_PATH .
240
DIRECTORY_SEPARATOR .
241
'class-ai1wm-export-download.php';
236
DIRECTORY_SEPARATOR .
237
'class-ai1wm-export-database.php';
238
239
+ require_once AI1WM_EXPORT_PATH .
240
+ DIRECTORY_SEPARATOR .
241
+ 'class-ai1wm-export-database-file.php';
242
+
243
require_once AI1WM_EXPORT_PATH .
244
DIRECTORY_SEPARATOR .
245
'class-ai1wm-export-download.php';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: yani.iliev, bangelov, pimjitsawang
3
Tags: move, transfer, copy, migrate, backup, clone, restore, db migration, wordpress migration, website migration, database export, database import, apoyo, sauvegarde, di riserva, バックアップ
4
Requires at least: 3.3
5
Tested up to: 4.8
6
- Stable tag: 6.54
7
License: GPLv2 or later
8
9
Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
@@ -90,6 +90,21 @@ Alternatively you can download the plugin using the download button on this page
90
3. Plugin Menu
91
92
== Changelog ==
93
= 6.54 =
94
**Changed**
95
3
Tags: move, transfer, copy, migrate, backup, clone, restore, db migration, wordpress migration, website migration, database export, database import, apoyo, sauvegarde, di riserva, バックアップ
4
Requires at least: 3.3
5
Tested up to: 4.8
6
+ Stable tag: 6.55
7
License: GPLv2 or later
8
9
Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
90
3. Plugin Menu
91
92
== Changelog ==
93
+ = 6.55 =
94
+ **Added**
95
+
96
+ * Percentage indicator on "Unpacking archive" step
97
+ * Chunking mechanism when adding database.sql to wpress file on export
98
+
99
+ **Changed**
100
+
101
+ * Display 2GB+ value if file size cannot be obtained on Backups page
102
+ * Move COMMIT condition after processing all table records
103
+
104
+ **Fixed**
105
+
106
+ * Directory separator of archiver on Windows
107
+
108
= 6.54 =
109
**Changed**
110