Version Description
- Deactivate mu-plugins if fatal error appears on import
Download this release
Release Info
| Developer | bangelov |
| Plugin | |
| Version | 5.38 |
| Comparing to | |
| See all releases | |
Code changes from version 5.37 to 5.38
- all-in-one-wp-migration.php +1 -1
- constants.php +6 -1
- functions.php +14 -0
- lib/model/class-ai1wm-log.php +3 -3
- lib/model/export/class-ai1wm-export-clean.php +5 -10
- lib/model/import/class-ai1wm-import-clean.php +5 -10
- lib/model/import/class-ai1wm-import-content.php +1 -1
- lib/model/import/class-ai1wm-import-done.php +32 -2
- lib/model/import/class-ai1wm-import-validate.php +1 -1
- lib/vendor/servmask/archiver/class-ai1wm-extractor.php +42 -26
- lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php +40 -0
- lib/vendor/servmask/filesystem/class-ai1wm-file-index.php +1 -38
- lib/vendor/servmask/filesystem/class-ai1wm-file.php +48 -0
- loader.php +19 -3
- readme.txt +4 -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: 5.
|
| 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.38
|
| 9 |
* Text Domain: all-in-one-wp-migration
|
| 10 |
* Domain Path: /languages
|
| 11 |
* Network: True
|
constants.php
CHANGED
|
@@ -39,7 +39,7 @@ if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
|
|
| 39 |
// ==================
|
| 40 |
// = Plugin Version =
|
| 41 |
// ==================
|
| 42 |
-
define( 'AI1WM_VERSION', '5.
|
| 43 |
|
| 44 |
// ===============
|
| 45 |
// = Plugin Name =
|
|
@@ -161,6 +161,11 @@ define( 'AI1WM_STATUS_NAME', 'status.js' );
|
|
| 161 |
// ========================
|
| 162 |
define( 'AI1WM_FILEMAP_NAME', 'filemap.list' );
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
// ===================
|
| 165 |
// = Export Log Name =
|
| 166 |
// ===================
|
| 39 |
// ==================
|
| 40 |
// = Plugin Version =
|
| 41 |
// ==================
|
| 42 |
+
define( 'AI1WM_VERSION', '5.38' );
|
| 43 |
|
| 44 |
// ===============
|
| 45 |
// = Plugin Name =
|
| 161 |
// ========================
|
| 162 |
define( 'AI1WM_FILEMAP_NAME', 'filemap.list' );
|
| 163 |
|
| 164 |
+
// =================================
|
| 165 |
+
// = Archive Must-Use Plugins Name =
|
| 166 |
+
// =================================
|
| 167 |
+
define( 'AI1WM_MUPLUGINS_NAME', 'mu-plugins' );
|
| 168 |
+
|
| 169 |
// ===================
|
| 170 |
// = Export Log Name =
|
| 171 |
// ===================
|
functions.php
CHANGED
|
@@ -174,6 +174,20 @@ function ai1wm_status_path() {
|
|
| 174 |
return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WM_STATUS_NAME;
|
| 175 |
}
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
/**
|
| 178 |
* Get archive name
|
| 179 |
*
|
| 174 |
return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WM_STATUS_NAME;
|
| 175 |
}
|
| 176 |
|
| 177 |
+
/**
|
| 178 |
+
* Get WordPress content directory
|
| 179 |
+
*
|
| 180 |
+
* @param string $path Relative path
|
| 181 |
+
* @return string
|
| 182 |
+
*/
|
| 183 |
+
function ai1wm_content_path( $path = null ) {
|
| 184 |
+
if ( empty( $path ) ) {
|
| 185 |
+
return WP_CONTENT_DIR;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
/**
|
| 192 |
* Get archive name
|
| 193 |
*
|
lib/model/class-ai1wm-log.php
CHANGED
|
@@ -32,7 +32,7 @@ class Ai1wm_Log {
|
|
| 32 |
$data[] = date( 'M d Y H:i:s' );
|
| 33 |
|
| 34 |
// Add params
|
| 35 |
-
$data[] =
|
| 36 |
|
| 37 |
// Add empty line
|
| 38 |
$data[] = PHP_EOL;
|
|
@@ -53,7 +53,7 @@ class Ai1wm_Log {
|
|
| 53 |
$data[] = date( 'M d Y H:i:s' );
|
| 54 |
|
| 55 |
// Add params
|
| 56 |
-
$data[] =
|
| 57 |
|
| 58 |
// Add empty line
|
| 59 |
$data[] = PHP_EOL;
|
|
@@ -74,7 +74,7 @@ class Ai1wm_Log {
|
|
| 74 |
$data[] = date( 'M d Y H:i:s' );
|
| 75 |
|
| 76 |
// Add params
|
| 77 |
-
$data[] =
|
| 78 |
|
| 79 |
// Add empty line
|
| 80 |
$data[] = PHP_EOL;
|
| 32 |
$data[] = date( 'M d Y H:i:s' );
|
| 33 |
|
| 34 |
// Add params
|
| 35 |
+
$data[] = json_encode( $params );
|
| 36 |
|
| 37 |
// Add empty line
|
| 38 |
$data[] = PHP_EOL;
|
| 53 |
$data[] = date( 'M d Y H:i:s' );
|
| 54 |
|
| 55 |
// Add params
|
| 56 |
+
$data[] = json_encode( $params );
|
| 57 |
|
| 58 |
// Add empty line
|
| 59 |
$data[] = PHP_EOL;
|
| 74 |
$data[] = date( 'M d Y H:i:s' );
|
| 75 |
|
| 76 |
// Add params
|
| 77 |
+
$data[] = json_encode( $params );
|
| 78 |
|
| 79 |
// Add empty line
|
| 80 |
$data[] = PHP_EOL;
|
lib/model/export/class-ai1wm-export-clean.php
CHANGED
|
@@ -32,21 +32,16 @@ class Ai1wm_Export_Clean {
|
|
| 32 |
|
| 33 |
// Get storage iterator
|
| 34 |
$iterator = new RecursiveIteratorIterator(
|
| 35 |
-
new
|
| 36 |
RecursiveIteratorIterator::CHILD_FIRST
|
| 37 |
);
|
| 38 |
|
|
|
|
| 39 |
foreach ( $iterator as $item ) {
|
| 40 |
-
|
| 41 |
-
// Skip dots
|
| 42 |
-
if ( $iterator->isDot() ) {
|
| 43 |
-
continue;
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
if ( $item->isFile() ) {
|
| 47 |
-
unlink( $item->getPathname() );
|
| 48 |
-
} else {
|
| 49 |
rmdir( $item->getPathname() );
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
}
|
| 52 |
|
| 32 |
|
| 33 |
// Get storage iterator
|
| 34 |
$iterator = new RecursiveIteratorIterator(
|
| 35 |
+
new Ai1wm_Recursive_Directory_Iterator( ai1wm_storage_path( $params ) ),
|
| 36 |
RecursiveIteratorIterator::CHILD_FIRST
|
| 37 |
);
|
| 38 |
|
| 39 |
+
// Remove files and directories
|
| 40 |
foreach ( $iterator as $item ) {
|
| 41 |
+
if ( $item->isDir() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
rmdir( $item->getPathname() );
|
| 43 |
+
} else {
|
| 44 |
+
unlink( $item->getPathname() );
|
| 45 |
}
|
| 46 |
}
|
| 47 |
|
lib/model/import/class-ai1wm-import-clean.php
CHANGED
|
@@ -32,21 +32,16 @@ class Ai1wm_Import_Clean {
|
|
| 32 |
|
| 33 |
// Get storage iterator
|
| 34 |
$iterator = new RecursiveIteratorIterator(
|
| 35 |
-
new
|
| 36 |
RecursiveIteratorIterator::CHILD_FIRST
|
| 37 |
);
|
| 38 |
|
|
|
|
| 39 |
foreach ( $iterator as $item ) {
|
| 40 |
-
|
| 41 |
-
// Skip dots
|
| 42 |
-
if ( $iterator->isDot() ) {
|
| 43 |
-
continue;
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
if ( $item->isFile() ) {
|
| 47 |
-
unlink( $item->getPathname() );
|
| 48 |
-
} else {
|
| 49 |
rmdir( $item->getPathname() );
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
}
|
| 52 |
|
| 32 |
|
| 33 |
// Get storage iterator
|
| 34 |
$iterator = new RecursiveIteratorIterator(
|
| 35 |
+
new Ai1wm_Recursive_Directory_Iterator( ai1wm_storage_path( $params ) ),
|
| 36 |
RecursiveIteratorIterator::CHILD_FIRST
|
| 37 |
);
|
| 38 |
|
| 39 |
+
// Remove files and directories
|
| 40 |
foreach ( $iterator as $item ) {
|
| 41 |
+
if ( $item->isDir() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
rmdir( $item->getPathname() );
|
| 43 |
+
} else {
|
| 44 |
+
unlink( $item->getPathname() );
|
| 45 |
}
|
| 46 |
}
|
| 47 |
|
lib/model/import/class-ai1wm-import-content.php
CHANGED
|
@@ -101,7 +101,7 @@ class Ai1wm_Import_Content {
|
|
| 101 |
try {
|
| 102 |
|
| 103 |
// Extract a file from archive to WP_CONTENT_DIR
|
| 104 |
-
if ( ( $content_offset = $archive->extract_one_file_to( WP_CONTENT_DIR, array( AI1WM_PACKAGE_NAME, AI1WM_MULTISITE_NAME, AI1WM_DATABASE_NAME ), $old_paths, $new_paths, $content_offset, 3 ) ) ) {
|
| 105 |
|
| 106 |
// Set progress
|
| 107 |
if ( ( $sub_progress = ( $content_offset / $archive->get_current_filesize() ) ) < 1 ) {
|
| 101 |
try {
|
| 102 |
|
| 103 |
// Extract a file from archive to WP_CONTENT_DIR
|
| 104 |
+
if ( ( $content_offset = $archive->extract_one_file_to( WP_CONTENT_DIR, array( AI1WM_PACKAGE_NAME, AI1WM_MULTISITE_NAME, AI1WM_DATABASE_NAME, AI1WM_MUPLUGINS_NAME ), $old_paths, $new_paths, $content_offset, 3 ) ) ) {
|
| 105 |
|
| 106 |
// Set progress
|
| 107 |
if ( ( $sub_progress = ( $content_offset / $archive->get_current_filesize() ) ) < 1 ) {
|
lib/model/import/class-ai1wm-import-done.php
CHANGED
|
@@ -27,6 +27,38 @@ class Ai1wm_Import_Done {
|
|
| 27 |
|
| 28 |
public static function execute( $params ) {
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
// Get permalink URL
|
| 31 |
$permalink = admin_url( 'options-permalink.php#submit' );
|
| 32 |
|
|
@@ -43,7 +75,5 @@ class Ai1wm_Import_Done {
|
|
| 43 |
AI1WM_PLUGIN_NAME
|
| 44 |
)
|
| 45 |
);
|
| 46 |
-
|
| 47 |
-
return $params;
|
| 48 |
}
|
| 49 |
}
|
| 27 |
|
| 28 |
public static function execute( $params ) {
|
| 29 |
|
| 30 |
+
// Set shutdown handler
|
| 31 |
+
@register_shutdown_function( 'Ai1wm_Import_Done::shutdown' );
|
| 32 |
+
|
| 33 |
+
// Open the archive file for reading
|
| 34 |
+
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
|
| 35 |
+
|
| 36 |
+
// Unpack must-use plugins
|
| 37 |
+
$archive->extract_by_files_array( WP_CONTENT_DIR, array( AI1WM_MUPLUGINS_NAME ) );
|
| 38 |
+
|
| 39 |
+
// Close the archive file
|
| 40 |
+
$archive->close();
|
| 41 |
+
|
| 42 |
+
// Load must-use plugins
|
| 43 |
+
foreach ( wp_get_mu_plugins() as $mu_plugin ) {
|
| 44 |
+
include_once( $mu_plugin );
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
return $params;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public static function shutdown() {
|
| 51 |
+
$error = error_get_last();
|
| 52 |
+
|
| 53 |
+
// Deactivate must-use plugins on fatal errors
|
| 54 |
+
if ( $error ) {
|
| 55 |
+
if ( $error['type'] === E_ERROR && stripos( $error['file'], AI1WM_MUPLUGINS_NAME ) !== false ) {
|
| 56 |
+
if ( is_dir( ai1wm_content_path( AI1WM_MUPLUGINS_NAME ) ) ) {
|
| 57 |
+
@rename( ai1wm_content_path( AI1WM_MUPLUGINS_NAME ), sprintf( '%s-%s', ai1wm_content_path( AI1WM_MUPLUGINS_NAME ), date( 'YmdHis' ) ) );
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
// Get permalink URL
|
| 63 |
$permalink = admin_url( 'options-permalink.php#submit' );
|
| 64 |
|
| 75 |
AI1WM_PLUGIN_NAME
|
| 76 |
)
|
| 77 |
);
|
|
|
|
|
|
|
| 78 |
}
|
| 79 |
}
|
lib/model/import/class-ai1wm-import-validate.php
CHANGED
|
@@ -44,7 +44,7 @@ class Ai1wm_Import_Validate {
|
|
| 44 |
);
|
| 45 |
}
|
| 46 |
|
| 47 |
-
// Unpack package.json and database.sql files
|
| 48 |
$archive->extract_by_files_array(
|
| 49 |
ai1wm_storage_path( $params ),
|
| 50 |
array(
|
| 44 |
);
|
| 45 |
}
|
| 46 |
|
| 47 |
+
// Unpack package.json, multisite.json and database.sql files
|
| 48 |
$archive->extract_by_files_array(
|
| 49 |
ai1wm_storage_path( $params ),
|
| 50 |
array(
|
lib/vendor/servmask/archiver/class-ai1wm-extractor.php
CHANGED
|
@@ -76,14 +76,14 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
|
|
| 76 |
}
|
| 77 |
|
| 78 |
public function extract_one_file_to( $location, $exclude = array(), $old_paths = array(), $new_paths = array(), $offset = 0, $timeout = 0 ) {
|
| 79 |
-
if ( false ===
|
| 80 |
throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
|
| 81 |
}
|
| 82 |
|
| 83 |
$block = $this->read_from_handle( $this->file_handle, 4377, $this->filename );
|
| 84 |
|
|
|
|
| 85 |
if ( $block === $this->eof ) {
|
| 86 |
-
// we reached end of file, set the pointer to the end of the file so that feof returns true
|
| 87 |
@fseek( $this->file_handle, 1, SEEK_END );
|
| 88 |
@fgetc( $this->file_handle );
|
| 89 |
return;
|
|
@@ -99,15 +99,19 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
|
|
| 99 |
$filename = $data['path'] . '/' . $data['filename'];
|
| 100 |
}
|
| 101 |
|
| 102 |
-
//
|
| 103 |
-
|
| 104 |
-
// we don't have a match, skip file content
|
| 105 |
-
$this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
|
| 106 |
-
return;
|
| 107 |
-
}
|
| 108 |
|
| 109 |
// we need to build the path for the file
|
| 110 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
// replace extract paths
|
| 113 |
for ( $i = 0; $i < count( $old_paths ); $i++ ) {
|
|
@@ -117,17 +121,14 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
|
|
| 117 |
}
|
| 118 |
}
|
| 119 |
|
| 120 |
-
// append prepend extract location
|
| 121 |
-
$path = $location . DIRECTORY_SEPARATOR . $path;
|
| 122 |
-
|
| 123 |
// check if location doesn't exist, then create it
|
| 124 |
-
if ( false ===
|
| 125 |
-
mkdir( $path, 0755, true );
|
| 126 |
}
|
| 127 |
|
| 128 |
try {
|
| 129 |
// we have a match, let's extract the file
|
| 130 |
-
if ( ( $offset = $this->extract_to( $
|
| 131 |
return $offset;
|
| 132 |
}
|
| 133 |
} catch ( Exception $e ) {
|
|
@@ -143,15 +144,12 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
|
|
| 143 |
* @param array $files Files to extract
|
| 144 |
*/
|
| 145 |
public function extract_by_files_array( $location, $files = array(), $offset = 0, $timeout = 0 ) {
|
| 146 |
-
if ( false ===
|
| 147 |
throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
|
| 148 |
}
|
| 149 |
|
| 150 |
// we read until we reached the end of the file, or the files we were looking for were found
|
| 151 |
-
while (
|
| 152 |
-
($block = $this->read_from_handle( $this->file_handle, 4377, $this->filename )) &&
|
| 153 |
-
( count( $files ) > 0 )
|
| 154 |
-
) {
|
| 155 |
// end block has been reached and we still have files to extract
|
| 156 |
// that means the files don't exist in the archive
|
| 157 |
if ( $block === $this->eof ) {
|
|
@@ -170,21 +168,39 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
|
|
| 170 |
$filename = $data['path'] . '/' . $data['filename'];
|
| 171 |
}
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
// do we have a match?
|
| 174 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
try {
|
| 176 |
// we have a match, let's extract the file and remove it from the array
|
| 177 |
-
if ( ( $offset = $this->extract_to( $location . DIRECTORY_SEPARATOR . $
|
| 178 |
return $offset;
|
| 179 |
}
|
| 180 |
} catch ( Exception $e ) {
|
| 181 |
// we don't have file permissions, skip file content
|
| 182 |
$this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
|
| 183 |
}
|
| 184 |
-
|
| 185 |
-
// let's unset the file from the files array
|
| 186 |
-
$key = array_search( $data['filename'], $files );
|
| 187 |
-
unset( $files[$key] );
|
| 188 |
} else {
|
| 189 |
// we don't have a match, skip file content
|
| 190 |
$this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
|
| 76 |
}
|
| 77 |
|
| 78 |
public function extract_one_file_to( $location, $exclude = array(), $old_paths = array(), $new_paths = array(), $offset = 0, $timeout = 0 ) {
|
| 79 |
+
if ( false === is_dir( $location ) ) {
|
| 80 |
throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
|
| 81 |
}
|
| 82 |
|
| 83 |
$block = $this->read_from_handle( $this->file_handle, 4377, $this->filename );
|
| 84 |
|
| 85 |
+
// we reached end of file, set the pointer to the end of the file so that feof returns true
|
| 86 |
if ( $block === $this->eof ) {
|
|
|
|
| 87 |
@fseek( $this->file_handle, 1, SEEK_END );
|
| 88 |
@fgetc( $this->file_handle );
|
| 89 |
return;
|
| 99 |
$filename = $data['path'] . '/' . $data['filename'];
|
| 100 |
}
|
| 101 |
|
| 102 |
+
// we need to build the path
|
| 103 |
+
$path = str_replace( '/', DIRECTORY_SEPARATOR, $data['path'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
// we need to build the path for the file
|
| 106 |
+
$filename = str_replace( '/', DIRECTORY_SEPARATOR, $filename );
|
| 107 |
+
|
| 108 |
+
// should we skip this file?
|
| 109 |
+
for ( $i = 0; $i < count( $exclude ); $i++ ) {
|
| 110 |
+
if ( strpos( $filename . DIRECTORY_SEPARATOR, $exclude[$i] . DIRECTORY_SEPARATOR ) === 0 ) {
|
| 111 |
+
$this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
|
| 112 |
+
return;
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
|
| 116 |
// replace extract paths
|
| 117 |
for ( $i = 0; $i < count( $old_paths ); $i++ ) {
|
| 121 |
}
|
| 122 |
}
|
| 123 |
|
|
|
|
|
|
|
|
|
|
| 124 |
// check if location doesn't exist, then create it
|
| 125 |
+
if ( false === is_dir( $location . DIRECTORY_SEPARATOR . $path ) ) {
|
| 126 |
+
mkdir( $location . DIRECTORY_SEPARATOR . $path, 0755, true );
|
| 127 |
}
|
| 128 |
|
| 129 |
try {
|
| 130 |
// we have a match, let's extract the file
|
| 131 |
+
if ( ( $offset = $this->extract_to( $location . DIRECTORY_SEPARATOR . $filename, $data, $offset, $timeout ) ) ) {
|
| 132 |
return $offset;
|
| 133 |
}
|
| 134 |
} catch ( Exception $e ) {
|
| 144 |
* @param array $files Files to extract
|
| 145 |
*/
|
| 146 |
public function extract_by_files_array( $location, $files = array(), $offset = 0, $timeout = 0 ) {
|
| 147 |
+
if ( false === is_dir( $location ) ) {
|
| 148 |
throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
|
| 149 |
}
|
| 150 |
|
| 151 |
// we read until we reached the end of the file, or the files we were looking for were found
|
| 152 |
+
while ( ( $block = $this->read_from_handle( $this->file_handle, 4377, $this->filename ) ) ) {
|
|
|
|
|
|
|
|
|
|
| 153 |
// end block has been reached and we still have files to extract
|
| 154 |
// that means the files don't exist in the archive
|
| 155 |
if ( $block === $this->eof ) {
|
| 168 |
$filename = $data['path'] . '/' . $data['filename'];
|
| 169 |
}
|
| 170 |
|
| 171 |
+
// we need to build the path
|
| 172 |
+
$path = str_replace( '/', DIRECTORY_SEPARATOR, $data['path'] );
|
| 173 |
+
|
| 174 |
+
// we need to build the path for the file
|
| 175 |
+
$filename = str_replace( '/', DIRECTORY_SEPARATOR, $filename );
|
| 176 |
+
|
| 177 |
+
// set include flag
|
| 178 |
+
$include = false;
|
| 179 |
+
|
| 180 |
+
// files to extract
|
| 181 |
+
for ( $i = 0; $i < count( $files ); $i++ ) {
|
| 182 |
+
if ( strpos( $filename . DIRECTORY_SEPARATOR, $files[$i] . DIRECTORY_SEPARATOR ) === 0 ) {
|
| 183 |
+
$include = true;
|
| 184 |
+
break;
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
// do we have a match?
|
| 189 |
+
if ( $include ) {
|
| 190 |
+
// check if location doesn't exist, then create it
|
| 191 |
+
if ( false === is_dir( $location . DIRECTORY_SEPARATOR . $path ) ) {
|
| 192 |
+
mkdir( $location . DIRECTORY_SEPARATOR . $path, 0755, true );
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
try {
|
| 196 |
// we have a match, let's extract the file and remove it from the array
|
| 197 |
+
if ( ( $offset = $this->extract_to( $location . DIRECTORY_SEPARATOR . $filename, $data, $offset, $timeout ) ) ) {
|
| 198 |
return $offset;
|
| 199 |
}
|
| 200 |
} catch ( Exception $e ) {
|
| 201 |
// we don't have file permissions, skip file content
|
| 202 |
$this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
|
| 203 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
} else {
|
| 205 |
// we don't have a match, skip file content
|
| 206 |
$this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
|
lib/vendor/servmask/filesystem/class-ai1wm-file-htaccess.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Copyright (C) 2014-2016 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_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 string $path Path to the .htaccess file
|
| 34 |
+
* @return boolean|null
|
| 35 |
+
*/
|
| 36 |
+
public static function create( $path ) {
|
| 37 |
+
$contents = "<IfModule mod_mime.c>\nAddType application/octet-stream .wpress\n</IfModule>";
|
| 38 |
+
return Ai1wm_File::create( $path, $contents );
|
| 39 |
+
}
|
| 40 |
+
}
|
lib/vendor/servmask/filesystem/class-ai1wm-file-index.php
CHANGED
|
@@ -23,30 +23,8 @@
|
|
| 23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
| 24 |
*/
|
| 25 |
|
| 26 |
-
class Ai1wm_File {
|
| 27 |
-
/**
|
| 28 |
-
* Create a file with contents
|
| 29 |
-
*
|
| 30 |
-
* The method will only create the file if it doesn't already exist.
|
| 31 |
-
*
|
| 32 |
-
* @param string $path Path to the file
|
| 33 |
-
* @param string $contents Contents of the file
|
| 34 |
-
*
|
| 35 |
-
* @return boolean|null
|
| 36 |
-
*/
|
| 37 |
-
public static function create( $path, $contents ) {
|
| 38 |
-
if ( ! is_file( $path ) ) {
|
| 39 |
-
$handle = fopen( $path, 'w' );
|
| 40 |
-
if ( false === $handle ) {
|
| 41 |
-
return false;
|
| 42 |
-
}
|
| 43 |
-
fwrite( $handle, $contents );
|
| 44 |
-
fclose( $handle );
|
| 45 |
-
}
|
| 46 |
-
}
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
class Ai1wm_File_Index {
|
|
|
|
| 50 |
/**
|
| 51 |
* Create a index.php file
|
| 52 |
*
|
|
@@ -61,18 +39,3 @@ class Ai1wm_File_Index {
|
|
| 61 |
return Ai1wm_File::create( $path, $contents );
|
| 62 |
}
|
| 63 |
}
|
| 64 |
-
|
| 65 |
-
class Ai1wm_File_Htaccess {
|
| 66 |
-
/**
|
| 67 |
-
* Create .htaccess file
|
| 68 |
-
*
|
| 69 |
-
* The method will create .htaccess file with contents 'AddType application/octet-stream .wpress'
|
| 70 |
-
*
|
| 71 |
-
* @param string $path Path to the .htaccess file
|
| 72 |
-
* @return boolean|null
|
| 73 |
-
*/
|
| 74 |
-
public static function create( $path ) {
|
| 75 |
-
$contents = "<IfModule mod_mime.c>\nAddType application/octet-stream .wpress\n</IfModule>";
|
| 76 |
-
return Ai1wm_File::create( $path, $contents );
|
| 77 |
-
}
|
| 78 |
-
}
|
| 23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
| 24 |
*/
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
class Ai1wm_File_Index {
|
| 27 |
+
|
| 28 |
/**
|
| 29 |
* Create a index.php file
|
| 30 |
*
|
| 39 |
return Ai1wm_File::create( $path, $contents );
|
| 40 |
}
|
| 41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/vendor/servmask/filesystem/class-ai1wm-file.php
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Copyright (C) 2014-2016 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_File {
|
| 27 |
+
|
| 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|null
|
| 37 |
+
*/
|
| 38 |
+
public static function create( $path, $contents ) {
|
| 39 |
+
if ( ! is_file( $path ) ) {
|
| 40 |
+
$handle = fopen( $path, 'w' );
|
| 41 |
+
if ( false === $handle ) {
|
| 42 |
+
return false;
|
| 43 |
+
}
|
| 44 |
+
fwrite( $handle, $contents );
|
| 45 |
+
fclose( $handle );
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
loader.php
CHANGED
|
@@ -34,6 +34,14 @@ require_once AI1WM_VENDOR_PATH .
|
|
| 34 |
DIRECTORY_SEPARATOR .
|
| 35 |
'Bandar.php';
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
require_once AI1WM_VENDOR_PATH .
|
| 38 |
DIRECTORY_SEPARATOR .
|
| 39 |
'servmask' .
|
|
@@ -42,6 +50,14 @@ require_once AI1WM_VENDOR_PATH .
|
|
| 42 |
DIRECTORY_SEPARATOR .
|
| 43 |
'class-ai1wm-file-index.php';
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
require_once AI1WM_VENDOR_PATH .
|
| 46 |
DIRECTORY_SEPARATOR .
|
| 47 |
'servmask' .
|
|
@@ -268,7 +284,7 @@ require_once AI1WM_MODEL_PATH .
|
|
| 268 |
|
| 269 |
require_once AI1WM_MODEL_PATH .
|
| 270 |
DIRECTORY_SEPARATOR .
|
| 271 |
-
'class-ai1wm-
|
| 272 |
|
| 273 |
require_once AI1WM_MODEL_PATH .
|
| 274 |
DIRECTORY_SEPARATOR .
|
|
@@ -276,11 +292,11 @@ require_once AI1WM_MODEL_PATH .
|
|
| 276 |
|
| 277 |
require_once AI1WM_MODEL_PATH .
|
| 278 |
DIRECTORY_SEPARATOR .
|
| 279 |
-
'class-ai1wm-
|
| 280 |
|
| 281 |
require_once AI1WM_MODEL_PATH .
|
| 282 |
DIRECTORY_SEPARATOR .
|
| 283 |
-
'class-ai1wm-
|
| 284 |
|
| 285 |
require_once AI1WM_EXCEPTION_PATH .
|
| 286 |
DIRECTORY_SEPARATOR .
|
| 34 |
DIRECTORY_SEPARATOR .
|
| 35 |
'Bandar.php';
|
| 36 |
|
| 37 |
+
require_once AI1WM_VENDOR_PATH .
|
| 38 |
+
DIRECTORY_SEPARATOR .
|
| 39 |
+
'servmask' .
|
| 40 |
+
DIRECTORY_SEPARATOR .
|
| 41 |
+
'filesystem' .
|
| 42 |
+
DIRECTORY_SEPARATOR .
|
| 43 |
+
'class-ai1wm-file.php';
|
| 44 |
+
|
| 45 |
require_once AI1WM_VENDOR_PATH .
|
| 46 |
DIRECTORY_SEPARATOR .
|
| 47 |
'servmask' .
|
| 50 |
DIRECTORY_SEPARATOR .
|
| 51 |
'class-ai1wm-file-index.php';
|
| 52 |
|
| 53 |
+
require_once AI1WM_VENDOR_PATH .
|
| 54 |
+
DIRECTORY_SEPARATOR .
|
| 55 |
+
'servmask' .
|
| 56 |
+
DIRECTORY_SEPARATOR .
|
| 57 |
+
'filesystem' .
|
| 58 |
+
DIRECTORY_SEPARATOR .
|
| 59 |
+
'class-ai1wm-file-htaccess.php';
|
| 60 |
+
|
| 61 |
require_once AI1WM_VENDOR_PATH .
|
| 62 |
DIRECTORY_SEPARATOR .
|
| 63 |
'servmask' .
|
| 284 |
|
| 285 |
require_once AI1WM_MODEL_PATH .
|
| 286 |
DIRECTORY_SEPARATOR .
|
| 287 |
+
'class-ai1wm-log.php';
|
| 288 |
|
| 289 |
require_once AI1WM_MODEL_PATH .
|
| 290 |
DIRECTORY_SEPARATOR .
|
| 292 |
|
| 293 |
require_once AI1WM_MODEL_PATH .
|
| 294 |
DIRECTORY_SEPARATOR .
|
| 295 |
+
'class-ai1wm-http.php';
|
| 296 |
|
| 297 |
require_once AI1WM_MODEL_PATH .
|
| 298 |
DIRECTORY_SEPARATOR .
|
| 299 |
+
'class-ai1wm-streams.php';
|
| 300 |
|
| 301 |
require_once AI1WM_EXCEPTION_PATH .
|
| 302 |
DIRECTORY_SEPARATOR .
|
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.4
|
| 6 |
-
Stable tag: 5.
|
| 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.
|
|
@@ -75,6 +75,9 @@ All in One WP Plugin is the first plugin to offer true mobile experience on Word
|
|
| 75 |
3. Plugin Menu
|
| 76 |
|
| 77 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
| 78 |
= 5.37 =
|
| 79 |
* Validate the archive before import
|
| 80 |
|
| 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.4
|
| 6 |
+
Stable tag: 5.38
|
| 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.
|
| 75 |
3. Plugin Menu
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
+
= 5.38 =
|
| 79 |
+
* Deactivate mu-plugins if fatal error appears on import
|
| 80 |
+
|
| 81 |
= 5.37 =
|
| 82 |
* Validate the archive before import
|
| 83 |
|
