All-in-One WP Migration - Version 6.96

Version Description

Fixed

  • Delete failed import/exports older than 24 hours
Download this release

Release Info

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

Code changes from version 6.95 to 6.96

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.95
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.96
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', '6.95' );
39
 
40
  // ===============
41
  // = Plugin Name =
@@ -327,6 +327,11 @@ define( 'AI1WM_MAX_TRANSACTION_QUERIES', 1000 );
327
  // ======================
328
  define( 'AI1WM_MAX_SELECT_RECORDS', 1000 );
329
 
 
 
 
 
 
330
  // ===========================
331
  // = WP_CONTENT_DIR Constant =
332
  // ===========================
35
  // ==================
36
  // = Plugin Version =
37
  // ==================
38
+ define( 'AI1WM_VERSION', '6.96' );
39
 
40
  // ===============
41
  // = Plugin Name =
327
  // ======================
328
  define( 'AI1WM_MAX_SELECT_RECORDS', 1000 );
329
 
330
+ // =======================
331
+ // = Max Storage Cleanup =
332
+ // =======================
333
+ define( 'AI1WM_MAX_STORAGE_CLEANUP', 24 * 60 * 60 );
334
+
335
  // ===========================
336
  // = WP_CONTENT_DIR Constant =
337
  // ===========================
functions.php CHANGED
@@ -1409,3 +1409,24 @@ function ai1wm_setup_environment() {
1409
  // Set shutdown handler
1410
  @register_shutdown_function( 'Ai1wm_Handler::shutdown' );
1411
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1409
  // Set shutdown handler
1410
  @register_shutdown_function( 'Ai1wm_Handler::shutdown' );
1411
  }
1412
+
1413
+ /**
1414
+ * Get WordPress time zone string
1415
+ *
1416
+ * @return string
1417
+ */
1418
+ function ai1wm_get_timezone_string() {
1419
+ if ( ( $timezone_string = get_option( 'timezone_string' ) ) ) {
1420
+ return $timezone_string;
1421
+ }
1422
+
1423
+ if ( ( $gmt_offset = get_option( 'gmt_offset' ) ) ) {
1424
+ if ( $gmt_offset > 0 ) {
1425
+ return sprintf( 'UTC+%s', abs( $gmt_offset ) );
1426
+ } elseif ( $gmt_offset < 0 ) {
1427
+ return sprintf( 'UTC-%s', abs( $gmt_offset ) );
1428
+ }
1429
+ }
1430
+
1431
+ return 'UTC';
1432
+ }
lib/controller/class-ai1wm-export-controller.php CHANGED
@@ -128,6 +128,7 @@ class Ai1wm_Export_Controller {
128
  next( $filters );
129
  }
130
  }
 
131
  return $params;
132
  }
133
 
@@ -163,38 +164,24 @@ class Ai1wm_Export_Controller {
163
  }
164
 
165
  public static function cleanup() {
166
- // // Iterate over storage directory
167
- // $iterator = new Ai1wm_Recursive_Directory_Iterator( AI1WM_STORAGE_PATH );
168
-
169
- // // Exclude index.php
170
- // $iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, array( 'index.php' ) );
171
-
172
- // // Recursively iterate over content directory
173
- // $iterator = new Ai1wm_Recursive_Iterator_Iterator( $iterator, RecursiveIteratorIterator::CHILD_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD );
174
-
175
- // // We can't delete in the main loop since deletion updates mtime for parent folders
176
- // $files = $folders = array();
177
- // foreach ( $iterator as $item ) {
178
- // try {
179
- // if ( $item->getMTime() < time() - 23 * 60 * 60 ) {
180
- // if ( $item->isFile() ) {
181
- // $files[] = $item->getPathname();
182
- // } elseif ( $item->isDir() ) {
183
- // $folders[] = $item->getPathname();
184
- // }
185
- // }
186
- // } catch ( Exception $e ) {
187
- // }
188
- // }
189
-
190
- // // Delete outdated files
191
- // foreach ( $files as $file ) {
192
- // @unlink( $file );
193
- // }
194
-
195
- // // Delete outdated folders
196
- // foreach ( $folders as $folder ) {
197
- // Ai1wm_Directory::delete( $folder );
198
- // }
199
  }
200
  }
128
  next( $filters );
129
  }
130
  }
131
+
132
  return $params;
133
  }
134
 
164
  }
165
 
166
  public static function cleanup() {
167
+ // Iterate over storage directory
168
+ $iterator = new Ai1wm_Recursive_Directory_Iterator( AI1WM_STORAGE_PATH );
169
+
170
+ // Exclude index.php
171
+ $iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, array( 'index.php' ) );
172
+
173
+ // Loop over folders and files
174
+ foreach ( $iterator as $item ) {
175
+ try {
176
+ if ( $item->getMTime() < ( time() - AI1WM_MAX_STORAGE_CLEANUP ) ) {
177
+ if ( $item->isDir() ) {
178
+ Ai1wm_Directory::delete( $item->getPathname() );
179
+ } else {
180
+ Ai1wm_File::delete( $item->getPathname() );
181
+ }
182
+ }
183
+ } catch ( Exception $e ) {
184
+ }
185
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
  }
lib/controller/class-ai1wm-feedback-controller.php CHANGED
@@ -75,23 +75,22 @@ class Ai1wm_Feedback_Controller {
75
 
76
  $extensions = Ai1wm_Extensions::get();
77
 
 
78
  if ( defined( 'AI1WMTE_PLUGIN_NAME' ) ) {
79
  unset( $extensions[ AI1WMTE_PLUGIN_NAME ] );
80
  }
81
 
82
  $purchases = array();
83
  foreach ( $extensions as $extension ) {
84
- if ( $uuid = get_option( $extension['key'] ) ) {
85
  $purchases[] = $uuid;
86
  }
87
  }
88
 
89
- $purchases = implode( PHP_EOL, $purchases );
90
-
91
  $model = new Ai1wm_Feedback;
92
 
93
  // Send feedback
94
- $errors = $model->add( $type, $email, $message, $terms, $purchases );
95
 
96
  echo json_encode( array( 'errors' => $errors ) );
97
  exit;
75
 
76
  $extensions = Ai1wm_Extensions::get();
77
 
78
+ // Exclude File Extension
79
  if ( defined( 'AI1WMTE_PLUGIN_NAME' ) ) {
80
  unset( $extensions[ AI1WMTE_PLUGIN_NAME ] );
81
  }
82
 
83
  $purchases = array();
84
  foreach ( $extensions as $extension ) {
85
+ if ( ( $uuid = get_option( $extension['key'] ) ) ) {
86
  $purchases[] = $uuid;
87
  }
88
  }
89
 
 
 
90
  $model = new Ai1wm_Feedback;
91
 
92
  // Send feedback
93
+ $errors = $model->add( $type, $email, $message, $terms, implode( PHP_EOL, $purchases ) );
94
 
95
  echo json_encode( array( 'errors' => $errors ) );
96
  exit;
lib/controller/class-ai1wm-import-controller.php CHANGED
@@ -136,6 +136,7 @@ class Ai1wm_Import_Controller {
136
  next( $filters );
137
  }
138
  }
 
139
  return $params;
140
  }
141
 
136
  next( $filters );
137
  }
138
  }
139
+
140
  return $params;
141
  }
142
 
lib/controller/class-ai1wm-main-controller.php CHANGED
@@ -232,7 +232,7 @@ class Ai1wm_Main_Controller {
232
  add_filter( 'plugin_row_meta', 'Ai1wm_Updater_Controller::plugin_row_meta', 10, 2 );
233
 
234
  // Add storage folder daily cleanup cron
235
- add_action( 'ai1wm_cleanup_cron', 'Ai1wm_Export_Controller::cleanup' );
236
  }
237
 
238
  /**
@@ -301,9 +301,14 @@ class Ai1wm_Main_Controller {
301
  * @return void
302
  */
303
  public function schedule_crons() {
304
- // Check if storage cleanup cron is scheduled
305
- if ( ! wp_next_scheduled( 'ai1wm_cleanup_cron' ) ) {
306
- Ai1wm_Cron::add( 'ai1wm_cleanup_cron', 'daily' );
 
 
 
 
 
307
  }
308
  }
309
 
232
  add_filter( 'plugin_row_meta', 'Ai1wm_Updater_Controller::plugin_row_meta', 10, 2 );
233
 
234
  // Add storage folder daily cleanup cron
235
+ add_action( 'ai1wm_storage_cleanup', 'Ai1wm_Export_Controller::cleanup' );
236
  }
237
 
238
  /**
301
  * @return void
302
  */
303
  public function schedule_crons() {
304
+ // Delete old cleanup cronjob
305
+ if ( Ai1wm_Cron::exists( 'ai1wm_cleanup_cron' ) ) {
306
+ Ai1wm_Cron::clear( 'ai1wm_cleanup_cron' );
307
+ }
308
+
309
+ // Schedule a new daily cleanup
310
+ if ( ! Ai1wm_Cron::exists( 'ai1wm_storage_cleanup' ) ) {
311
+ Ai1wm_Cron::add( 'ai1wm_storage_cleanup', 'daily', time() );
312
  }
313
  }
314
 
lib/model/class-ai1wm-extensions.php CHANGED
@@ -45,7 +45,7 @@ class Ai1wm_Extensions {
45
  'about' => AI1WMZE_PLUGIN_ABOUT,
46
  'basename' => AI1WMZE_PLUGIN_BASENAME,
47
  'version' => AI1WMZE_VERSION,
48
- 'requires' => '1.5',
49
  'short' => AI1WMZE_PLUGIN_SHORT,
50
  );
51
  }
@@ -58,7 +58,7 @@ class Ai1wm_Extensions {
58
  'about' => AI1WMAE_PLUGIN_ABOUT,
59
  'basename' => AI1WMAE_PLUGIN_BASENAME,
60
  'version' => AI1WMAE_VERSION,
61
- 'requires' => '1.9',
62
  'short' => AI1WMAE_PLUGIN_SHORT,
63
  );
64
  }
@@ -71,7 +71,7 @@ class Ai1wm_Extensions {
71
  'about' => AI1WMBE_PLUGIN_ABOUT,
72
  'basename' => AI1WMBE_PLUGIN_BASENAME,
73
  'version' => AI1WMBE_VERSION,
74
- 'requires' => '1.17',
75
  'short' => AI1WMBE_PLUGIN_SHORT,
76
  );
77
  }
@@ -84,7 +84,7 @@ class Ai1wm_Extensions {
84
  'about' => AI1WMIE_PLUGIN_ABOUT,
85
  'basename' => AI1WMIE_PLUGIN_BASENAME,
86
  'version' => AI1WMIE_VERSION,
87
- 'requires' => '1.16',
88
  'short' => AI1WMIE_PLUGIN_SHORT,
89
  );
90
  }
@@ -97,7 +97,7 @@ class Ai1wm_Extensions {
97
  'about' => AI1WMDE_PLUGIN_ABOUT,
98
  'basename' => AI1WMDE_PLUGIN_BASENAME,
99
  'version' => AI1WMDE_VERSION,
100
- 'requires' => '3.37',
101
  'short' => AI1WMDE_PLUGIN_SHORT,
102
  );
103
  }
@@ -110,7 +110,7 @@ class Ai1wm_Extensions {
110
  'about' => AI1WMTE_PLUGIN_ABOUT,
111
  'basename' => AI1WMTE_PLUGIN_BASENAME,
112
  'version' => AI1WMTE_VERSION,
113
- 'requires' => '1.1',
114
  'short' => AI1WMTE_PLUGIN_SHORT,
115
  );
116
  }
@@ -123,7 +123,7 @@ class Ai1wm_Extensions {
123
  'about' => AI1WMFE_PLUGIN_ABOUT,
124
  'basename' => AI1WMFE_PLUGIN_BASENAME,
125
  'version' => AI1WMFE_VERSION,
126
- 'requires' => '2.43',
127
  'short' => AI1WMFE_PLUGIN_SHORT,
128
  );
129
  }
@@ -136,7 +136,7 @@ class Ai1wm_Extensions {
136
  'about' => AI1WMCE_PLUGIN_ABOUT,
137
  'basename' => AI1WMCE_PLUGIN_BASENAME,
138
  'version' => AI1WMCE_VERSION,
139
- 'requires' => '1.6',
140
  'short' => AI1WMCE_PLUGIN_SHORT,
141
  );
142
  }
@@ -149,7 +149,7 @@ class Ai1wm_Extensions {
149
  'about' => AI1WMGE_PLUGIN_ABOUT,
150
  'basename' => AI1WMGE_PLUGIN_BASENAME,
151
  'version' => AI1WMGE_VERSION,
152
- 'requires' => '2.42',
153
  'short' => AI1WMGE_PLUGIN_SHORT,
154
  );
155
  }
@@ -162,7 +162,7 @@ class Ai1wm_Extensions {
162
  'about' => AI1WMRE_PLUGIN_ABOUT,
163
  'basename' => AI1WMRE_PLUGIN_BASENAME,
164
  'version' => AI1WMRE_VERSION,
165
- 'requires' => '1.7',
166
  'short' => AI1WMRE_PLUGIN_SHORT,
167
  );
168
  }
@@ -175,7 +175,7 @@ class Ai1wm_Extensions {
175
  'about' => AI1WMEE_PLUGIN_ABOUT,
176
  'basename' => AI1WMEE_PLUGIN_BASENAME,
177
  'version' => AI1WMEE_VERSION,
178
- 'requires' => '1.14',
179
  'short' => AI1WMEE_PLUGIN_SHORT,
180
  );
181
  }
@@ -201,7 +201,7 @@ class Ai1wm_Extensions {
201
  'about' => AI1WMOE_PLUGIN_ABOUT,
202
  'basename' => AI1WMOE_PLUGIN_BASENAME,
203
  'version' => AI1WMOE_VERSION,
204
- 'requires' => '1.28',
205
  'short' => AI1WMOE_PLUGIN_SHORT,
206
  );
207
  }
@@ -214,7 +214,7 @@ class Ai1wm_Extensions {
214
  'about' => AI1WMPE_PLUGIN_ABOUT,
215
  'basename' => AI1WMPE_PLUGIN_BASENAME,
216
  'version' => AI1WMPE_VERSION,
217
- 'requires' => '1.3',
218
  'short' => AI1WMPE_PLUGIN_SHORT,
219
  );
220
  }
@@ -227,7 +227,7 @@ class Ai1wm_Extensions {
227
  'about' => AI1WMNE_PLUGIN_ABOUT,
228
  'basename' => AI1WMNE_PLUGIN_BASENAME,
229
  'version' => AI1WMNE_VERSION,
230
- 'requires' => '1.1',
231
  'short' => AI1WMNE_PLUGIN_SHORT,
232
  );
233
  }
@@ -240,7 +240,7 @@ class Ai1wm_Extensions {
240
  'about' => AI1WMSE_PLUGIN_ABOUT,
241
  'basename' => AI1WMSE_PLUGIN_BASENAME,
242
  'version' => AI1WMSE_VERSION,
243
- 'requires' => '3.35',
244
  'short' => AI1WMSE_PLUGIN_SHORT,
245
  );
246
  }
@@ -253,7 +253,7 @@ class Ai1wm_Extensions {
253
  'about' => AI1WMUE_PLUGIN_ABOUT,
254
  'basename' => AI1WMUE_PLUGIN_BASENAME,
255
  'version' => AI1WMUE_VERSION,
256
- 'requires' => '2.23',
257
  'short' => AI1WMUE_PLUGIN_SHORT,
258
  );
259
  }
@@ -266,7 +266,7 @@ class Ai1wm_Extensions {
266
  'about' => AI1WMLE_PLUGIN_ABOUT,
267
  'basename' => AI1WMLE_PLUGIN_BASENAME,
268
  'version' => AI1WMLE_VERSION,
269
- 'requires' => '2.32',
270
  'short' => AI1WMLE_PLUGIN_SHORT,
271
  );
272
  }
@@ -279,7 +279,7 @@ class Ai1wm_Extensions {
279
  'about' => AI1WMWE_PLUGIN_ABOUT,
280
  'basename' => AI1WMWE_PLUGIN_BASENAME,
281
  'version' => AI1WMWE_VERSION,
282
- 'requires' => '1.3',
283
  'short' => AI1WMWE_PLUGIN_SHORT,
284
  );
285
  }
45
  'about' => AI1WMZE_PLUGIN_ABOUT,
46
  'basename' => AI1WMZE_PLUGIN_BASENAME,
47
  'version' => AI1WMZE_VERSION,
48
+ 'requires' => '1.14',
49
  'short' => AI1WMZE_PLUGIN_SHORT,
50
  );
51
  }
58
  'about' => AI1WMAE_PLUGIN_ABOUT,
59
  'basename' => AI1WMAE_PLUGIN_BASENAME,
60
  'version' => AI1WMAE_VERSION,
61
+ 'requires' => '1.19',
62
  'short' => AI1WMAE_PLUGIN_SHORT,
63
  );
64
  }
71
  'about' => AI1WMBE_PLUGIN_ABOUT,
72
  'basename' => AI1WMBE_PLUGIN_BASENAME,
73
  'version' => AI1WMBE_VERSION,
74
+ 'requires' => '1.25',
75
  'short' => AI1WMBE_PLUGIN_SHORT,
76
  );
77
  }
84
  'about' => AI1WMIE_PLUGIN_ABOUT,
85
  'basename' => AI1WMIE_PLUGIN_BASENAME,
86
  'version' => AI1WMIE_VERSION,
87
+ 'requires' => '1.25',
88
  'short' => AI1WMIE_PLUGIN_SHORT,
89
  );
90
  }
97
  'about' => AI1WMDE_PLUGIN_ABOUT,
98
  'basename' => AI1WMDE_PLUGIN_BASENAME,
99
  'version' => AI1WMDE_VERSION,
100
+ 'requires' => '3.45',
101
  'short' => AI1WMDE_PLUGIN_SHORT,
102
  );
103
  }
110
  'about' => AI1WMTE_PLUGIN_ABOUT,
111
  'basename' => AI1WMTE_PLUGIN_BASENAME,
112
  'version' => AI1WMTE_VERSION,
113
+ 'requires' => '1.4',
114
  'short' => AI1WMTE_PLUGIN_SHORT,
115
  );
116
  }
123
  'about' => AI1WMFE_PLUGIN_ABOUT,
124
  'basename' => AI1WMFE_PLUGIN_BASENAME,
125
  'version' => AI1WMFE_VERSION,
126
+ 'requires' => '2.51',
127
  'short' => AI1WMFE_PLUGIN_SHORT,
128
  );
129
  }
136
  'about' => AI1WMCE_PLUGIN_ABOUT,
137
  'basename' => AI1WMCE_PLUGIN_BASENAME,
138
  'version' => AI1WMCE_VERSION,
139
+ 'requires' => '1.15',
140
  'short' => AI1WMCE_PLUGIN_SHORT,
141
  );
142
  }
149
  'about' => AI1WMGE_PLUGIN_ABOUT,
150
  'basename' => AI1WMGE_PLUGIN_BASENAME,
151
  'version' => AI1WMGE_VERSION,
152
+ 'requires' => '2.50',
153
  'short' => AI1WMGE_PLUGIN_SHORT,
154
  );
155
  }
162
  'about' => AI1WMRE_PLUGIN_ABOUT,
163
  'basename' => AI1WMRE_PLUGIN_BASENAME,
164
  'version' => AI1WMRE_VERSION,
165
+ 'requires' => '1.15',
166
  'short' => AI1WMRE_PLUGIN_SHORT,
167
  );
168
  }
175
  'about' => AI1WMEE_PLUGIN_ABOUT,
176
  'basename' => AI1WMEE_PLUGIN_BASENAME,
177
  'version' => AI1WMEE_VERSION,
178
+ 'requires' => '1.23',
179
  'short' => AI1WMEE_PLUGIN_SHORT,
180
  );
181
  }
201
  'about' => AI1WMOE_PLUGIN_ABOUT,
202
  'basename' => AI1WMOE_PLUGIN_BASENAME,
203
  'version' => AI1WMOE_VERSION,
204
+ 'requires' => '1.36',
205
  'short' => AI1WMOE_PLUGIN_SHORT,
206
  );
207
  }
214
  'about' => AI1WMPE_PLUGIN_ABOUT,
215
  'basename' => AI1WMPE_PLUGIN_BASENAME,
216
  'version' => AI1WMPE_VERSION,
217
+ 'requires' => '1.12',
218
  'short' => AI1WMPE_PLUGIN_SHORT,
219
  );
220
  }
227
  'about' => AI1WMNE_PLUGIN_ABOUT,
228
  'basename' => AI1WMNE_PLUGIN_BASENAME,
229
  'version' => AI1WMNE_VERSION,
230
+ 'requires' => '1.10',
231
  'short' => AI1WMNE_PLUGIN_SHORT,
232
  );
233
  }
240
  'about' => AI1WMSE_PLUGIN_ABOUT,
241
  'basename' => AI1WMSE_PLUGIN_BASENAME,
242
  'version' => AI1WMSE_VERSION,
243
+ 'requires' => '3.44',
244
  'short' => AI1WMSE_PLUGIN_SHORT,
245
  );
246
  }
253
  'about' => AI1WMUE_PLUGIN_ABOUT,
254
  'basename' => AI1WMUE_PLUGIN_BASENAME,
255
  'version' => AI1WMUE_VERSION,
256
+ 'requires' => '2.30',
257
  'short' => AI1WMUE_PLUGIN_SHORT,
258
  );
259
  }
266
  'about' => AI1WMLE_PLUGIN_ABOUT,
267
  'basename' => AI1WMLE_PLUGIN_BASENAME,
268
  'version' => AI1WMLE_VERSION,
269
+ 'requires' => '2.39',
270
  'short' => AI1WMLE_PLUGIN_SHORT,
271
  );
272
  }
279
  'about' => AI1WMWE_PLUGIN_ABOUT,
280
  'basename' => AI1WMWE_PLUGIN_BASENAME,
281
  'version' => AI1WMWE_VERSION,
282
+ 'requires' => '1.12',
283
  'short' => AI1WMWE_PLUGIN_SHORT,
284
  );
285
  }
lib/model/class-ai1wm-updater.php CHANGED
@@ -109,7 +109,7 @@ class Ai1wm_Updater {
109
  /**
110
  * Check for extension updates
111
  *
112
- * @return void
113
  */
114
  public static function check_for_updates() {
115
  // Get current updates
@@ -150,8 +150,7 @@ class Ai1wm_Updater {
150
  }
151
  }
152
 
153
- // Set new updates
154
- update_option( AI1WM_UPDATER, $updates );
155
  }
156
 
157
  /**
109
  /**
110
  * Check for extension updates
111
  *
112
+ * @return boolean
113
  */
114
  public static function check_for_updates() {
115
  // Get current updates
150
  }
151
  }
152
 
153
+ return update_option( AI1WM_UPDATER, $updates );
 
154
  }
155
 
156
  /**
lib/vendor/servmask/cron/class-ai1wm-cron.php CHANGED
@@ -33,34 +33,24 @@ class Ai1wm_Cron {
33
  * Schedules a hook which will be executed by the WordPress
34
  * actions core on a specific interval
35
  *
36
- * @param string $hook Event hook
37
- * @param string $recurrence How often the event should reoccur
38
- * @param array $args Arguments to pass to the hook function(s)
39
- * @param string $time Preferred time of day when the event shall be run, e.g. 23:59 (optional)
40
  * @return mixed
41
  */
42
- public static function add( $hook, $recurrence, $args = array(), $time = null ) {
43
  $schedules = wp_get_schedules();
44
 
45
- if ( is_null( $time ) ) {
46
- // Use current time as default
47
- $timestamp = time();
48
- } else {
49
- // Preferred time is used with current date
50
- $date = date( 'Y-m-d' );
51
- $datetime = sprintf( '%s %s', $date, $time );
52
- $timestamp = strtotime( $datetime );
53
- }
54
-
55
  if ( isset( $schedules[ $recurrence ] ) && ( $current = $schedules[ $recurrence ] ) ) {
56
- if ( $timestamp < time() ) {
57
- // Calculating number of intervals from $timestamp to the next run
58
- $intervals = ceil( ( time() - $timestamp ) / $current['interval'] );
59
- $duration = $intervals * $current['interval'];
60
-
61
- $timestamp += $duration;
62
  }
63
- return wp_schedule_event( $timestamp, $recurrence, $hook, array( $args ) );
 
64
  }
65
  }
66
 
@@ -90,4 +80,25 @@ class Ai1wm_Cron {
90
 
91
  return update_option( AI1WM_CRON, $cron );
92
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
33
  * Schedules a hook which will be executed by the WordPress
34
  * actions core on a specific interval
35
  *
36
+ * @param string $hook Event hook
37
+ * @param string $recurrence How often the event should reoccur
38
+ * @param integer $timestamp Preferred timestamp (when the event shall be run)
39
+ * @param array $args Arguments to pass to the hook function(s)
40
  * @return mixed
41
  */
42
+ public static function add( $hook, $recurrence, $timestamp, $args = array() ) {
43
  $schedules = wp_get_schedules();
44
 
45
+ // Schedule event
 
 
 
 
 
 
 
 
 
46
  if ( isset( $schedules[ $recurrence ] ) && ( $current = $schedules[ $recurrence ] ) ) {
47
+ if ( $timestamp <= ( $current_timestamp = time() ) ) {
48
+ while ( $timestamp <= $current_timestamp ) {
49
+ $timestamp += $current['interval'];
50
+ }
 
 
51
  }
52
+
53
+ return wp_schedule_event( $timestamp, $recurrence, $hook, $args );
54
  }
55
  }
56
 
80
 
81
  return update_option( AI1WM_CRON, $cron );
82
  }
83
+
84
+ /**
85
+ * Checks whether cronjob already exists
86
+ *
87
+ * @param string $hook Event hook
88
+ * @return boolean
89
+ */
90
+ public static function exists( $hook ) {
91
+ $cron = get_option( AI1WM_CRON, array() );
92
+ if ( empty( $cron ) ) {
93
+ return false;
94
+ }
95
+
96
+ foreach ( $cron as $timestamp => $hooks ) {
97
+ if ( isset( $hooks[ $hook ] ) ) {
98
+ return true;
99
+ }
100
+ }
101
+
102
+ return false;
103
+ }
104
  }
lib/vendor/servmask/filesystem/class-ai1wm-file.php CHANGED
@@ -72,4 +72,14 @@ class Ai1wm_File {
72
  public static function create_with_markers( $path, $marker, $content ) {
73
  return @insert_with_markers( $path, $marker, $content );
74
  }
 
 
 
 
 
 
 
 
 
 
75
  }
72
  public static function create_with_markers( $path, $marker, $content ) {
73
  return @insert_with_markers( $path, $marker, $content );
74
  }
75
+
76
+ /**
77
+ * Delete a file by path
78
+ *
79
+ * @param string $path Path to the file
80
+ * @return boolean
81
+ */
82
+ public static function delete( $path ) {
83
+ return @unlink( $path );
84
+ }
85
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: move, transfer, copy, migrate, backup, clone, restore, db migration, wordp
4
  Requires at least: 3.3
5
  Tested up to: 5.2
6
  Requires PHP: 5.2.17
7
- Stable tag: 6.95
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
  = 6.95 =
112
  **Changed**
113
 
4
  Requires at least: 3.3
5
  Tested up to: 5.2
6
  Requires PHP: 5.2.17
7
+ Stable tag: 6.96
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
+ = 6.96 =
112
+ **Fixed**
113
+
114
+ * Delete failed import/exports older than 24 hours
115
+
116
  = 6.95 =
117
  **Changed**
118