All-in-One WP Migration - Version 4.0

Version Description

  • Fix file permission checks
Download this release

Release Info

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

Code changes from version 3.9 to 4.0

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: 3.9
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: 4.0
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
constants.php CHANGED
@@ -38,7 +38,7 @@ if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
38
  // ==================
39
  // = Plugin Version =
40
  // ==================
41
- define( 'AI1WM_VERSION', '3.9' );
42
 
43
  // ===============
44
  // = Plugin Name =
38
  // ==================
39
  // = Plugin Version =
40
  // ==================
41
+ define( 'AI1WM_VERSION', '4.0' );
42
 
43
  // ===============
44
  // = Plugin Name =
lib/model/class-ai1wm-export-abstract.php CHANGED
@@ -189,8 +189,12 @@ abstract class Ai1wm_Export_Abstract {
189
  $archive = new Ai1wm_Compressor( $this->storage()->archive() );
190
 
191
  while ( $path = trim( fgets( $filemap ) ) ) {
192
- // Add file to archive
193
- $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path );
 
 
 
 
194
 
195
  $processed++;
196
 
189
  $archive = new Ai1wm_Compressor( $this->storage()->archive() );
190
 
191
  while ( $path = trim( fgets( $filemap ) ) ) {
192
+ try {
193
+ // Add file to archive
194
+ $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path );
195
+ } catch ( Exception $e ) {
196
+ // Skip bad file permissions
197
+ }
198
 
199
  $processed++;
200
 
lib/model/class-ai1wm-import-abstract.php CHANGED
@@ -209,11 +209,15 @@ abstract class Ai1wm_Import_Abstract {
209
  $archive->set_file_pointer( null, $this->pointer() );
210
 
211
  while ( $archive->has_not_reached_eof() ) {
212
- // Extract a file from archive to wp_content_dir
213
- $archive->extract_one_file_to( WP_CONTENT_DIR, array(
214
- AI1WM_PACKAGE_NAME,
215
- AI1WM_DATABASE_NAME,
216
- ) );
 
 
 
 
217
 
218
  // Increment processed files counter
219
  $processed++;
209
  $archive->set_file_pointer( null, $this->pointer() );
210
 
211
  while ( $archive->has_not_reached_eof() ) {
212
+ try {
213
+ // Extract a file from archive to wp_content_dir
214
+ $archive->extract_one_file_to( WP_CONTENT_DIR, array(
215
+ AI1WM_PACKAGE_NAME,
216
+ AI1WM_DATABASE_NAME,
217
+ ) );
218
+ } catch ( Exception $e ) {
219
+ // Skip bad file permissions
220
+ }
221
 
222
  // Increment processed files counter
223
  $processed++;
lib/vendor/servmask/archiver/class-ai1wm-archiver.php CHANGED
@@ -137,20 +137,7 @@ abstract class Ai1wm_Archiver {
137
  // check if we have a handle
138
  if ( false === $file_handle ) {
139
  // we couldn't open the file
140
- throw new Ai1wm_Not_Accesible_Exception(
141
- sprintf(
142
- __(
143
- 'Unable to open %s<br /><br />' .
144
- '<strong>Possible solutions</strong><br />' .
145
- '1. Ensure that you have enough disk space on your server.<br />' .
146
- '2. Ensure that file permissions are correctly set-up - 775 or 777 to <strong>%s</strong> ' .
147
- 'directory and all files and folders that it contains.',
148
- AI1WM_PLUGIN_NAME
149
- ),
150
- $file,
151
- WP_CONTENT_DIR
152
- )
153
- );
154
  }
155
 
156
  return $file_handle;
@@ -168,13 +155,7 @@ abstract class Ai1wm_Archiver {
168
  protected function write_to_handle( $handle, $data, $file ) {
169
  $result = @fwrite( $handle, $data );
170
  if ( false === $result || ( ! empty( $data ) && 0 === $result ) ) {
171
- throw new Ai1wm_Not_Writable_Exception(
172
- __(
173
- 'Unable to write to ' . $file . '<br /><br />' .
174
- '<strong>Ensure that you have enough disk space on your server.</strong>',
175
- AI1WM_PLUGIN_NAME
176
- )
177
- );
178
  }
179
  }
180
 
@@ -191,7 +172,7 @@ abstract class Ai1wm_Archiver {
191
  protected function read_from_handle( $handle, $size, $file ) {
192
  $result = @fread( $handle, $size );
193
  if ( false === $result ) {
194
- throw new Ai1wm_Not_Readable_Exception( __( 'Unable to read from ' . $file, AI1WM_PLUGIN_NAME ) );
195
  }
196
 
197
  return $result;
@@ -228,7 +209,7 @@ abstract class Ai1wm_Archiver {
228
 
229
  if ( false === $result ) {
230
  // unable to close the file
231
- throw new Ai1wm_Not_Accesible_Exception( __( 'Unable to close ' . $this->filename, AI1WM_PLUGIN_NAME ) );
232
  }
233
  }
234
 
137
  // check if we have a handle
138
  if ( false === $file_handle ) {
139
  // we couldn't open the file
140
+ throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to open %s' . AI1WM_PLUGIN_NAME ), $file ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
 
143
  return $file_handle;
155
  protected function write_to_handle( $handle, $data, $file ) {
156
  $result = @fwrite( $handle, $data );
157
  if ( false === $result || ( ! empty( $data ) && 0 === $result ) ) {
158
+ throw new Ai1wm_Not_Writable_Exception( sprintf( __( 'Unable to write %s', AI1WM_PLUGIN_NAME ), $file ) );
 
 
 
 
 
 
159
  }
160
  }
161
 
172
  protected function read_from_handle( $handle, $size, $file ) {
173
  $result = @fread( $handle, $size );
174
  if ( false === $result ) {
175
+ throw new Ai1wm_Not_Readable_Exception( sprintf( __( 'Unable to read %s', AI1WM_PLUGIN_NAME ), $file ) );
176
  }
177
 
178
  return $result;
209
 
210
  if ( false === $result ) {
211
  // unable to close the file
212
+ throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to close %s', AI1WM_PLUGIN_NAME ), $this->filename ) );
213
  }
214
  }
215
 
lib/vendor/servmask/archiver/class-ai1wm-extractor.php CHANGED
@@ -116,7 +116,13 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
116
  mkdir( $path, 0755, true );
117
  }
118
 
119
- $this->extract_to( $path . DIRECTORY_SEPARATOR . $data['filename'], $data );
 
 
 
 
 
 
120
  }
121
 
122
  /**
@@ -155,8 +161,13 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
155
 
156
  // do we have a match?
157
  if ( in_array( $filename, $files ) ) {
158
- // we have a match, let's extract the file and remove it from the array
159
- $this->extract_to( $location . DIRECTORY_SEPARATOR . $data['filename'], $data );
 
 
 
 
 
160
 
161
  // let's unset the file from the files array
162
  $key = array_search( $data['filename'], $files );
116
  mkdir( $path, 0755, true );
117
  }
118
 
119
+ try {
120
+ $this->extract_to( $path . DIRECTORY_SEPARATOR . $data['filename'], $data );
121
+ } catch ( Exception $e ) {
122
+ // we don't have file permissions, skip file content
123
+ $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
124
+ return;
125
+ }
126
  }
127
 
128
  /**
161
 
162
  // do we have a match?
163
  if ( in_array( $filename, $files ) ) {
164
+ try {
165
+ // we have a match, let's extract the file and remove it from the array
166
+ $this->extract_to( $location . DIRECTORY_SEPARATOR . $data['filename'], $data );
167
+ } catch ( Exception $e ) {
168
+ // we don't have file permissions, skip file content
169
+ $this->set_file_pointer( $this->file_handle, $data['size'], $this->filename );
170
+ }
171
 
172
  // let's unset the file from the files array
173
  $key = array_search( $data['filename'], $files );
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.2
6
- Stable tag: 3.9
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.
@@ -57,6 +57,9 @@ All in One WP Plugin is the first plugin to offer true mobile experience on Word
57
  3. Plugin Menu
58
 
59
  == Changelog ==
 
 
 
60
  = 3.9 =
61
  * Fix could not resolve domain name on export/import
62
 
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.2
6
+ Stable tag: 4.0
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.
57
  3. Plugin Menu
58
 
59
  == Changelog ==
60
+ = 4.0 =
61
+ * Fix file permission checks
62
+
63
  = 3.9 =
64
  * Fix could not resolve domain name on export/import
65