All-in-One WP Migration - Version 7.45

Version Description

Added

  • Support custom plugins directory
Download this release

Release Info

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

Code changes from version 7.44 to 7.45

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: 7.44
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: 7.45
9
  * Text Domain: all-in-one-wp-migration
10
  * Domain Path: /languages
11
  * Network: True
constants.php CHANGED
@@ -35,7 +35,7 @@ define( 'AI1WM_DEBUG', false );
35
  // ==================
36
  // = Plugin Version =
37
  // ==================
38
- define( 'AI1WM_VERSION', '7.44' );
39
 
40
  // ===============
41
  // = Plugin Name =
@@ -157,6 +157,11 @@ define( 'AI1WM_CONTENT_LIST_NAME', 'content.list' );
157
  // ===========================
158
  define( 'AI1WM_MEDIA_LIST_NAME', 'media.list' );
159
 
 
 
 
 
 
160
  // ============================
161
  // = Archive Tables List Name =
162
  // ============================
@@ -182,6 +187,11 @@ define( 'AI1WM_LESS_CACHE_NAME', '.less.cache' );
182
  // ============================
183
  define( 'AI1WM_ELEMENTOR_CSS_NAME', 'uploads' . DIRECTORY_SEPARATOR . 'elementor' . DIRECTORY_SEPARATOR . 'css' );
184
 
 
 
 
 
 
185
  // =============================
186
  // = Endurance Page Cache Name =
187
  // =============================
35
  // ==================
36
  // = Plugin Version =
37
  // ==================
38
+ define( 'AI1WM_VERSION', '7.45' );
39
 
40
  // ===============
41
  // = Plugin Name =
157
  // ===========================
158
  define( 'AI1WM_MEDIA_LIST_NAME', 'media.list' );
159
 
160
+ // =============================
161
+ // = Archive Plugins List Name =
162
+ // =============================
163
+ define( 'AI1WM_PLUGINS_LIST_NAME', 'plugins.list' );
164
+
165
  // ============================
166
  // = Archive Tables List Name =
167
  // ============================
187
  // ============================
188
  define( 'AI1WM_ELEMENTOR_CSS_NAME', 'uploads' . DIRECTORY_SEPARATOR . 'elementor' . DIRECTORY_SEPARATOR . 'css' );
189
 
190
+ // =========================
191
+ // = Themes Functions Name =
192
+ // =========================
193
+ define( 'AI1WM_THEMES_FUNCTIONS_NAME', 'themes' . DIRECTORY_SEPARATOR . 'functions.php' );
194
+
195
  // =============================
196
  // = Endurance Page Cache Name =
197
  // =============================
functions.php CHANGED
@@ -120,6 +120,16 @@ function ai1wm_media_list_path( $params ) {
120
  return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MEDIA_LIST_NAME;
121
  }
122
 
 
 
 
 
 
 
 
 
 
 
123
  /**
124
  * Get tables.list absolute path
125
  *
@@ -762,166 +772,34 @@ function ai1wm_content_filters( $filters = array() ) {
762
  * @return array
763
  */
764
  function ai1wm_plugin_filters( $filters = array() ) {
765
- // WP Migration Plugin
766
- if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
767
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WM_PLUGIN_BASENAME );
768
- } else {
769
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration';
770
- }
771
-
772
- // Microsoft Azure Extension
773
- if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) {
774
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMZE_PLUGIN_BASENAME );
775
- } else {
776
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-azure-storage-extension';
777
- }
778
-
779
- // Backblaze B2 Extension
780
- if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) {
781
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMAE_PLUGIN_BASENAME );
782
- } else {
783
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-b2-extension';
784
- }
785
-
786
- // Backup Plugin
787
- if ( defined( 'AI1WMVE_PLUGIN_BASENAME' ) ) {
788
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMVE_PLUGIN_BASENAME );
789
- } else {
790
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-backup';
791
- }
792
-
793
- // Box Extension
794
- if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) {
795
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMBE_PLUGIN_BASENAME );
796
- } else {
797
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-box-extension';
798
- }
799
-
800
- // DigitalOcean Spaces Extension
801
- if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) {
802
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMIE_PLUGIN_BASENAME );
803
- } else {
804
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-digitalocean-extension';
805
- }
806
-
807
- // Direct Extension
808
- if ( defined( 'AI1WMXE_PLUGIN_BASENAME' ) ) {
809
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMXE_PLUGIN_BASENAME );
810
- } else {
811
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-direct-extension';
812
- }
813
-
814
- // Dropbox Extension
815
- if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) {
816
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMDE_PLUGIN_BASENAME );
817
- } else {
818
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-dropbox-extension';
819
- }
820
-
821
- // File Extension
822
- if ( defined( 'AI1WMTE_PLUGIN_BASENAME' ) ) {
823
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMTE_PLUGIN_BASENAME );
824
- } else {
825
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-file-extension';
826
- }
827
-
828
- // FTP Extension
829
- if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) {
830
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMFE_PLUGIN_BASENAME );
831
- } else {
832
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-ftp-extension';
833
- }
834
-
835
- // Google Cloud Storage Extension
836
- if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) {
837
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMCE_PLUGIN_BASENAME );
838
- } else {
839
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gcloud-storage-extension';
840
- }
841
-
842
- // Google Drive Extension
843
- if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) {
844
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMGE_PLUGIN_BASENAME );
845
- } else {
846
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gdrive-extension';
847
- }
848
-
849
- // Amazon Glacier Extension
850
- if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) {
851
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMRE_PLUGIN_BASENAME );
852
- } else {
853
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-glacier-extension';
854
- }
855
-
856
- // Mega Extension
857
- if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) {
858
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMEE_PLUGIN_BASENAME );
859
- } else {
860
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-mega-extension';
861
- }
862
-
863
- // Multisite Extension
864
- if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) {
865
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMME_PLUGIN_BASENAME );
866
- } else {
867
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-multisite-extension';
868
- }
869
-
870
- // OneDrive Extension
871
- if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) {
872
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMOE_PLUGIN_BASENAME );
873
- } else {
874
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-onedrive-extension';
875
- }
876
-
877
- // pCloud Extension
878
- if ( defined( 'AI1WMPE_PLUGIN_BASENAME' ) ) {
879
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMPE_PLUGIN_BASENAME );
880
- } else {
881
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-pcloud-extension';
882
- }
883
-
884
- // Pro Plugin
885
- if ( defined( 'AI1WMKE_PLUGIN_BASENAME' ) ) {
886
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMKE_PLUGIN_BASENAME );
887
- } else {
888
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-pro';
889
- }
890
-
891
- // S3 Client Extension
892
- if ( defined( 'AI1WNE_PLUGIN_BASENAME' ) ) {
893
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMNE_PLUGIN_BASENAME );
894
- } else {
895
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-s3-client-extension';
896
- }
897
-
898
- // Amazon S3 Extension
899
- if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) {
900
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMSE_PLUGIN_BASENAME );
901
- } else {
902
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-s3-extension';
903
- }
904
-
905
- // Unlimited Extension
906
- if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) {
907
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMUE_PLUGIN_BASENAME );
908
- } else {
909
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-unlimited-extension';
910
- }
911
-
912
- // URL Extension
913
- if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) {
914
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMLE_PLUGIN_BASENAME );
915
- } else {
916
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-url-extension';
917
- }
918
-
919
- // WebDAV Extension
920
- if ( defined( 'AI1WMWE_PLUGIN_BASENAME' ) ) {
921
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMWE_PLUGIN_BASENAME );
922
- } else {
923
- $filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-webdav-extension';
924
- }
925
 
926
  return $filters;
927
  }
@@ -1734,6 +1612,15 @@ function ai1wm_get_filters( $tag ) {
1734
  return $filters;
1735
  }
1736
 
 
 
 
 
 
 
 
 
 
1737
  /**
1738
  * Get WordPress uploads directory
1739
  *
120
  return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MEDIA_LIST_NAME;
121
  }
122
 
123
+ /**
124
+ * Get plugins.list absolute path
125
+ *
126
+ * @param array $params Request parameters
127
+ * @return string
128
+ */
129
+ function ai1wm_plugins_list_path( $params ) {
130
+ return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_PLUGINS_LIST_NAME;
131
+ }
132
+
133
  /**
134
  * Get tables.list absolute path
135
  *
772
  * @return array
773
  */
774
  function ai1wm_plugin_filters( $filters = array() ) {
775
+ return array_merge(
776
+ $filters,
777
+ array(
778
+ AI1WM_PLUGIN_BASEDIR,
779
+ AI1WMZE_PLUGIN_BASEDIR,
780
+ AI1WMAE_PLUGIN_BASEDIR,
781
+ AI1WMVE_PLUGIN_BASEDIR,
782
+ AI1WMBE_PLUGIN_BASEDIR,
783
+ AI1WMIE_PLUGIN_BASEDIR,
784
+ AI1WMXE_PLUGIN_BASEDIR,
785
+ AI1WMDE_PLUGIN_BASEDIR,
786
+ AI1WMTE_PLUGIN_BASEDIR,
787
+ AI1WMFE_PLUGIN_BASEDIR,
788
+ AI1WMCE_PLUGIN_BASEDIR,
789
+ AI1WMGE_PLUGIN_BASEDIR,
790
+ AI1WMRE_PLUGIN_BASEDIR,
791
+ AI1WMEE_PLUGIN_BASEDIR,
792
+ AI1WMME_PLUGIN_BASEDIR,
793
+ AI1WMOE_PLUGIN_BASEDIR,
794
+ AI1WMPE_PLUGIN_BASEDIR,
795
+ AI1WMKE_PLUGIN_BASEDIR,
796
+ AI1WMNE_PLUGIN_BASEDIR,
797
+ AI1WMSE_PLUGIN_BASEDIR,
798
+ AI1WMUE_PLUGIN_BASEDIR,
799
+ AI1WMLE_PLUGIN_BASEDIR,
800
+ AI1WMWE_PLUGIN_BASEDIR,
801
+ )
802
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
803
 
804
  return $filters;
805
  }
1612
  return $filters;
1613
  }
1614
 
1615
+ /**
1616
+ * Get WordPress plugins directory
1617
+ *
1618
+ * @return string
1619
+ */
1620
+ function ai1wm_get_plugins_dir() {
1621
+ return untrailingslashit( WP_PLUGIN_DIR );
1622
+ }
1623
+
1624
  /**
1625
  * Get WordPress uploads directory
1626
  *
lib/controller/class-ai1wm-main-controller.php CHANGED
@@ -157,9 +157,11 @@ class Ai1wm_Main_Controller {
157
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Config_File::execute', 60 );
158
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate_Content::execute', 100 );
159
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate_Media::execute', 110 );
160
- add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate_Tables::execute', 120 );
 
161
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 );
162
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Media::execute', 160 );
 
163
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 );
164
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Database_File::execute', 220 );
165
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Download::execute', 250 );
@@ -176,7 +178,7 @@ class Ai1wm_Main_Controller {
176
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Content::execute', 250 );
177
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Mu_Plugins::execute', 270 );
178
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Database::execute', 300 );
179
- add_filter( 'ai1wm_import', 'Ai1wm_Import_Plugins::execute', 340 );
180
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Done::execute', 350 );
181
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Clean::execute', 400 );
182
  }
157
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Config_File::execute', 60 );
158
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate_Content::execute', 100 );
159
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate_Media::execute', 110 );
160
+ add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate_Plugins::execute', 120 );
161
+ add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate_Tables::execute', 130 );
162
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 );
163
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Media::execute', 160 );
164
+ add_filter( 'ai1wm_export', 'Ai1wm_Export_Plugins::execute', 170 );
165
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 );
166
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Database_File::execute', 220 );
167
  add_filter( 'ai1wm_export', 'Ai1wm_Export_Download::execute', 250 );
178
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Content::execute', 250 );
179
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Mu_Plugins::execute', 270 );
180
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Database::execute', 300 );
181
+ add_filter( 'ai1wm_import', 'Ai1wm_Import_Options::execute', 330 );
182
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Done::execute', 350 );
183
  add_filter( 'ai1wm_import', 'Ai1wm_Import_Clean::execute', 400 );
184
  }
lib/model/class-ai1wm-extensions.php CHANGED
@@ -228,7 +228,7 @@ class Ai1wm_Extensions {
228
  'check' => AI1WMME_PLUGIN_CHECK,
229
  'basename' => AI1WMME_PLUGIN_BASENAME,
230
  'version' => AI1WMME_VERSION,
231
- 'requires' => '4.11',
232
  'short' => AI1WMME_PLUGIN_SHORT,
233
  );
234
  }
228
  'check' => AI1WMME_PLUGIN_CHECK,
229
  'basename' => AI1WMME_PLUGIN_BASENAME,
230
  'version' => AI1WMME_VERSION,
231
+ 'requires' => '4.12',
232
  'short' => AI1WMME_PLUGIN_SHORT,
233
  );
234
  }
lib/model/export/class-ai1wm-export-config.php CHANGED
@@ -132,7 +132,7 @@ class Ai1wm_Export_Config {
132
  $config['Plugin'] = array( 'Version' => AI1WM_VERSION );
133
 
134
  // Set WordPress version and content
135
- $config['WordPress'] = array( 'Version' => $wp_version, 'Content' => WP_CONTENT_DIR, 'Plugins' => WP_PLUGIN_DIR, 'Themes' => get_theme_root(), 'Uploads' => ai1wm_get_uploads_dir(), 'UploadsURL' => ai1wm_get_uploads_url() );
136
 
137
  // Set database version
138
  $config['Database'] = array( 'Version' => $mysql->version(), 'Charset' => DB_CHARSET, 'Collate' => DB_COLLATE, 'Prefix' => $table_prefix );
132
  $config['Plugin'] = array( 'Version' => AI1WM_VERSION );
133
 
134
  // Set WordPress version and content
135
+ $config['WordPress'] = array( 'Version' => $wp_version, 'Content' => WP_CONTENT_DIR, 'Plugins' => ai1wm_get_plugins_dir(), 'Themes' => get_theme_root(), 'Uploads' => ai1wm_get_uploads_dir(), 'UploadsURL' => ai1wm_get_uploads_url() );
136
 
137
  // Set database version
138
  $config['Database'] = array( 'Version' => $mysql->version(), 'Charset' => DB_CHARSET, 'Collate' => DB_COLLATE, 'Prefix' => $table_prefix );
lib/model/export/class-ai1wm-export-content.php CHANGED
@@ -74,11 +74,7 @@ class Ai1wm_Export_Content {
74
  }
75
 
76
  // What percent of files have we processed?
77
- if ( empty( $total_content_files_size ) ) {
78
- $progress = 100;
79
- } else {
80
- $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
81
- }
82
 
83
  // Set progress
84
  Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
@@ -92,7 +88,7 @@ class Ai1wm_Export_Content {
92
  // Get content list file
93
  $content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' );
94
 
95
- // Set content pointer at the current index
96
  if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) {
97
 
98
  // Open the archive file for writing
@@ -117,11 +113,7 @@ class Ai1wm_Export_Content {
117
  $processed_files_size += $file_bytes_written;
118
 
119
  // What percent of files have we processed?
120
- if ( empty( $total_content_files_size ) ) {
121
- $progress = 100;
122
- } else {
123
- $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
124
- }
125
 
126
  // Set progress
127
  Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
74
  }
75
 
76
  // What percent of files have we processed?
77
+ $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
 
 
 
 
78
 
79
  // Set progress
80
  Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
88
  // Get content list file
89
  $content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' );
90
 
91
+ // Set the file pointer at the current index
92
  if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) {
93
 
94
  // Open the archive file for writing
113
  $processed_files_size += $file_bytes_written;
114
 
115
  // What percent of files have we processed?
116
+ $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
 
 
 
 
117
 
118
  // Set progress
119
  Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
lib/model/export/class-ai1wm-export-enumerate-content.php CHANGED
@@ -31,20 +31,20 @@ class Ai1wm_Export_Enumerate_Content {
31
 
32
  public static function execute( $params ) {
33
 
34
- $exclude_filters = array( ai1wm_get_uploads_dir() );
35
 
36
  // Get total content files count
37
  if ( isset( $params['total_content_files_count'] ) ) {
38
  $total_content_files_count = (int) $params['total_content_files_count'];
39
  } else {
40
- $total_content_files_count = 0;
41
  }
42
 
43
  // Get total content files size
44
  if ( isset( $params['total_content_files_size'] ) ) {
45
  $total_content_files_size = (int) $params['total_content_files_size'];
46
  } else {
47
- $total_content_files_size = 0;
48
  }
49
 
50
  // Set progress
@@ -58,20 +58,12 @@ class Ai1wm_Export_Enumerate_Content {
58
  // Exclude themes
59
  if ( isset( $params['options']['no_themes'] ) ) {
60
  $exclude_filters[] = 'themes';
61
- } else {
62
- $inactive_themes = array();
63
-
64
- // Exclude inactive themes
65
- if ( isset( $params['options']['no_inactive_themes'] ) ) {
66
- foreach ( search_theme_directories() as $theme => $info ) {
67
- // Exclude current parent and child themes
68
- if ( ! in_array( $theme, array( get_template(), get_stylesheet() ) ) ) {
69
- $inactive_themes[] = 'themes' . DIRECTORY_SEPARATOR . $theme;
70
- }
71
  }
72
  }
73
-
74
- $exclude_filters = array_merge( $exclude_filters, $inactive_themes );
75
  }
76
 
77
  // Exclude must-use plugins
@@ -79,41 +71,18 @@ class Ai1wm_Export_Enumerate_Content {
79
  $exclude_filters[] = 'mu-plugins';
80
  }
81
 
82
- // Exclude plugins
83
- if ( isset( $params['options']['no_plugins'] ) ) {
84
- $exclude_filters[] = 'plugins';
85
- } else {
86
- $inactive_plugins = array();
87
-
88
- // Exclude inactive plugins
89
- if ( isset( $params['options']['no_inactive_plugins'] ) ) {
90
- foreach ( get_plugins() as $plugin => $info ) {
91
- if ( is_plugin_inactive( $plugin ) ) {
92
- $inactive_plugins[] = 'plugins' . DIRECTORY_SEPARATOR . ( ( dirname( $plugin ) === '.' ) ? basename( $plugin ) : dirname( $plugin ) );
93
- }
94
- }
95
- }
96
-
97
- $exclude_filters = array_merge( $exclude_filters, ai1wm_plugin_filters( $inactive_plugins ) );
98
- }
99
-
100
  // Exclude media
101
  if ( isset( $params['options']['no_media'] ) ) {
102
  $exclude_filters[] = 'blogs.dir';
103
  }
104
 
105
- $user_filters = array();
106
-
107
  // Exclude selected files
108
  if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
109
- $excluded_files = explode( ',', $params['excluded_files'] );
110
- if ( $excluded_files ) {
111
  foreach ( $excluded_files as $excluded_path ) {
112
- $user_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
113
  }
114
  }
115
-
116
- $exclude_filters = array_merge( $exclude_filters, $user_filters );
117
  }
118
 
119
  // Create content list file
31
 
32
  public static function execute( $params ) {
33
 
34
+ $exclude_filters = array( ai1wm_get_uploads_dir(), ai1wm_get_plugins_dir() );
35
 
36
  // Get total content files count
37
  if ( isset( $params['total_content_files_count'] ) ) {
38
  $total_content_files_count = (int) $params['total_content_files_count'];
39
  } else {
40
+ $total_content_files_count = 1;
41
  }
42
 
43
  // Get total content files size
44
  if ( isset( $params['total_content_files_size'] ) ) {
45
  $total_content_files_size = (int) $params['total_content_files_size'];
46
  } else {
47
+ $total_content_files_size = 1;
48
  }
49
 
50
  // Set progress
58
  // Exclude themes
59
  if ( isset( $params['options']['no_themes'] ) ) {
60
  $exclude_filters[] = 'themes';
61
+ } elseif ( isset( $params['options']['no_inactive_themes'] ) ) {
62
+ foreach ( search_theme_directories() as $theme_name => $theme_info ) {
63
+ if ( ! in_array( $theme_name, array( get_template(), get_stylesheet() ) ) ) {
64
+ $exclude_filters[] = 'themes' . DIRECTORY_SEPARATOR . $theme_name;
 
 
 
 
 
 
65
  }
66
  }
 
 
67
  }
68
 
69
  // Exclude must-use plugins
71
  $exclude_filters[] = 'mu-plugins';
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  // Exclude media
75
  if ( isset( $params['options']['no_media'] ) ) {
76
  $exclude_filters[] = 'blogs.dir';
77
  }
78
 
 
 
79
  // Exclude selected files
80
  if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
81
+ if ( ( $excluded_files = explode( ',', $params['excluded_files'] ) ) ) {
 
82
  foreach ( $excluded_files as $excluded_path ) {
83
+ $exclude_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
84
  }
85
  }
 
 
86
  }
87
 
88
  // Create content list file
lib/model/export/class-ai1wm-export-enumerate-media.php CHANGED
@@ -31,20 +31,20 @@ class Ai1wm_Export_Enumerate_Media {
31
 
32
  public static function execute( $params ) {
33
 
34
- $exclude_filters = $user_filters = array();
35
 
36
  // Get total media files count
37
  if ( isset( $params['total_media_files_count'] ) ) {
38
  $total_media_files_count = (int) $params['total_media_files_count'];
39
  } else {
40
- $total_media_files_count = 0;
41
  }
42
 
43
  // Get total media files size
44
  if ( isset( $params['total_media_files_size'] ) ) {
45
  $total_media_files_size = (int) $params['total_media_files_size'];
46
  } else {
47
- $total_media_files_size = 0;
48
  }
49
 
50
  // Set progress
@@ -52,14 +52,11 @@ class Ai1wm_Export_Enumerate_Media {
52
 
53
  // Exclude selected files
54
  if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
55
- $excluded_files = explode( ',', $params['excluded_files'] );
56
- if ( $excluded_files ) {
57
  foreach ( $excluded_files as $excluded_path ) {
58
- $user_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
59
  }
60
  }
61
-
62
- $exclude_filters = array_merge( $exclude_filters, $user_filters );
63
  }
64
 
65
  // Create media list file
31
 
32
  public static function execute( $params ) {
33
 
34
+ $exclude_filters = array();
35
 
36
  // Get total media files count
37
  if ( isset( $params['total_media_files_count'] ) ) {
38
  $total_media_files_count = (int) $params['total_media_files_count'];
39
  } else {
40
+ $total_media_files_count = 1;
41
  }
42
 
43
  // Get total media files size
44
  if ( isset( $params['total_media_files_size'] ) ) {
45
  $total_media_files_size = (int) $params['total_media_files_size'];
46
  } else {
47
+ $total_media_files_size = 1;
48
  }
49
 
50
  // Set progress
52
 
53
  // Exclude selected files
54
  if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
55
+ if ( ( $excluded_files = explode( ',', $params['excluded_files'] ) ) ) {
 
56
  foreach ( $excluded_files as $excluded_path ) {
57
+ $exclude_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
58
  }
59
  }
 
 
60
  }
61
 
62
  // Create media list file
lib/model/export/class-ai1wm-export-enumerate-plugins.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2014-2020 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
+ if ( ! defined( 'ABSPATH' ) ) {
27
+ die( 'Kangaroos cannot jump here' );
28
+ }
29
+
30
+ class Ai1wm_Export_Enumerate_Plugins {
31
+
32
+ public static function execute( $params ) {
33
+
34
+ $exclude_filters = array();
35
+
36
+ // Get total plugins files count
37
+ if ( isset( $params['total_plugins_files_count'] ) ) {
38
+ $total_plugins_files_count = (int) $params['total_plugins_files_count'];
39
+ } else {
40
+ $total_plugins_files_count = 1;
41
+ }
42
+
43
+ // Get total plugins files size
44
+ if ( isset( $params['total_plugins_files_size'] ) ) {
45
+ $total_plugins_files_size = (int) $params['total_plugins_files_size'];
46
+ } else {
47
+ $total_plugins_files_size = 1;
48
+ }
49
+
50
+ // Set progress
51
+ Ai1wm_Status::info( __( 'Retrieving a list of WordPress plugin files...', AI1WM_PLUGIN_NAME ) );
52
+
53
+ // Exclude inactive plugins
54
+ if ( isset( $params['options']['no_inactive_plugins'] ) ) {
55
+ foreach ( get_plugins() as $plugin_name => $plugin_info ) {
56
+ if ( is_plugin_inactive( $plugin_name ) ) {
57
+ $exclude_filters[] = ( dirname( $plugin_name ) === '.' ? basename( $plugin_name ) : dirname( $plugin_name ) );
58
+ }
59
+ }
60
+ }
61
+
62
+ // Exclude selected files
63
+ if ( isset( $params['options']['exclude_files'], $params['excluded_files'] ) ) {
64
+ if ( ( $excluded_files = explode( ',', $params['excluded_files'] ) ) ) {
65
+ foreach ( $excluded_files as $excluded_path ) {
66
+ $exclude_filters[] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . untrailingslashit( $excluded_path );
67
+ }
68
+ }
69
+ }
70
+
71
+ // Create plugins list file
72
+ $plugins_list = ai1wm_open( ai1wm_plugins_list_path( $params ), 'w' );
73
+
74
+ // Enumerate over plugins directory
75
+ if ( isset( $params['options']['no_plugins'] ) === false ) {
76
+
77
+ // Iterate over plugins directory
78
+ $iterator = new Ai1wm_Recursive_Directory_Iterator( ai1wm_get_plugins_dir() );
79
+
80
+ // Exclude plugins files
81
+ $iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, apply_filters( 'ai1wm_exclude_plugins_from_export', ai1wm_plugin_filters( $exclude_filters ) ) );
82
+
83
+ // Recursively iterate over plugins directory
84
+ $iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );
85
+
86
+ // Write path line
87
+ foreach ( $iterator as $item ) {
88
+ if ( $item->isFile() ) {
89
+ if ( ai1wm_write( $plugins_list, $iterator->getSubPathname() . PHP_EOL ) ) {
90
+ $total_plugins_files_count++;
91
+
92
+ // Add current file size
93
+ $total_plugins_files_size += $iterator->getSize();
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ // Set progress
100
+ Ai1wm_Status::info( __( 'Done retrieving a list of WordPress plugin files.', AI1WM_PLUGIN_NAME ) );
101
+
102
+ // Set total plugins files count
103
+ $params['total_plugins_files_count'] = $total_plugins_files_count;
104
+
105
+ // Set total plugins files size
106
+ $params['total_plugins_files_size'] = $total_plugins_files_size;
107
+
108
+ // Close the plugins list file
109
+ ai1wm_close( $plugins_list );
110
+
111
+ return $params;
112
+ }
113
+ }
lib/model/export/class-ai1wm-export-enumerate-tables.php CHANGED
@@ -41,7 +41,7 @@ class Ai1wm_Export_Enumerate_Tables {
41
  if ( isset( $params['total_tables_count'] ) ) {
42
  $total_tables_count = (int) $params['total_tables_count'];
43
  } else {
44
- $total_tables_count = 0;
45
  }
46
 
47
  // Set progress
41
  if ( isset( $params['total_tables_count'] ) ) {
42
  $total_tables_count = (int) $params['total_tables_count'];
43
  } else {
44
+ $total_tables_count = 1;
45
  }
46
 
47
  // Set progress
lib/model/export/class-ai1wm-export-media.php CHANGED
@@ -74,11 +74,7 @@ class Ai1wm_Export_Media {
74
  }
75
 
76
  // What percent of files have we processed?
77
- if ( empty( $total_media_files_size ) ) {
78
- $progress = 100;
79
- } else {
80
- $progress = (int) min( ( $processed_files_size / $total_media_files_size ) * 100, 100 );
81
- }
82
 
83
  // Set progress
84
  Ai1wm_Status::info( sprintf( __( 'Archiving %d media files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_media_files_count, $progress ) );
@@ -92,7 +88,7 @@ class Ai1wm_Export_Media {
92
  // Get media list file
93
  $media_list = ai1wm_open( ai1wm_media_list_path( $params ), 'r' );
94
 
95
- // Set media pointer at the current index
96
  if ( fseek( $media_list, $media_bytes_offset ) !== -1 ) {
97
 
98
  // Open the archive file for writing
@@ -117,11 +113,7 @@ class Ai1wm_Export_Media {
117
  $processed_files_size += $file_bytes_written;
118
 
119
  // What percent of files have we processed?
120
- if ( empty( $total_media_files_size ) ) {
121
- $progress = 100;
122
- } else {
123
- $progress = (int) min( ( $processed_files_size / $total_media_files_size ) * 100, 100 );
124
- }
125
 
126
  // Set progress
127
  Ai1wm_Status::info( sprintf( __( 'Archiving %d media files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_media_files_count, $progress ) );
74
  }
75
 
76
  // What percent of files have we processed?
77
+ $progress = (int) min( ( $processed_files_size / $total_media_files_size ) * 100, 100 );
 
 
 
 
78
 
79
  // Set progress
80
  Ai1wm_Status::info( sprintf( __( 'Archiving %d media files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_media_files_count, $progress ) );
88
  // Get media list file
89
  $media_list = ai1wm_open( ai1wm_media_list_path( $params ), 'r' );
90
 
91
+ // Set the file pointer at the current index
92
  if ( fseek( $media_list, $media_bytes_offset ) !== -1 ) {
93
 
94
  // Open the archive file for writing
113
  $processed_files_size += $file_bytes_written;
114
 
115
  // What percent of files have we processed?
116
+ $progress = (int) min( ( $processed_files_size / $total_media_files_size ) * 100, 100 );
 
 
 
 
117
 
118
  // Set progress
119
  Ai1wm_Status::info( sprintf( __( 'Archiving %d media files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_media_files_count, $progress ) );
lib/model/export/class-ai1wm-export-plugins.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2014-2020 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
+ if ( ! defined( 'ABSPATH' ) ) {
27
+ die( 'Kangaroos cannot jump here' );
28
+ }
29
+
30
+ class Ai1wm_Export_Plugins {
31
+
32
+ public static function execute( $params ) {
33
+
34
+ // Set archive bytes offset
35
+ if ( isset( $params['archive_bytes_offset'] ) ) {
36
+ $archive_bytes_offset = (int) $params['archive_bytes_offset'];
37
+ } else {
38
+ $archive_bytes_offset = ai1wm_archive_bytes( $params );
39
+ }
40
+
41
+ // Set file bytes offset
42
+ if ( isset( $params['file_bytes_offset'] ) ) {
43
+ $file_bytes_offset = (int) $params['file_bytes_offset'];
44
+ } else {
45
+ $file_bytes_offset = 0;
46
+ }
47
+
48
+ // Set plugins bytes offset
49
+ if ( isset( $params['plugins_bytes_offset'] ) ) {
50
+ $plugins_bytes_offset = (int) $params['plugins_bytes_offset'];
51
+ } else {
52
+ $plugins_bytes_offset = 0;
53
+ }
54
+
55
+ // Get processed files size
56
+ if ( isset( $params['processed_files_size'] ) ) {
57
+ $processed_files_size = (int) $params['processed_files_size'];
58
+ } else {
59
+ $processed_files_size = 0;
60
+ }
61
+
62
+ // Get total plugins files size
63
+ if ( isset( $params['total_plugins_files_size'] ) ) {
64
+ $total_plugins_files_size = (int) $params['total_plugins_files_size'];
65
+ } else {
66
+ $total_plugins_files_size = 1;
67
+ }
68
+
69
+ // Get total plugins files count
70
+ if ( isset( $params['total_plugins_files_count'] ) ) {
71
+ $total_plugins_files_count = (int) $params['total_plugins_files_count'];
72
+ } else {
73
+ $total_plugins_files_count = 1;
74
+ }
75
+
76
+ // What percent of files have we processed?
77
+ $progress = (int) min( ( $processed_files_size / $total_plugins_files_size ) * 100, 100 );
78
+
79
+ // Set progress
80
+ Ai1wm_Status::info( sprintf( __( 'Archiving %d plugin files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_plugins_files_count, $progress ) );
81
+
82
+ // Flag to hold if file data has been processed
83
+ $completed = true;
84
+
85
+ // Start time
86
+ $start = microtime( true );
87
+
88
+ // Get plugins list file
89
+ $plugins_list = ai1wm_open( ai1wm_plugins_list_path( $params ), 'r' );
90
+
91
+ // Set the file pointer at the current index
92
+ if ( fseek( $plugins_list, $plugins_bytes_offset ) !== -1 ) {
93
+
94
+ // Open the archive file for writing
95
+ $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
96
+
97
+ // Set the file pointer to the one that we have saved
98
+ $archive->set_file_pointer( $archive_bytes_offset );
99
+
100
+ // Loop over files
101
+ while ( $file_path = trim( fgets( $plugins_list ) ) ) {
102
+ $file_bytes_written = 0;
103
+
104
+ // Add file to archive
105
+ if ( ( $completed = $archive->add_file( ai1wm_get_plugins_dir() . DIRECTORY_SEPARATOR . $file_path, 'plugins' . DIRECTORY_SEPARATOR . $file_path, $file_bytes_written, $file_bytes_offset ) ) ) {
106
+ $file_bytes_offset = 0;
107
+
108
+ // Get plugins bytes offset
109
+ $plugins_bytes_offset = ftell( $plugins_list );
110
+ }
111
+
112
+ // Increment processed files size
113
+ $processed_files_size += $file_bytes_written;
114
+
115
+ // What percent of files have we processed?
116
+ $progress = (int) min( ( $processed_files_size / $total_plugins_files_size ) * 100, 100 );
117
+
118
+ // Set progress
119
+ Ai1wm_Status::info( sprintf( __( 'Archiving %d plugin files...<br />%d%% complete', AI1WM_PLUGIN_NAME ), $total_plugins_files_count, $progress ) );
120
+
121
+ // More than 10 seconds have passed, break and do another request
122
+ if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
123
+ if ( ( microtime( true ) - $start ) > $timeout ) {
124
+ $completed = false;
125
+ break;
126
+ }
127
+ }
128
+ }
129
+
130
+ // Get archive bytes offset
131
+ $archive_bytes_offset = $archive->get_file_pointer();
132
+
133
+ // Truncate the archive file
134
+ $archive->truncate();
135
+
136
+ // Close the archive file
137
+ $archive->close();
138
+ }
139
+
140
+ // End of the plugins list?
141
+ if ( feof( $plugins_list ) ) {
142
+
143
+ // Unset archive bytes offset
144
+ unset( $params['archive_bytes_offset'] );
145
+
146
+ // Unset file bytes offset
147
+ unset( $params['file_bytes_offset'] );
148
+
149
+ // Unset plugins bytes offset
150
+ unset( $params['plugins_bytes_offset'] );
151
+
152
+ // Unset processed files size
153
+ unset( $params['processed_files_size'] );
154
+
155
+ // Unset total plugins files size
156
+ unset( $params['total_plugins_files_size'] );
157
+
158
+ // Unset total plugins files count
159
+ unset( $params['total_plugins_files_count'] );
160
+
161
+ // Unset completed flag
162
+ unset( $params['completed'] );
163
+
164
+ } else {
165
+
166
+ // Set archive bytes offset
167
+ $params['archive_bytes_offset'] = $archive_bytes_offset;
168
+
169
+ // Set file bytes offset
170
+ $params['file_bytes_offset'] = $file_bytes_offset;
171
+
172
+ // Set plugins bytes offset
173
+ $params['plugins_bytes_offset'] = $plugins_bytes_offset;
174
+
175
+ // Set processed files size
176
+ $params['processed_files_size'] = $processed_files_size;
177
+
178
+ // Set total plugins files size
179
+ $params['total_plugins_files_size'] = $total_plugins_files_size;
180
+
181
+ // Set total plugins files count
182
+ $params['total_plugins_files_count'] = $total_plugins_files_count;
183
+
184
+ // Set completed flag
185
+ $params['completed'] = $completed;
186
+ }
187
+
188
+ // Close the plugins list file
189
+ ai1wm_close( $plugins_list );
190
+
191
+ return $params;
192
+ }
193
+ }
lib/model/import/class-ai1wm-import-content.php CHANGED
@@ -94,8 +94,8 @@ class Ai1wm_Import_Content {
94
  // Set the file pointer to the one that we have saved
95
  $archive->set_file_pointer( $archive_bytes_offset );
96
 
97
- $old_paths = array();
98
- $new_paths = array();
99
 
100
  // Set extract paths
101
  foreach ( $blogs as $blog ) {
@@ -179,6 +179,9 @@ class Ai1wm_Import_Content {
179
  )
180
  );
181
 
 
 
 
182
  // Exclude Elementor files
183
  $exclude_files = array_merge( $exclude_files, array( AI1WM_ELEMENTOR_CSS_NAME ) );
184
 
94
  // Set the file pointer to the one that we have saved
95
  $archive->set_file_pointer( $archive_bytes_offset );
96
 
97
+ $old_paths = array( 'plugins' );
98
+ $new_paths = array( ai1wm_get_plugins_dir() );
99
 
100
  // Set extract paths
101
  foreach ( $blogs as $blog ) {
179
  )
180
  );
181
 
182
+ // Exclude theme files
183
+ $exclude_files = array_merge( $exclude_files, array( AI1WM_THEMES_FUNCTIONS_NAME ) );
184
+
185
  // Exclude Elementor files
186
  $exclude_files = array_merge( $exclude_files, array( AI1WM_ELEMENTOR_CSS_NAME ) );
187
 
lib/model/import/{class-ai1wm-import-plugins.php → class-ai1wm-import-options.php} RENAMED
@@ -27,13 +27,13 @@ if ( ! defined( 'ABSPATH' ) ) {
27
  die( 'Kangaroos cannot jump here' );
28
  }
29
 
30
- class Ai1wm_Import_Plugins {
31
 
32
  public static function execute( $params, Ai1wm_Database $mysql = null ) {
33
  global $wpdb;
34
 
35
  // Set progress
36
- Ai1wm_Status::info( __( 'Preparing plugins...', AI1WM_PLUGIN_NAME ) );
37
 
38
  // Get database client
39
  if ( is_null( $mysql ) ) {
@@ -57,7 +57,7 @@ class Ai1wm_Import_Plugins {
57
 
58
  // Get fs_accounts option value (Freemius)
59
  $result = $mysql->query( "SELECT meta_value FROM `{$mainsite_prefix}sitemeta` WHERE meta_key = 'fs_accounts'" );
60
- if ( $row = $mysql->fetch_assoc( $result ) ) {
61
  $fs_accounts = get_option( 'fs_accounts', array() );
62
  $meta_value = maybe_unserialize( $row['meta_value'] );
63
 
@@ -78,7 +78,7 @@ class Ai1wm_Import_Plugins {
78
  }
79
 
80
  // Set progress
81
- Ai1wm_Status::info( __( 'Done preparing plugins.', AI1WM_PLUGIN_NAME ) );
82
 
83
  return $params;
84
  }
27
  die( 'Kangaroos cannot jump here' );
28
  }
29
 
30
+ class Ai1wm_Import_Options {
31
 
32
  public static function execute( $params, Ai1wm_Database $mysql = null ) {
33
  global $wpdb;
34
 
35
  // Set progress
36
+ Ai1wm_Status::info( __( 'Preparing options...', AI1WM_PLUGIN_NAME ) );
37
 
38
  // Get database client
39
  if ( is_null( $mysql ) ) {
57
 
58
  // Get fs_accounts option value (Freemius)
59
  $result = $mysql->query( "SELECT meta_value FROM `{$mainsite_prefix}sitemeta` WHERE meta_key = 'fs_accounts'" );
60
+ if ( ( $row = $mysql->fetch_assoc( $result ) ) ) {
61
  $fs_accounts = get_option( 'fs_accounts', array() );
62
  $meta_value = maybe_unserialize( $row['meta_value'] );
63
 
78
  }
79
 
80
  // Set progress
81
+ Ai1wm_Status::info( __( 'Done preparing options.', AI1WM_PLUGIN_NAME ) );
82
 
83
  return $params;
84
  }
loader.php CHANGED
@@ -241,6 +241,10 @@ require_once AI1WM_EXPORT_PATH .
241
  DIRECTORY_SEPARATOR .
242
  'class-ai1wm-export-enumerate-media.php';
243
 
 
 
 
 
244
  require_once AI1WM_EXPORT_PATH .
245
  DIRECTORY_SEPARATOR .
246
  'class-ai1wm-export-enumerate-tables.php';
@@ -253,6 +257,10 @@ require_once AI1WM_EXPORT_PATH .
253
  DIRECTORY_SEPARATOR .
254
  'class-ai1wm-export-media.php';
255
 
 
 
 
 
256
  require_once AI1WM_EXPORT_PATH .
257
  DIRECTORY_SEPARATOR .
258
  'class-ai1wm-export-database.php';
@@ -289,6 +297,10 @@ require_once AI1WM_IMPORT_PATH .
289
  DIRECTORY_SEPARATOR .
290
  'class-ai1wm-import-blogs.php';
291
 
 
 
 
 
292
  require_once AI1WM_IMPORT_PATH .
293
  DIRECTORY_SEPARATOR .
294
  'class-ai1wm-import-permalinks.php';
@@ -309,10 +321,6 @@ require_once AI1WM_IMPORT_PATH .
309
  DIRECTORY_SEPARATOR .
310
  'class-ai1wm-import-database.php';
311
 
312
- require_once AI1WM_IMPORT_PATH .
313
- DIRECTORY_SEPARATOR .
314
- 'class-ai1wm-import-plugins.php';
315
-
316
  require_once AI1WM_IMPORT_PATH .
317
  DIRECTORY_SEPARATOR .
318
  'class-ai1wm-import-done.php';
241
  DIRECTORY_SEPARATOR .
242
  'class-ai1wm-export-enumerate-media.php';
243
 
244
+ require_once AI1WM_EXPORT_PATH .
245
+ DIRECTORY_SEPARATOR .
246
+ 'class-ai1wm-export-enumerate-plugins.php';
247
+
248
  require_once AI1WM_EXPORT_PATH .
249
  DIRECTORY_SEPARATOR .
250
  'class-ai1wm-export-enumerate-tables.php';
257
  DIRECTORY_SEPARATOR .
258
  'class-ai1wm-export-media.php';
259
 
260
+ require_once AI1WM_EXPORT_PATH .
261
+ DIRECTORY_SEPARATOR .
262
+ 'class-ai1wm-export-plugins.php';
263
+
264
  require_once AI1WM_EXPORT_PATH .
265
  DIRECTORY_SEPARATOR .
266
  'class-ai1wm-export-database.php';
297
  DIRECTORY_SEPARATOR .
298
  'class-ai1wm-import-blogs.php';
299
 
300
+ require_once AI1WM_IMPORT_PATH .
301
+ DIRECTORY_SEPARATOR .
302
+ 'class-ai1wm-import-options.php';
303
+
304
  require_once AI1WM_IMPORT_PATH .
305
  DIRECTORY_SEPARATOR .
306
  'class-ai1wm-import-permalinks.php';
321
  DIRECTORY_SEPARATOR .
322
  'class-ai1wm-import-database.php';
323
 
 
 
 
 
324
  require_once AI1WM_IMPORT_PATH .
325
  DIRECTORY_SEPARATOR .
326
  'class-ai1wm-import-done.php';
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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: 5.7
6
  Requires PHP: 5.2.17
7
- Stable tag: 7.44
8
  License: GPLv2 or later
9
 
10
  Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
@@ -108,6 +108,11 @@ Alternatively you can download the plugin using the download button on this page
108
  All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
109
 
110
  == Changelog ==
 
 
 
 
 
111
  = 7.44 =
112
  **Added**
113
 
2
  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: 5.8
6
  Requires PHP: 5.2.17
7
+ Stable tag: 7.45
8
  License: GPLv2 or later
9
 
10
  Move, transfer, copy, migrate, and backup a site with 1-click. Quick, easy, and reliable.
108
  All-in-One WP Migration **asks for your consent** to collect **requester's email address** when filling plugin's contact form. [GDPR Compliant Privacy Policy](https://www.iubenda.com/privacy-policy/946881)
109
 
110
  == Changelog ==
111
+ = 7.45 =
112
+ **Added**
113
+
114
+ * Support custom plugins directory
115
+
116
  = 7.44 =
117
  **Added**
118