Version Description
Added
- Warn the user when web server configuration files are not created
Changed
- Buffered queries instead of unbuffered queries
- Relative URLs instead of absolute URLs when loading fonts and images
Download this release
Release Info
Developer | bangelov |
Plugin | All-in-One WP Migration |
Version | 6.53 |
Comparing to | |
See all releases |
Code changes from version 6.52 to 6.53
- all-in-one-wp-migration.php +1 -1
- constants.php +1 -1
- lib/controller/class-ai1wm-main-controller.php +83 -32
- lib/model/class-ai1wm-extensions.php +1 -1
- lib/model/export/class-ai1wm-export-database.php +39 -13
- lib/vendor/servmask/database/class-ai1wm-database-mysql.php +13 -3
- lib/vendor/servmask/database/class-ai1wm-database-mysqli.php +13 -3
- lib/vendor/servmask/database/class-ai1wm-database.php +221 -97
- lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php +2 -3
- lib/vendor/servmask/filesystem/class-ai1wm-file-index.php +2 -1
- lib/vendor/servmask/filesystem/class-ai1wm-file-webconfig.php +1 -1
- lib/vendor/servmask/filesystem/class-ai1wm-file.php +9 -9
- lib/view/main/admin-head.php +7 -7
- lib/view/main/backups-htaccess-notice.php +15 -0
- lib/view/main/{index-notice.php → backups-index-notice.php} +1 -1
- lib/view/main/{backups-notice.php → backups-path-notice.php} +0 -0
- lib/view/main/backups-webconfig-notice.php +15 -0
- lib/view/main/storage-index-notice.php +15 -0
- lib/view/main/{storage-notice.php → storage-path-notice.php} +0 -0
- readme.txt +11 -1
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.53
|
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.
|
35 |
|
36 |
// ===============
|
37 |
// = Plugin Name =
|
31 |
// ==================
|
32 |
// = Plugin Version =
|
33 |
// ==================
|
34 |
+
define( 'AI1WM_VERSION', '6.53' );
|
35 |
|
36 |
// ===============
|
37 |
// = Plugin Name =
|
lib/controller/class-ai1wm-main-controller.php
CHANGED
@@ -217,30 +217,57 @@ class Ai1wm_Main_Controller {
|
|
217 |
}
|
218 |
|
219 |
/**
|
220 |
-
* Display storage directory
|
221 |
*
|
222 |
* @return void
|
223 |
*/
|
224 |
-
public function
|
225 |
-
Ai1wm_Template::render( 'main/storage-notice' );
|
226 |
}
|
227 |
|
228 |
/**
|
229 |
-
* Display index file
|
230 |
*
|
231 |
* @return void
|
232 |
*/
|
233 |
-
public function
|
234 |
-
Ai1wm_Template::render( 'main/index-notice' );
|
235 |
}
|
236 |
|
237 |
/**
|
238 |
-
* Display backups directory
|
239 |
*
|
240 |
* @return void
|
241 |
*/
|
242 |
-
public function
|
243 |
-
Ai1wm_Template::render( 'main/backups-notice' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
|
246 |
/**
|
@@ -262,47 +289,71 @@ class Ai1wm_Main_Controller {
|
|
262 |
* @return void
|
263 |
*/
|
264 |
public function create_folders() {
|
265 |
-
// Check if storage folder
|
266 |
if ( ! is_dir( AI1WM_STORAGE_PATH ) ) {
|
267 |
-
|
268 |
-
// Folder doesn't exist, attempt to create it
|
269 |
if ( ! mkdir( AI1WM_STORAGE_PATH ) ) {
|
270 |
-
|
271 |
-
// We couldn't create the folder, so let's tell the user
|
272 |
if ( is_multisite() ) {
|
273 |
-
return add_action( 'network_admin_notices', array( $this, '
|
274 |
} else {
|
275 |
-
return add_action( 'admin_notices', array( $this, '
|
276 |
}
|
277 |
}
|
278 |
}
|
279 |
|
280 |
-
//
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
|
283 |
-
// Check if backups folder
|
284 |
if ( ! is_dir( AI1WM_BACKUPS_PATH ) ) {
|
285 |
-
|
286 |
-
// Folder doesn't exist, attempt to create it
|
287 |
if ( ! mkdir( AI1WM_BACKUPS_PATH ) ) {
|
288 |
-
|
289 |
-
// We couldn't create the folder, so let's tell the user
|
290 |
if ( is_multisite() ) {
|
291 |
-
return add_action( 'network_admin_notices', array( $this, '
|
292 |
} else {
|
293 |
-
return add_action( 'admin_notices', array( $this, '
|
294 |
}
|
295 |
}
|
296 |
}
|
297 |
|
298 |
-
//
|
299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
|
301 |
-
//
|
302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
-
//
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
}
|
307 |
|
308 |
/**
|
@@ -567,7 +618,7 @@ class Ai1wm_Main_Controller {
|
|
567 |
);
|
568 |
wp_localize_script( 'ai1wm-js-updater', 'ai1wm_updater', array(
|
569 |
'ajax' => array(
|
570 |
-
'url' => admin_url( 'admin-ajax.php?action=ai1wm_updater' ),
|
571 |
),
|
572 |
) );
|
573 |
}
|
217 |
}
|
218 |
|
219 |
/**
|
220 |
+
* Display notice for storage directory
|
221 |
*
|
222 |
* @return void
|
223 |
*/
|
224 |
+
public function storage_path_notice() {
|
225 |
+
Ai1wm_Template::render( 'main/storage-path-notice' );
|
226 |
}
|
227 |
|
228 |
/**
|
229 |
+
* Display notice for index file in storage directory
|
230 |
*
|
231 |
* @return void
|
232 |
*/
|
233 |
+
public function storage_index_notice() {
|
234 |
+
Ai1wm_Template::render( 'main/storage-index-notice' );
|
235 |
}
|
236 |
|
237 |
/**
|
238 |
+
* Display notice for backups directory
|
239 |
*
|
240 |
* @return void
|
241 |
*/
|
242 |
+
public function backups_path_notice() {
|
243 |
+
Ai1wm_Template::render( 'main/backups-path-notice' );
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Display notice for .htaccess file in backups directory
|
248 |
+
*
|
249 |
+
* @return void
|
250 |
+
*/
|
251 |
+
public function backups_htaccess_notice() {
|
252 |
+
Ai1wm_Template::render( 'main/backups-htaccess-notice' );
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Display notice for web.config file in backups directory
|
257 |
+
*
|
258 |
+
* @return void
|
259 |
+
*/
|
260 |
+
public function backups_webconfig_notice() {
|
261 |
+
Ai1wm_Template::render( 'main/backups-webconfig-notice' );
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Display notice for index file in backups directory
|
266 |
+
*
|
267 |
+
* @return void
|
268 |
+
*/
|
269 |
+
public function backups_index_notice() {
|
270 |
+
Ai1wm_Template::render( 'main/backups-index-notice' );
|
271 |
}
|
272 |
|
273 |
/**
|
289 |
* @return void
|
290 |
*/
|
291 |
public function create_folders() {
|
292 |
+
// Check if storage folder is created
|
293 |
if ( ! is_dir( AI1WM_STORAGE_PATH ) ) {
|
|
|
|
|
294 |
if ( ! mkdir( AI1WM_STORAGE_PATH ) ) {
|
|
|
|
|
295 |
if ( is_multisite() ) {
|
296 |
+
return add_action( 'network_admin_notices', array( $this, 'storage_path_notice' ) );
|
297 |
} else {
|
298 |
+
return add_action( 'admin_notices', array( $this, 'storage_path_notice' ) );
|
299 |
}
|
300 |
}
|
301 |
}
|
302 |
|
303 |
+
// Check if index.php is created in storage folder
|
304 |
+
if ( ! is_file( AI1WM_STORAGE_INDEX ) ) {
|
305 |
+
if ( ! Ai1wm_File_Index::create( AI1WM_STORAGE_INDEX ) ) {
|
306 |
+
if ( is_multisite() ) {
|
307 |
+
return add_action( 'network_admin_notices', array( $this, 'storage_index_notice' ) );
|
308 |
+
} else {
|
309 |
+
return add_action( 'admin_notices', array( $this, 'storage_index_notice' ) );
|
310 |
+
}
|
311 |
+
}
|
312 |
+
}
|
313 |
|
314 |
+
// Check if ai1wm-backups folder is created
|
315 |
if ( ! is_dir( AI1WM_BACKUPS_PATH ) ) {
|
|
|
|
|
316 |
if ( ! mkdir( AI1WM_BACKUPS_PATH ) ) {
|
|
|
|
|
317 |
if ( is_multisite() ) {
|
318 |
+
return add_action( 'network_admin_notices', array( $this, 'backups_path_notice' ) );
|
319 |
} else {
|
320 |
+
return add_action( 'admin_notices', array( $this, 'backups_path_notice' ) );
|
321 |
}
|
322 |
}
|
323 |
}
|
324 |
|
325 |
+
// Check if .htaccess is created in backups folder
|
326 |
+
if ( ! is_file( AI1WM_BACKUPS_HTACCESS ) ) {
|
327 |
+
if ( ! Ai1wm_File_Htaccess::create( AI1WM_BACKUPS_HTACCESS ) ) {
|
328 |
+
if ( is_multisite() ) {
|
329 |
+
return add_action( 'network_admin_notices', array( $this, 'backups_htaccess_notice' ) );
|
330 |
+
} else {
|
331 |
+
return add_action( 'admin_notices', array( $this, 'backups_htaccess_notice' ) );
|
332 |
+
}
|
333 |
+
}
|
334 |
+
}
|
335 |
|
336 |
+
// Check if web.config is created in backups folder
|
337 |
+
if ( ! is_file( AI1WM_BACKUPS_WEBCONFIG ) ) {
|
338 |
+
if ( ! Ai1wm_File_Webconfig::create( AI1WM_BACKUPS_WEBCONFIG ) ) {
|
339 |
+
if ( is_multisite() ) {
|
340 |
+
return add_action( 'network_admin_notices', array( $this, 'backups_webconfig_notice' ) );
|
341 |
+
} else {
|
342 |
+
return add_action( 'admin_notices', array( $this, 'backups_webconfig_notice' ) );
|
343 |
+
}
|
344 |
+
}
|
345 |
+
}
|
346 |
|
347 |
+
// Check if index.php is created in backups folder
|
348 |
+
if ( ! is_file( AI1WM_BACKUPS_INDEX ) ) {
|
349 |
+
if ( ! Ai1wm_File_Index::create( AI1WM_BACKUPS_INDEX ) ) {
|
350 |
+
if ( is_multisite() ) {
|
351 |
+
return add_action( 'network_admin_notices', array( $this, 'backups_index_notice' ) );
|
352 |
+
} else {
|
353 |
+
return add_action( 'admin_notices', array( $this, 'backups_index_notice' ) );
|
354 |
+
}
|
355 |
+
}
|
356 |
+
}
|
357 |
}
|
358 |
|
359 |
/**
|
618 |
);
|
619 |
wp_localize_script( 'ai1wm-js-updater', 'ai1wm_updater', array(
|
620 |
'ajax' => array(
|
621 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_updater' ) ),
|
622 |
),
|
623 |
) );
|
624 |
}
|
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.
|
80 |
'short' => AI1WMME_PLUGIN_SHORT,
|
81 |
);
|
82 |
}
|
76 |
'about' => AI1WMME_PLUGIN_ABOUT,
|
77 |
'basename' => AI1WMME_PLUGIN_BASENAME,
|
78 |
'version' => AI1WMME_VERSION,
|
79 |
+
'requires' => '3.34',
|
80 |
'short' => AI1WMME_PLUGIN_SHORT,
|
81 |
);
|
82 |
}
|
lib/model/export/class-ai1wm-export-database.php
CHANGED
@@ -33,6 +33,13 @@ class Ai1wm_Export_Database {
|
|
33 |
return $params;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
// Set table offset
|
37 |
if ( isset( $params['table_offset'] ) ) {
|
38 |
$table_offset = (int) $params['table_offset'];
|
@@ -40,6 +47,13 @@ class Ai1wm_Export_Database {
|
|
40 |
$table_offset = 0;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
// Set total tables count
|
44 |
if ( isset( $params['total_tables_count'] ) ) {
|
45 |
$total_tables_count = (int) $params['total_tables_count'];
|
@@ -48,7 +62,7 @@ class Ai1wm_Export_Database {
|
|
48 |
}
|
49 |
|
50 |
// What percent of tables have we processed?
|
51 |
-
$progress = (int) ( ( $
|
52 |
|
53 |
// Set progress
|
54 |
Ai1wm_Status::info( sprintf( __( 'Exporting database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
|
@@ -60,18 +74,19 @@ class Ai1wm_Export_Database {
|
|
60 |
$mysql = new Ai1wm_Database_Mysqli( $wpdb );
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
63 |
// Spam comments
|
64 |
if ( isset( $params['options']['no_spam_comments'] ) ) {
|
65 |
-
$mysql->
|
66 |
-
$mysql->
|
67 |
-
" WHERE comment_id IN ( SELECT comment_ID FROM `%s` WHERE comment_approved != 'spam' ) ",
|
68 |
-
ai1wm_table_prefix() . 'comments'
|
69 |
-
) );
|
70 |
}
|
71 |
|
72 |
// Post revisions
|
73 |
if ( isset( $params['options']['no_revisions'] ) ) {
|
74 |
-
$mysql->
|
75 |
}
|
76 |
|
77 |
$old_table_prefixes = array();
|
@@ -96,6 +111,7 @@ class Ai1wm_Export_Database {
|
|
96 |
}
|
97 |
|
98 |
$include_table_prefixes = array();
|
|
|
99 |
|
100 |
// Include table prefixes
|
101 |
if ( ai1wm_table_prefix() ) {
|
@@ -110,14 +126,13 @@ class Ai1wm_Export_Database {
|
|
110 |
$mysql->set_old_table_prefixes( $old_table_prefixes )
|
111 |
->set_new_table_prefixes( $new_table_prefixes )
|
112 |
->set_include_table_prefixes( $include_table_prefixes )
|
113 |
-
->
|
114 |
-
->set_table_prefix_columns( ai1wm_table_prefix() . 'usermeta', array( 'meta_key' ) );
|
115 |
|
116 |
// Exclude active plugins and status options
|
117 |
-
$mysql->
|
118 |
|
119 |
// Export database
|
120 |
-
if ( $mysql->export( ai1wm_database_path( $params ), $table_offset, 10 ) ) {
|
121 |
|
122 |
// Get archive file
|
123 |
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
@@ -129,9 +144,15 @@ class Ai1wm_Export_Database {
|
|
129 |
// Set progress
|
130 |
Ai1wm_Status::info( __( 'Done exporting database...', AI1WM_PLUGIN_NAME ) );
|
131 |
|
|
|
|
|
|
|
132 |
// Unset table offset
|
133 |
unset( $params['table_offset'] );
|
134 |
|
|
|
|
|
|
|
135 |
// Unset total tables count
|
136 |
unset( $params['total_tables_count'] );
|
137 |
|
@@ -144,20 +165,25 @@ class Ai1wm_Export_Database {
|
|
144 |
$total_tables_count = count( $mysql->get_tables() );
|
145 |
|
146 |
// What percent of tables have we processed?
|
147 |
-
$progress = (int) ( ( $
|
148 |
|
149 |
// Set progress
|
150 |
Ai1wm_Status::info( sprintf( __( 'Exporting database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
|
151 |
|
|
|
|
|
|
|
152 |
// Set table offset
|
153 |
$params['table_offset'] = $table_offset;
|
154 |
|
|
|
|
|
|
|
155 |
// Set total tables count
|
156 |
$params['total_tables_count'] = $total_tables_count;
|
157 |
|
158 |
// Set completed flag
|
159 |
$params['completed'] = false;
|
160 |
-
|
161 |
}
|
162 |
|
163 |
return $params;
|
33 |
return $params;
|
34 |
}
|
35 |
|
36 |
+
// Set table index
|
37 |
+
if ( isset( $params['table_index'] ) ) {
|
38 |
+
$table_index = (int) $params['table_index'];
|
39 |
+
} else {
|
40 |
+
$table_index = 0;
|
41 |
+
}
|
42 |
+
|
43 |
// Set table offset
|
44 |
if ( isset( $params['table_offset'] ) ) {
|
45 |
$table_offset = (int) $params['table_offset'];
|
47 |
$table_offset = 0;
|
48 |
}
|
49 |
|
50 |
+
// Set table keys
|
51 |
+
if ( isset( $params['table_keys'] ) ) {
|
52 |
+
$table_keys = (array) $params['table_keys'];
|
53 |
+
} else {
|
54 |
+
$table_keys = array();
|
55 |
+
}
|
56 |
+
|
57 |
// Set total tables count
|
58 |
if ( isset( $params['total_tables_count'] ) ) {
|
59 |
$total_tables_count = (int) $params['total_tables_count'];
|
62 |
}
|
63 |
|
64 |
// What percent of tables have we processed?
|
65 |
+
$progress = (int) ( ( $table_index / $total_tables_count ) * 100 );
|
66 |
|
67 |
// Set progress
|
68 |
Ai1wm_Status::info( sprintf( __( 'Exporting database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
|
74 |
$mysql = new Ai1wm_Database_Mysqli( $wpdb );
|
75 |
}
|
76 |
|
77 |
+
// Replace table prefix on columns
|
78 |
+
$mysql->set_table_prefix_columns( ai1wm_table_prefix() . 'options', array( 'option_name' ) )
|
79 |
+
->set_table_prefix_columns( ai1wm_table_prefix() . 'usermeta', array( 'meta_key' ) );
|
80 |
+
|
81 |
// Spam comments
|
82 |
if ( isset( $params['options']['no_spam_comments'] ) ) {
|
83 |
+
$mysql->set_table_where_clauses( ai1wm_table_prefix() . 'comments', array( "`comment_approved` != 'spam'" ) );
|
84 |
+
$mysql->set_table_where_clauses( ai1wm_table_prefix() . 'commentmeta', array( sprintf( "`comment_ID` IN ( SELECT `comment_ID` FROM `%s` WHERE `comment_approved` != 'spam' )", ai1wm_table_prefix() . 'comments' ) ) );
|
|
|
|
|
|
|
85 |
}
|
86 |
|
87 |
// Post revisions
|
88 |
if ( isset( $params['options']['no_revisions'] ) ) {
|
89 |
+
$mysql->set_table_where_clauses( ai1wm_table_prefix() . 'posts', array( "`post_type` != 'revision'" ) );
|
90 |
}
|
91 |
|
92 |
$old_table_prefixes = array();
|
111 |
}
|
112 |
|
113 |
$include_table_prefixes = array();
|
114 |
+
$exclude_table_prefixes = array();
|
115 |
|
116 |
// Include table prefixes
|
117 |
if ( ai1wm_table_prefix() ) {
|
126 |
$mysql->set_old_table_prefixes( $old_table_prefixes )
|
127 |
->set_new_table_prefixes( $new_table_prefixes )
|
128 |
->set_include_table_prefixes( $include_table_prefixes )
|
129 |
+
->set_exclude_table_prefixes( $exclude_table_prefixes );
|
|
|
130 |
|
131 |
// Exclude active plugins and status options
|
132 |
+
$mysql->set_table_where_clauses( ai1wm_table_prefix() . 'options', array( sprintf( "`option_name` NOT IN ('%s', '%s', '%s', '%s')", AI1WM_ACTIVE_PLUGINS, AI1WM_ACTIVE_TEMPLATE, AI1WM_ACTIVE_STYLESHEET, AI1WM_STATUS ) ) );
|
133 |
|
134 |
// Export database
|
135 |
+
if ( $mysql->export( ai1wm_database_path( $params ), $table_index, $table_offset, $table_keys, 10 ) ) {
|
136 |
|
137 |
// Get archive file
|
138 |
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
144 |
// Set progress
|
145 |
Ai1wm_Status::info( __( 'Done exporting database...', AI1WM_PLUGIN_NAME ) );
|
146 |
|
147 |
+
// Unset table index
|
148 |
+
unset( $params['table_index'] );
|
149 |
+
|
150 |
// Unset table offset
|
151 |
unset( $params['table_offset'] );
|
152 |
|
153 |
+
// Unset table keys
|
154 |
+
unset( $params['table_keys'] );
|
155 |
+
|
156 |
// Unset total tables count
|
157 |
unset( $params['total_tables_count'] );
|
158 |
|
165 |
$total_tables_count = count( $mysql->get_tables() );
|
166 |
|
167 |
// What percent of tables have we processed?
|
168 |
+
$progress = (int) ( ( $table_index / $total_tables_count ) * 100 );
|
169 |
|
170 |
// Set progress
|
171 |
Ai1wm_Status::info( sprintf( __( 'Exporting database...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $progress ) );
|
172 |
|
173 |
+
// Set table index
|
174 |
+
$params['table_index'] = $table_index;
|
175 |
+
|
176 |
// Set table offset
|
177 |
$params['table_offset'] = $table_offset;
|
178 |
|
179 |
+
// Set table keys
|
180 |
+
$params['table_keys'] = $table_keys;
|
181 |
+
|
182 |
// Set total tables count
|
183 |
$params['total_tables_count'] = $total_tables_count;
|
184 |
|
185 |
// Set completed flag
|
186 |
$params['completed'] = false;
|
|
|
187 |
}
|
188 |
|
189 |
return $params;
|
lib/vendor/servmask/database/class-ai1wm-database-mysql.php
CHANGED
@@ -32,7 +32,7 @@ class Ai1wm_Database_Mysql extends Ai1wm_Database {
|
|
32 |
* @return resource
|
33 |
*/
|
34 |
public function query( $input ) {
|
35 |
-
return
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -46,7 +46,7 @@ class Ai1wm_Database_Mysql extends Ai1wm_Database {
|
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
-
*
|
50 |
*
|
51 |
* @return int
|
52 |
*/
|
@@ -55,7 +55,7 @@ class Ai1wm_Database_Mysql extends Ai1wm_Database {
|
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
*
|
59 |
*
|
60 |
* @return string
|
61 |
*/
|
@@ -92,6 +92,16 @@ class Ai1wm_Database_Mysql extends Ai1wm_Database {
|
|
92 |
return mysql_fetch_row( $result );
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
/**
|
96 |
* Free MySQL result memory
|
97 |
*
|
32 |
* @return resource
|
33 |
*/
|
34 |
public function query( $input ) {
|
35 |
+
return mysql_query( $input, $this->wpdb->dbh );
|
36 |
}
|
37 |
|
38 |
/**
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
+
* Return the error code for the most recent function call
|
50 |
*
|
51 |
* @return int
|
52 |
*/
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
+
* Return a string description of the last error
|
59 |
*
|
60 |
* @return string
|
61 |
*/
|
92 |
return mysql_fetch_row( $result );
|
93 |
}
|
94 |
|
95 |
+
/**
|
96 |
+
* Return the number for rows from MySQL results
|
97 |
+
*
|
98 |
+
* @param resource $result MySQL resource
|
99 |
+
* @return int
|
100 |
+
*/
|
101 |
+
public function num_rows( $result ) {
|
102 |
+
return mysql_num_rows( $result );
|
103 |
+
}
|
104 |
+
|
105 |
/**
|
106 |
* Free MySQL result memory
|
107 |
*
|
lib/vendor/servmask/database/class-ai1wm-database-mysqli.php
CHANGED
@@ -32,7 +32,7 @@ class Ai1wm_Database_Mysqli extends Ai1wm_Database {
|
|
32 |
* @return resource
|
33 |
*/
|
34 |
public function query( $input ) {
|
35 |
-
return mysqli_query( $this->wpdb->dbh, $input,
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -46,7 +46,7 @@ class Ai1wm_Database_Mysqli extends Ai1wm_Database {
|
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
-
*
|
50 |
*
|
51 |
* @return int
|
52 |
*/
|
@@ -55,7 +55,7 @@ class Ai1wm_Database_Mysqli extends Ai1wm_Database {
|
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
*
|
59 |
*
|
60 |
* @return string
|
61 |
*/
|
@@ -92,6 +92,16 @@ class Ai1wm_Database_Mysqli extends Ai1wm_Database {
|
|
92 |
return mysqli_fetch_row( $result );
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
/**
|
96 |
* Free MySQL result memory
|
97 |
*
|
32 |
* @return resource
|
33 |
*/
|
34 |
public function query( $input ) {
|
35 |
+
return mysqli_query( $this->wpdb->dbh, $input, MYSQLI_STORE_RESULT );
|
36 |
}
|
37 |
|
38 |
/**
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
+
* Return the error code for the most recent function call
|
50 |
*
|
51 |
* @return int
|
52 |
*/
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
+
* Return a string description of the last error
|
59 |
*
|
60 |
* @return string
|
61 |
*/
|
92 |
return mysqli_fetch_row( $result );
|
93 |
}
|
94 |
|
95 |
+
/**
|
96 |
+
* Return the number for rows from MySQL results
|
97 |
+
*
|
98 |
+
* @param resource $result MySQL resource
|
99 |
+
* @return int
|
100 |
+
*/
|
101 |
+
public function num_rows( $result ) {
|
102 |
+
return mysqli_num_rows( $result );
|
103 |
+
}
|
104 |
+
|
105 |
/**
|
106 |
* Free MySQL result memory
|
107 |
*
|
lib/vendor/servmask/database/class-ai1wm-database.php
CHANGED
@@ -73,12 +73,12 @@ abstract class Ai1wm_Database {
|
|
73 |
protected $new_replace_values = array();
|
74 |
|
75 |
/**
|
76 |
-
* Table
|
77 |
*
|
78 |
* @access protected
|
79 |
* @var array
|
80 |
*/
|
81 |
-
protected $
|
82 |
|
83 |
/**
|
84 |
* Table prefix columns
|
@@ -271,28 +271,30 @@ abstract class Ai1wm_Database {
|
|
271 |
}
|
272 |
|
273 |
/**
|
274 |
-
* Set table
|
275 |
*
|
276 |
* @param string $table Table name
|
277 |
* @param array $clauses Table clauses
|
278 |
* @return Ai1wm_Database
|
279 |
*/
|
280 |
-
public function
|
281 |
-
$this->
|
282 |
|
283 |
return $this;
|
284 |
}
|
285 |
|
286 |
/**
|
287 |
-
* Get table
|
288 |
*
|
289 |
* @param string $table Table name
|
290 |
-
* @return
|
291 |
*/
|
292 |
-
public function
|
293 |
-
if ( isset( $this->
|
294 |
-
return $this->
|
295 |
}
|
|
|
|
|
296 |
}
|
297 |
|
298 |
/**
|
@@ -314,12 +316,14 @@ abstract class Ai1wm_Database {
|
|
314 |
* Get table prefix columns
|
315 |
*
|
316 |
* @param string $table Table name
|
317 |
-
* @return
|
318 |
*/
|
319 |
public function get_table_prefix_columns( $table ) {
|
320 |
if ( isset( $this->table_prefix_columns[ strtolower( $table ) ] ) ) {
|
321 |
return $this->table_prefix_columns[ strtolower( $table ) ];
|
322 |
}
|
|
|
|
|
323 |
}
|
324 |
|
325 |
/**
|
@@ -469,16 +473,18 @@ abstract class Ai1wm_Database {
|
|
469 |
* Export database into a file
|
470 |
*
|
471 |
* @param string $file_name Name of file
|
472 |
-
* @param
|
|
|
|
|
473 |
* @param int $timeout Process timeout
|
474 |
* @return bool
|
475 |
*/
|
476 |
-
public function export( $file_name, &$table_offset = 0, $timeout = 0 ) {
|
477 |
// Set file handler
|
478 |
$file_handler = ai1wm_open( $file_name, 'ab' );
|
479 |
|
480 |
// Write headers
|
481 |
-
if ( $
|
482 |
ai1wm_write( $file_handler, $this->get_header() );
|
483 |
}
|
484 |
|
@@ -492,23 +498,16 @@ abstract class Ai1wm_Database {
|
|
492 |
$tables = $this->get_tables();
|
493 |
|
494 |
// Export tables
|
495 |
-
for ( ; $
|
496 |
|
497 |
// Get table name
|
498 |
-
$table_name = $tables[ $
|
499 |
|
500 |
// Replace table name prefixes
|
501 |
$new_table_name = $this->replace_table_prefixes( $table_name, 0 );
|
502 |
|
503 |
-
// Get table
|
504 |
-
|
505 |
-
$table = $this->fetch_assoc( $structure );
|
506 |
-
|
507 |
-
// Close structure cursor
|
508 |
-
$this->free_result( $structure );
|
509 |
-
|
510 |
-
// Get create table
|
511 |
-
if ( isset( $table['Create Table'] ) ) {
|
512 |
|
513 |
// Write table drop statement
|
514 |
$drop_table = "\nDROP TABLE IF EXISTS `{$new_table_name}`;\n";
|
@@ -516,8 +515,11 @@ abstract class Ai1wm_Database {
|
|
516 |
// Write table statement
|
517 |
ai1wm_write( $file_handler, $drop_table );
|
518 |
|
|
|
|
|
|
|
519 |
// Replace create table prefixes
|
520 |
-
$create_table = $this->replace_table_prefixes( $
|
521 |
|
522 |
// Replace table constraints
|
523 |
$create_table = $this->replace_table_constraints( $create_table );
|
@@ -525,76 +527,137 @@ abstract class Ai1wm_Database {
|
|
525 |
// Replace create table options
|
526 |
$create_table = $this->replace_table_options( $create_table );
|
527 |
|
528 |
-
// Write table
|
529 |
ai1wm_write( $file_handler, $create_table );
|
530 |
|
531 |
// Write end of statement
|
532 |
ai1wm_write( $file_handler, ";\n\n" );
|
533 |
}
|
534 |
|
535 |
-
|
|
|
536 |
|
537 |
-
|
538 |
-
$query = sprintf( 'SELECT * FROM `%s` %s', $table_name, $this->get_table_query_clauses( $table_name ) );
|
539 |
|
540 |
-
|
541 |
-
|
542 |
|
543 |
-
|
544 |
-
|
|
|
|
|
|
|
545 |
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
$value = $this->replace_table_prefixes( $value, 0 );
|
558 |
}
|
559 |
|
560 |
-
|
561 |
-
$items[] = is_null( $value ) ? 'NULL' : "'" . $this->escape( $value ) . "'";
|
562 |
-
}
|
563 |
|
564 |
-
|
565 |
-
|
566 |
|
567 |
-
|
568 |
-
|
|
|
|
|
|
|
|
|
|
|
569 |
|
570 |
-
|
571 |
-
ai1wm_write( $file_handler, $table_insert );
|
572 |
|
573 |
-
|
|
|
574 |
|
575 |
-
|
576 |
-
|
577 |
-
ai1wm_write( $file_handler, "COMMIT;\n" );
|
578 |
}
|
579 |
-
}
|
580 |
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
|
586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
|
588 |
-
|
589 |
-
|
590 |
|
591 |
-
|
592 |
-
|
593 |
-
if ( ( microtime( true ) - $start ) > $timeout ) {
|
594 |
-
$completed = false;
|
595 |
-
break;
|
596 |
}
|
597 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
}
|
599 |
|
600 |
// Close file handler
|
@@ -704,20 +767,16 @@ abstract class Ai1wm_Database {
|
|
704 |
* @return string
|
705 |
*/
|
706 |
protected function get_version() {
|
707 |
-
$version = null;
|
708 |
-
|
709 |
$result = $this->query( "SHOW VARIABLES LIKE 'version'" );
|
710 |
-
|
711 |
-
if ( isset( $row[1] ) ) {
|
712 |
-
$version = $row[1];
|
713 |
-
break;
|
714 |
-
}
|
715 |
-
}
|
716 |
|
717 |
// Close result cursor
|
718 |
$this->free_result( $result );
|
719 |
|
720 |
-
|
|
|
|
|
|
|
721 |
}
|
722 |
|
723 |
/**
|
@@ -726,20 +785,16 @@ abstract class Ai1wm_Database {
|
|
726 |
* @return int
|
727 |
*/
|
728 |
protected function get_max_allowed_packet() {
|
729 |
-
$max_allowed_packet = null;
|
730 |
-
|
731 |
$result = $this->query( "SHOW VARIABLES LIKE 'max_allowed_packet'" );
|
732 |
-
|
733 |
-
if ( isset( $row[1] ) ) {
|
734 |
-
$max_allowed_packet = $row[1];
|
735 |
-
break;
|
736 |
-
}
|
737 |
-
}
|
738 |
|
739 |
// Close result cursor
|
740 |
$this->free_result( $result );
|
741 |
|
742 |
-
|
|
|
|
|
|
|
743 |
}
|
744 |
|
745 |
/**
|
@@ -749,20 +804,81 @@ abstract class Ai1wm_Database {
|
|
749 |
* @return string
|
750 |
*/
|
751 |
protected function get_collation( $collation_name ) {
|
752 |
-
$collation_result = null;
|
753 |
-
|
754 |
$result = $this->query( "SHOW COLLATION LIKE '{$collation_name}'" );
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
}
|
760 |
}
|
761 |
|
762 |
// Close result cursor
|
763 |
$this->free_result( $result );
|
764 |
|
765 |
-
return $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
}
|
767 |
|
768 |
/**
|
@@ -1100,6 +1216,14 @@ abstract class Ai1wm_Database {
|
|
1100 |
*/
|
1101 |
abstract public function fetch_row( $result );
|
1102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
/**
|
1104 |
* Free MySQL result memory
|
1105 |
*
|
73 |
protected $new_replace_values = array();
|
74 |
|
75 |
/**
|
76 |
+
* Table where clauses
|
77 |
*
|
78 |
* @access protected
|
79 |
* @var array
|
80 |
*/
|
81 |
+
protected $table_where_clauses = array();
|
82 |
|
83 |
/**
|
84 |
* Table prefix columns
|
271 |
}
|
272 |
|
273 |
/**
|
274 |
+
* Set table where clauses
|
275 |
*
|
276 |
* @param string $table Table name
|
277 |
* @param array $clauses Table clauses
|
278 |
* @return Ai1wm_Database
|
279 |
*/
|
280 |
+
public function set_table_where_clauses( $table, $clauses ) {
|
281 |
+
$this->table_where_clauses[ strtolower( $table ) ] = $clauses;
|
282 |
|
283 |
return $this;
|
284 |
}
|
285 |
|
286 |
/**
|
287 |
+
* Get table where clauses
|
288 |
*
|
289 |
* @param string $table Table name
|
290 |
+
* @return array
|
291 |
*/
|
292 |
+
public function get_table_where_clauses( $table ) {
|
293 |
+
if ( isset( $this->table_where_clauses[ strtolower( $table ) ] ) ) {
|
294 |
+
return $this->table_where_clauses[ strtolower( $table ) ];
|
295 |
}
|
296 |
+
|
297 |
+
return array();
|
298 |
}
|
299 |
|
300 |
/**
|
316 |
* Get table prefix columns
|
317 |
*
|
318 |
* @param string $table Table name
|
319 |
+
* @return array
|
320 |
*/
|
321 |
public function get_table_prefix_columns( $table ) {
|
322 |
if ( isset( $this->table_prefix_columns[ strtolower( $table ) ] ) ) {
|
323 |
return $this->table_prefix_columns[ strtolower( $table ) ];
|
324 |
}
|
325 |
+
|
326 |
+
return array();
|
327 |
}
|
328 |
|
329 |
/**
|
473 |
* Export database into a file
|
474 |
*
|
475 |
* @param string $file_name Name of file
|
476 |
+
* @param int $table_index Table index
|
477 |
+
* @param int $table_offset Table offset
|
478 |
+
* @param array $table_keys Table keys
|
479 |
* @param int $timeout Process timeout
|
480 |
* @return bool
|
481 |
*/
|
482 |
+
public function export( $file_name, &$table_index = 0, &$table_offset = 0, &$table_keys = array(), $timeout = 0 ) {
|
483 |
// Set file handler
|
484 |
$file_handler = ai1wm_open( $file_name, 'ab' );
|
485 |
|
486 |
// Write headers
|
487 |
+
if ( $table_index === 0 ) {
|
488 |
ai1wm_write( $file_handler, $this->get_header() );
|
489 |
}
|
490 |
|
498 |
$tables = $this->get_tables();
|
499 |
|
500 |
// Export tables
|
501 |
+
for ( ; $table_index < count( $tables ); $table_index++ ) {
|
502 |
|
503 |
// Get table name
|
504 |
+
$table_name = $tables[ $table_index ];
|
505 |
|
506 |
// Replace table name prefixes
|
507 |
$new_table_name = $this->replace_table_prefixes( $table_name, 0 );
|
508 |
|
509 |
+
// Get create table statement
|
510 |
+
if ( $table_offset === 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
|
512 |
// Write table drop statement
|
513 |
$drop_table = "\nDROP TABLE IF EXISTS `{$new_table_name}`;\n";
|
515 |
// Write table statement
|
516 |
ai1wm_write( $file_handler, $drop_table );
|
517 |
|
518 |
+
// Get create table statement
|
519 |
+
$create_table = $this->get_create_table( $table_name );
|
520 |
+
|
521 |
// Replace create table prefixes
|
522 |
+
$create_table = $this->replace_table_prefixes( $create_table, 14 );
|
523 |
|
524 |
// Replace table constraints
|
525 |
$create_table = $this->replace_table_constraints( $create_table );
|
527 |
// Replace create table options
|
528 |
$create_table = $this->replace_table_options( $create_table );
|
529 |
|
530 |
+
// Write table statement
|
531 |
ai1wm_write( $file_handler, $create_table );
|
532 |
|
533 |
// Write end of statement
|
534 |
ai1wm_write( $file_handler, ";\n\n" );
|
535 |
}
|
536 |
|
537 |
+
// Get primary or unique keys
|
538 |
+
$primary_keys = ( $primary_keys = $this->get_primary_keys( $table_name ) ) ? $primary_keys : $this->get_unique_keys( $table_name );
|
539 |
|
540 |
+
do {
|
|
|
541 |
|
542 |
+
// Set query
|
543 |
+
if ( $primary_keys ) {
|
544 |
|
545 |
+
// Set table where by keys
|
546 |
+
$table_where = array( 1 );
|
547 |
+
foreach ( $table_keys as $key => $value ) {
|
548 |
+
$table_where[] = sprintf( "`%s` > '%s'", $key, $value );
|
549 |
+
}
|
550 |
|
551 |
+
// Set table where by clauses
|
552 |
+
foreach ( $this->get_table_where_clauses( $table_name ) as $clause ) {
|
553 |
+
$table_where[] = $clause;
|
554 |
+
}
|
555 |
+
|
556 |
+
$table_where = implode( ' AND ', $table_where );
|
557 |
|
558 |
+
// Set table order (by primary or unique keys)
|
559 |
+
$table_order = array();
|
560 |
+
foreach ( $primary_keys as $key ) {
|
561 |
+
$table_order[] = sprintf( '`%s`', $key );
|
|
|
562 |
}
|
563 |
|
564 |
+
$table_order = implode( ', ', $table_order );
|
|
|
|
|
565 |
|
566 |
+
// Set query with rows count
|
567 |
+
$query = sprintf( 'SELECT * FROM `%s` WHERE %s ORDER BY %s LIMIT %d', $table_name, $table_where, $table_order, 1000 );
|
568 |
|
569 |
+
} else {
|
570 |
+
|
571 |
+
// Set table where by clauses
|
572 |
+
$table_where = array( 1 );
|
573 |
+
foreach ( $this->get_table_where_clauses( $table_name ) as $clause ) {
|
574 |
+
$table_where[] = $clause;
|
575 |
+
}
|
576 |
|
577 |
+
$table_where = implode( ' AND ', $table_where );
|
|
|
578 |
|
579 |
+
// Set table order (by first column)
|
580 |
+
$table_order = 1;
|
581 |
|
582 |
+
// Set query with offset and rows count
|
583 |
+
$query = sprintf( 'SELECT * FROM `%s` WHERE %s ORDER BY %s LIMIT %d, %d', $table_name, $table_where, $table_order, $table_offset, 1000 );
|
|
|
584 |
}
|
|
|
585 |
|
586 |
+
// Apply additional table prefix columns
|
587 |
+
$columns = $this->get_table_prefix_columns( $table_name );
|
588 |
+
|
589 |
+
// Get results
|
590 |
+
$result = $this->query( $query );
|
591 |
+
|
592 |
+
// Generate insert statements
|
593 |
+
if ( $num_rows = $this->num_rows( $result ) ) {
|
594 |
+
|
595 |
+
// Loop over table rows
|
596 |
+
while ( $row = $this->fetch_assoc( $result ) ) {
|
597 |
+
|
598 |
+
// Write start transaction
|
599 |
+
if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) {
|
600 |
+
ai1wm_write( $file_handler, "START TRANSACTION;\n" );
|
601 |
+
}
|
602 |
+
|
603 |
+
$items = array();
|
604 |
+
foreach ( $row as $key => $value ) {
|
605 |
+
// Replace table prefix columns
|
606 |
+
if ( isset( $columns[ strtolower( $key ) ] ) ) {
|
607 |
+
$value = $this->replace_table_prefixes( $value, 0 );
|
608 |
+
}
|
609 |
|
610 |
+
// Replace table values
|
611 |
+
$items[] = is_null( $value ) ? 'NULL' : "'" . $this->escape( $value ) . "'";
|
612 |
+
}
|
613 |
+
|
614 |
+
// Set table values
|
615 |
+
$table_values = implode( ',', $items );
|
616 |
+
|
617 |
+
// Set insert statement
|
618 |
+
$table_insert = "INSERT INTO `{$new_table_name}` VALUES ({$table_values});\n";
|
619 |
+
|
620 |
+
// Write insert statement
|
621 |
+
ai1wm_write( $file_handler, $table_insert );
|
622 |
+
|
623 |
+
// Set current table keys
|
624 |
+
foreach ( $primary_keys as $key ) {
|
625 |
+
$table_keys[ $key ] = $row[ $key ];
|
626 |
+
}
|
627 |
+
|
628 |
+
// Set current table rows
|
629 |
+
$table_offset++;
|
630 |
+
|
631 |
+
// Write end of transaction
|
632 |
+
if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION === 0 ) {
|
633 |
+
ai1wm_write( $file_handler, "COMMIT;\n" );
|
634 |
+
}
|
635 |
+
}
|
636 |
+
|
637 |
+
// Write end of transaction
|
638 |
+
if ( $table_offset % Ai1wm_Database::QUERIES_PER_TRANSACTION !== 0 ) {
|
639 |
+
ai1wm_write( $file_handler, "COMMIT;\n" );
|
640 |
+
}
|
641 |
+
} else {
|
642 |
|
643 |
+
// Set current table keys
|
644 |
+
$table_keys = array();
|
645 |
|
646 |
+
// Set current table offset
|
647 |
+
$table_offset = 0;
|
|
|
|
|
|
|
648 |
}
|
649 |
+
|
650 |
+
// Close result cursor
|
651 |
+
$this->free_result( $result );
|
652 |
+
|
653 |
+
// Time elapsed
|
654 |
+
if ( $timeout ) {
|
655 |
+
if ( ( microtime( true ) - $start ) > $timeout ) {
|
656 |
+
$completed = false;
|
657 |
+
break 2;
|
658 |
+
}
|
659 |
+
}
|
660 |
+
} while ( $num_rows > 0 );
|
661 |
}
|
662 |
|
663 |
// Close file handler
|
767 |
* @return string
|
768 |
*/
|
769 |
protected function get_version() {
|
|
|
|
|
770 |
$result = $this->query( "SHOW VARIABLES LIKE 'version'" );
|
771 |
+
$row = $this->fetch_assoc( $result );
|
|
|
|
|
|
|
|
|
|
|
772 |
|
773 |
// Close result cursor
|
774 |
$this->free_result( $result );
|
775 |
|
776 |
+
// Get version
|
777 |
+
if ( isset( $row['Value'] ) ) {
|
778 |
+
return $row['Value'];
|
779 |
+
}
|
780 |
}
|
781 |
|
782 |
/**
|
785 |
* @return int
|
786 |
*/
|
787 |
protected function get_max_allowed_packet() {
|
|
|
|
|
788 |
$result = $this->query( "SHOW VARIABLES LIKE 'max_allowed_packet'" );
|
789 |
+
$row = $this->fetch_assoc( $result );
|
|
|
|
|
|
|
|
|
|
|
790 |
|
791 |
// Close result cursor
|
792 |
$this->free_result( $result );
|
793 |
|
794 |
+
// Get max allowed packet
|
795 |
+
if ( isset( $row['Value'] ) ) {
|
796 |
+
return $row['Value'];
|
797 |
+
}
|
798 |
}
|
799 |
|
800 |
/**
|
804 |
* @return string
|
805 |
*/
|
806 |
protected function get_collation( $collation_name ) {
|
|
|
|
|
807 |
$result = $this->query( "SHOW COLLATION LIKE '{$collation_name}'" );
|
808 |
+
$row = $this->fetch_assoc( $result );
|
809 |
+
|
810 |
+
// Close result cursor
|
811 |
+
$this->free_result( $result );
|
812 |
+
|
813 |
+
// Get collation name
|
814 |
+
if ( isset( $row['Collation'] ) ) {
|
815 |
+
return $row['Collation'];
|
816 |
+
}
|
817 |
+
}
|
818 |
+
|
819 |
+
/**
|
820 |
+
* Get MySQL create table
|
821 |
+
*
|
822 |
+
* @param string $table_name Table name
|
823 |
+
* @return string
|
824 |
+
*/
|
825 |
+
protected function get_create_table( $table_name ) {
|
826 |
+
$result = $this->query( "SHOW CREATE TABLE `{$table_name}`" );
|
827 |
+
$row = $this->fetch_assoc( $result );
|
828 |
+
|
829 |
+
// Close result cursor
|
830 |
+
$this->free_result( $result );
|
831 |
+
|
832 |
+
// Get create table
|
833 |
+
if ( isset( $row['Create Table'] ) ) {
|
834 |
+
return $row['Create Table'];
|
835 |
+
}
|
836 |
+
}
|
837 |
+
|
838 |
+
/**
|
839 |
+
* Get MySQL primary keys
|
840 |
+
*
|
841 |
+
* @param string $table_name Table name
|
842 |
+
* @return array
|
843 |
+
*/
|
844 |
+
protected function get_primary_keys( $table_name ) {
|
845 |
+
$primary_keys = array();
|
846 |
+
|
847 |
+
// Get primary keys
|
848 |
+
$result = $this->query( "SHOW KEYS FROM `{$table_name}` WHERE Key_name = 'PRIMARY'" );
|
849 |
+
while ( $row = $this->fetch_assoc( $result ) ) {
|
850 |
+
if ( isset( $row['Column_name'] ) ) {
|
851 |
+
$primary_keys[] = $row['Column_name'];
|
852 |
}
|
853 |
}
|
854 |
|
855 |
// Close result cursor
|
856 |
$this->free_result( $result );
|
857 |
|
858 |
+
return $primary_keys;
|
859 |
+
}
|
860 |
+
|
861 |
+
/**
|
862 |
+
* Get MySQL unique keys
|
863 |
+
*
|
864 |
+
* @param string $table_name Table name
|
865 |
+
* @return array
|
866 |
+
*/
|
867 |
+
protected function get_unique_keys( $table_name ) {
|
868 |
+
$unique_keys = array();
|
869 |
+
|
870 |
+
// Get primary keys
|
871 |
+
$result = $this->query( "SHOW KEYS FROM `{$table_name}` WHERE Non_unique = 0" );
|
872 |
+
while ( $row = $this->fetch_assoc( $result ) ) {
|
873 |
+
if ( isset( $row['Column_name'] ) ) {
|
874 |
+
$unique_keys[] = $row['Column_name'];
|
875 |
+
}
|
876 |
+
}
|
877 |
+
|
878 |
+
// Close result cursor
|
879 |
+
$this->free_result( $result );
|
880 |
+
|
881 |
+
return $unique_keys;
|
882 |
}
|
883 |
|
884 |
/**
|
1216 |
*/
|
1217 |
abstract public function fetch_row( $result );
|
1218 |
|
1219 |
+
/**
|
1220 |
+
* Return the number for rows from MySQL results
|
1221 |
+
*
|
1222 |
+
* @param resource $result MySQL resource
|
1223 |
+
* @return int
|
1224 |
+
*/
|
1225 |
+
abstract public function num_rows( $result );
|
1226 |
+
|
1227 |
/**
|
1228 |
* Free MySQL result memory
|
1229 |
*
|
lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php
CHANGED
@@ -24,14 +24,13 @@
|
|
24 |
*/
|
25 |
|
26 |
class Ai1wm_File_Htaccess {
|
27 |
-
|
28 |
/**
|
29 |
* Create .htaccess file
|
30 |
*
|
31 |
* The method will create .htaccess file with contents 'AddType application/octet-stream .wpress'
|
32 |
*
|
33 |
-
* @param
|
34 |
-
* @return boolean
|
35 |
*/
|
36 |
public static function create( $path ) {
|
37 |
$contents = "<IfModule mod_mime.c>\n" .
|
24 |
*/
|
25 |
|
26 |
class Ai1wm_File_Htaccess {
|
|
|
27 |
/**
|
28 |
* Create .htaccess file
|
29 |
*
|
30 |
* The method will create .htaccess file with contents 'AddType application/octet-stream .wpress'
|
31 |
*
|
32 |
+
* @param string $path Path to the backups directory
|
33 |
+
* @return boolean
|
34 |
*/
|
35 |
public static function create( $path ) {
|
36 |
$contents = "<IfModule mod_mime.c>\n" .
|
lib/vendor/servmask/filesystem/class-ai1wm-file-index.php
CHANGED
@@ -32,10 +32,11 @@ class Ai1wm_File_Index {
|
|
32 |
* at the path specified by the argument.
|
33 |
*
|
34 |
* @param string $path Path to the index.php file
|
35 |
-
* @return boolean
|
36 |
*/
|
37 |
public static function create( $path ) {
|
38 |
$contents = '<?php // silence is golden';
|
|
|
39 |
return Ai1wm_File::create( $path, $contents );
|
40 |
}
|
41 |
}
|
32 |
* at the path specified by the argument.
|
33 |
*
|
34 |
* @param string $path Path to the index.php file
|
35 |
+
* @return boolean
|
36 |
*/
|
37 |
public static function create( $path ) {
|
38 |
$contents = '<?php // silence is golden';
|
39 |
+
|
40 |
return Ai1wm_File::create( $path, $contents );
|
41 |
}
|
42 |
}
|
lib/vendor/servmask/filesystem/class-ai1wm-file-webconfig.php
CHANGED
@@ -31,7 +31,7 @@ class Ai1wm_File_Webconfig {
|
|
31 |
* The method will create web.config file with contents '<mimeMap fileExtension=".wpress" mimeType="application/octet-stream" />'
|
32 |
*
|
33 |
* @param string $path Path to the web.config file
|
34 |
-
* @return boolean
|
35 |
*/
|
36 |
public static function create( $path ) {
|
37 |
$contents = "<configuration>\n" .
|
31 |
* The method will create web.config file with contents '<mimeMap fileExtension=".wpress" mimeType="application/octet-stream" />'
|
32 |
*
|
33 |
* @param string $path Path to the web.config file
|
34 |
+
* @return boolean
|
35 |
*/
|
36 |
public static function create( $path ) {
|
37 |
$contents = "<configuration>\n" .
|
lib/vendor/servmask/filesystem/class-ai1wm-file.php
CHANGED
@@ -28,21 +28,21 @@ class Ai1wm_File {
|
|
28 |
/**
|
29 |
* Create a file with contents
|
30 |
*
|
31 |
-
* The method will only create the file if it doesn't already exist.
|
32 |
-
*
|
33 |
* @param string $path Path to the file
|
34 |
* @param string $contents Contents of the file
|
35 |
*
|
36 |
-
* @return boolean
|
37 |
*/
|
38 |
public static function create( $path, $contents ) {
|
39 |
-
|
40 |
-
|
41 |
-
if (
|
42 |
-
|
43 |
}
|
44 |
-
|
45 |
-
|
46 |
}
|
|
|
|
|
47 |
}
|
48 |
}
|
28 |
/**
|
29 |
* Create a file with contents
|
30 |
*
|
|
|
|
|
31 |
* @param string $path Path to the file
|
32 |
* @param string $contents Contents of the file
|
33 |
*
|
34 |
+
* @return boolean
|
35 |
*/
|
36 |
public static function create( $path, $contents ) {
|
37 |
+
$is_written = false;
|
38 |
+
if ( ( $handle = @fopen( $path, 'w' ) ) !== false ) {
|
39 |
+
if ( @fwrite( $handle, $contents ) !== false ) {
|
40 |
+
$is_written = true;
|
41 |
}
|
42 |
+
|
43 |
+
@fclose( $handle );
|
44 |
}
|
45 |
+
|
46 |
+
return $is_written;
|
47 |
}
|
48 |
}
|
lib/view/main/admin-head.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<style type="text/css" media="all">
|
2 |
@font-face {
|
3 |
font-family: 'servmask';
|
4 |
-
src: url('<?php echo
|
5 |
-
src: url('<?php echo
|
6 |
-
url('<?php echo
|
7 |
-
url('<?php echo
|
8 |
-
url('<?php echo
|
9 |
font-weight: normal;
|
10 |
font-style: normal;
|
11 |
}
|
@@ -56,7 +56,7 @@
|
|
56 |
.toplevel_page_site-migration-export > div.wp-menu-image:before {
|
57 |
line-height: 27px !important;
|
58 |
content: '';
|
59 |
-
background: url('<?php echo
|
60 |
speak: none !important;
|
61 |
font-style: normal !important;
|
62 |
font-weight: normal !important;
|
@@ -73,7 +73,7 @@
|
|
73 |
position: relative;
|
74 |
display: inline-block;
|
75 |
content: '';
|
76 |
-
background: url('<?php echo
|
77 |
speak: none !important;
|
78 |
font-style: normal !important;
|
79 |
font-weight: normal !important;
|
1 |
<style type="text/css" media="all">
|
2 |
@font-face {
|
3 |
font-family: 'servmask';
|
4 |
+
src: url('<?php echo wp_make_link_relative( AI1WM_URL ); ?>/lib/view/assets/font/servmask.eot?v=<?php echo AI1WM_VERSION; ?>');
|
5 |
+
src: url('<?php echo wp_make_link_relative( AI1WM_URL ); ?>/lib/view/assets/font/servmask.eot?v=<?php echo AI1WM_VERSION; ?>#iefix') format('embedded-opentype'),
|
6 |
+
url('<?php echo wp_make_link_relative( AI1WM_URL ); ?>/lib/view/assets/font/servmask.woff?v=<?php echo AI1WM_VERSION; ?>') format('woff'),
|
7 |
+
url('<?php echo wp_make_link_relative( AI1WM_URL ); ?>/lib/view/assets/font/servmask.ttf?v=<?php echo AI1WM_VERSION; ?>') format('truetype'),
|
8 |
+
url('<?php echo wp_make_link_relative( AI1WM_URL ); ?>/lib/view/assets/font/servmask.svg?v=<?php echo AI1WM_VERSION; ?>#servmask') format('svg');
|
9 |
font-weight: normal;
|
10 |
font-style: normal;
|
11 |
}
|
56 |
.toplevel_page_site-migration-export > div.wp-menu-image:before {
|
57 |
line-height: 27px !important;
|
58 |
content: '';
|
59 |
+
background: url('<?php echo wp_make_link_relative( AI1WM_URL ); ?>/lib/view/assets/img/logo-20x20.png') no-repeat center center;
|
60 |
speak: none !important;
|
61 |
font-style: normal !important;
|
62 |
font-weight: normal !important;
|
73 |
position: relative;
|
74 |
display: inline-block;
|
75 |
content: '';
|
76 |
+
background: url('<?php echo wp_make_link_relative( AI1WM_URL ); ?>/lib/view/assets/img/logo-20x20.png') no-repeat center center;
|
77 |
speak: none !important;
|
78 |
font-style: normal !important;
|
79 |
font-weight: normal !important;
|
lib/view/main/backups-htaccess-notice.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="error">
|
2 |
+
<p>
|
3 |
+
<?php
|
4 |
+
printf(
|
5 |
+
__(
|
6 |
+
'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
|
7 |
+
'Try to change permissions of the parent folder or send us an email at ' .
|
8 |
+
'<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
|
9 |
+
AI1WM_PLUGIN_NAME
|
10 |
+
),
|
11 |
+
AI1WM_BACKUPS_HTACCESS
|
12 |
+
)
|
13 |
+
?>
|
14 |
+
</p>
|
15 |
+
</div>
|
lib/view/main/{index-notice.php → backups-index-notice.php}
RENAMED
@@ -8,7 +8,7 @@
|
|
8 |
'<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
|
9 |
AI1WM_PLUGIN_NAME
|
10 |
),
|
11 |
-
|
12 |
)
|
13 |
?>
|
14 |
</p>
|
8 |
'<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
|
9 |
AI1WM_PLUGIN_NAME
|
10 |
),
|
11 |
+
AI1WM_BACKUPS_INDEX
|
12 |
)
|
13 |
?>
|
14 |
</p>
|
lib/view/main/{backups-notice.php → backups-path-notice.php}
RENAMED
File without changes
|
lib/view/main/backups-webconfig-notice.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="error">
|
2 |
+
<p>
|
3 |
+
<?php
|
4 |
+
printf(
|
5 |
+
__(
|
6 |
+
'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
|
7 |
+
'Try to change permissions of the parent folder or send us an email at ' .
|
8 |
+
'<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
|
9 |
+
AI1WM_PLUGIN_NAME
|
10 |
+
),
|
11 |
+
AI1WM_BACKUPS_WEBCONFIG
|
12 |
+
)
|
13 |
+
?>
|
14 |
+
</p>
|
15 |
+
</div>
|
lib/view/main/storage-index-notice.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="error">
|
2 |
+
<p>
|
3 |
+
<?php
|
4 |
+
printf(
|
5 |
+
__(
|
6 |
+
'All in One WP Migration is not able to create <strong>%s</strong> file. ' .
|
7 |
+
'Try to change permissions of the parent folder or send us an email at ' .
|
8 |
+
'<a href="mailto:support@servmask.com">support@servmask.com</a> for assistance.',
|
9 |
+
AI1WM_PLUGIN_NAME
|
10 |
+
),
|
11 |
+
AI1WM_STORAGE_INDEX
|
12 |
+
)
|
13 |
+
?>
|
14 |
+
</p>
|
15 |
+
</div>
|
lib/view/main/{storage-notice.php → storage-path-notice.php}
RENAMED
File without changes
|
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.
|
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,16 @@ Alternatively you can download the plugin using the download button on this page
|
|
90 |
3. Plugin Menu
|
91 |
|
92 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
= 6.52 =
|
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.53
|
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.53 =
|
94 |
+
**Added**
|
95 |
+
|
96 |
+
* Warn the user when web server configuration files are not created
|
97 |
+
|
98 |
+
**Changed**
|
99 |
+
|
100 |
+
* Buffered queries instead of unbuffered queries
|
101 |
+
* Relative URLs instead of absolute URLs when loading fonts and images
|
102 |
+
|
103 |
= 6.52 =
|
104 |
**Changed**
|
105 |
|