Cyr-To-Lat - Version 3.6.5

Version Description

(11.02.2019) = * Added queues for background slug conversion process

Download this release

Release Info

Developer mihdan
Plugin Icon 128x128 Cyr-To-Lat
Version 3.6.5
Comparing to
See all releases

Code changes from version 3.6.4 to 3.6.5

cyr-to-lat.php CHANGED
@@ -9,8 +9,8 @@
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
  * Requires at least: 2.3
11
  * Tested up to: 5.1
12
- * Version: 3.6.4
13
- * Stable tag: 3.6.4
14
  *
15
  * Text Domain: cyr-to-lat
16
  * Domain Path: /languages/
@@ -23,6 +23,11 @@ if ( ! defined( 'ABSPATH' ) ) {
23
  exit; // Exit if accessed directly.
24
  }
25
 
 
 
 
 
 
26
  /**
27
  * Path to the plugin dir.
28
  */
@@ -39,9 +44,19 @@ define( 'CYR_TO_LAT_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
39
  define( 'CYR_TO_LAT_FILE', __FILE__ );
40
 
41
  /**
42
- * Plugin version.
 
 
 
 
 
 
 
 
 
 
43
  */
44
- define( 'CYR_TO_LAT_VERSION', '3.6.4' );
45
 
46
  /**
47
  * Init plugin class on plugin load.
9
  * Author URI: https://profiles.wordpress.org/sergeybiryukov/
10
  * Requires at least: 2.3
11
  * Tested up to: 5.1
12
+ * Version: 3.6.5
13
+ * Stable tag: 3.6.5
14
  *
15
  * Text Domain: cyr-to-lat
16
  * Domain Path: /languages/
23
  exit; // Exit if accessed directly.
24
  }
25
 
26
+ /**
27
+ * Plugin version.
28
+ */
29
+ define( 'CYR_TO_LAT_VERSION', '3.6.5' );
30
+
31
  /**
32
  * Path to the plugin dir.
33
  */
44
  define( 'CYR_TO_LAT_FILE', __FILE__ );
45
 
46
  /**
47
+ * Plugin prefix.
48
+ */
49
+ define( 'CYR_TO_LAT_PREFIX', 'cyr_to_lat' );
50
+
51
+ /**
52
+ * Post conversion action.
53
+ */
54
+ define( 'CYR_TO_LAT_POST_CONVERSION_ACTION', 'post_conversion_action' );
55
+
56
+ /**
57
+ * Term conversion action.
58
  */
59
+ define( 'CYR_TO_LAT_TERM_CONVERSION_ACTION', 'term_conversion_action' );
60
 
61
  /**
62
  * Init plugin class on plugin load.
includes/background-processes/class-cyr-to-lat-post-conversion-process.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Background old post slugs converting process.
4
+ *
5
+ * @package cyr-to-lat
6
+ */
7
+
8
+ /**
9
+ * Class Cyr_To_Lat_Post_Conversion_Process
10
+ */
11
+ class Cyr_To_Lat_Post_Conversion_Process extends WP_Background_Process {
12
+
13
+ /**
14
+ * Prefix.
15
+ *
16
+ * @var string
17
+ */
18
+ protected $prefix = CYR_TO_LAT_PREFIX;
19
+
20
+ /**
21
+ * Process action name.
22
+ *
23
+ * @var string
24
+ */
25
+ protected $action = CYR_TO_LAT_POST_CONVERSION_ACTION;
26
+
27
+ /**
28
+ * Plugin main class.
29
+ *
30
+ * @var Cyr_To_Lat_Main
31
+ */
32
+ private $main;
33
+
34
+ /**
35
+ * Cyr_To_Lat_Post_Conversion_Process constructor.
36
+ *
37
+ * @param Cyr_To_Lat_Main $main Plugin main class.
38
+ */
39
+ public function __construct( $main ) {
40
+ $this->main = $main;
41
+
42
+ parent::__construct();
43
+ }
44
+
45
+ /**
46
+ * Task. Updates single post.
47
+ *
48
+ * @param stdClass $post Queue item to iterate over.
49
+ *
50
+ * @return mixed
51
+ */
52
+ protected function task( $post ) {
53
+ global $wpdb;
54
+
55
+ $sanitized_name = $this->main->ctl_sanitize_title( $post->post_name );
56
+
57
+ if ( $sanitized_name !== $post->post_name ) {
58
+ add_post_meta( $post->ID, '_wp_old_slug', $post->post_name );
59
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery
60
+ $wpdb->update( $wpdb->posts, array( 'post_name' => $sanitized_name ), array( 'ID' => $post->ID ) );
61
+ // phpcs:enable
62
+ }
63
+
64
+ $this->log( $post->post_name . ' => ' . $sanitized_name );
65
+
66
+ return false;
67
+ }
68
+
69
+ /**
70
+ * Complete
71
+ */
72
+ protected function complete() {
73
+ parent::complete();
74
+
75
+ $this->log( 'Post slugs conversion completed.' );
76
+ }
77
+
78
+ /**
79
+ * Log.
80
+ *
81
+ * @param string $message Message to log.
82
+ */
83
+ public function log( $message ) {
84
+ if ( WP_DEBUG_LOG ) {
85
+ error_log( $message );
86
+ }
87
+ }
88
+ }
includes/background-processes/class-cyr-to-lat-term-conversion-process.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Background old term slugs converting process.
4
+ *
5
+ * @package cyr-to-lat
6
+ */
7
+
8
+ /**
9
+ * Class Cyr_To_Lat_Term_Conversion_Process
10
+ */
11
+ class Cyr_To_Lat_Term_Conversion_Process extends WP_Background_Process {
12
+
13
+ /**
14
+ * Prefix.
15
+ *
16
+ * @var string
17
+ */
18
+ protected $prefix = CYR_TO_LAT_PREFIX;
19
+
20
+ /**
21
+ * Process action name.
22
+ *
23
+ * @var string
24
+ */
25
+ protected $action = CYR_TO_LAT_TERM_CONVERSION_ACTION;
26
+
27
+ /**
28
+ * Plugin main class.
29
+ *
30
+ * @var Cyr_To_Lat_Main
31
+ */
32
+ private $main;
33
+
34
+ /**
35
+ * Cyr_To_Lat_Post_Conversion_Process constructor.
36
+ *
37
+ * @param Cyr_To_Lat_Main $main Plugin main class.
38
+ */
39
+ public function __construct( $main ) {
40
+ $this->main = $main;
41
+
42
+ parent::__construct();
43
+ }
44
+
45
+ /**
46
+ * Task. Updates single term.
47
+ *
48
+ * @param stdClass $term Queue item to iterate over.
49
+ *
50
+ * @return mixed
51
+ */
52
+ protected function task( $term ) {
53
+ global $wpdb;
54
+
55
+ $sanitized_slug = $this->main->ctl_sanitize_title( $term->slug );
56
+
57
+ if ( $sanitized_slug !== $term->slug ) {
58
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery
59
+ $wpdb->update( $wpdb->terms, array( 'slug' => $sanitized_slug ), array( 'term_id' => $term->term_id ) );
60
+ // phpcs:enable
61
+ }
62
+
63
+ $this->log( $term->slug . ' => ' . $sanitized_slug );
64
+
65
+ return false;
66
+ }
67
+
68
+ /**
69
+ * Complete
70
+ */
71
+ protected function complete() {
72
+ parent::complete();
73
+
74
+ $this->log( 'Term slugs conversion completed.' );
75
+ }
76
+
77
+ /**
78
+ * Log.
79
+ *
80
+ * @param string $message Message to log.
81
+ */
82
+ public function log( $message ) {
83
+ if ( WP_DEBUG_LOG ) {
84
+ error_log( $message );
85
+ }
86
+ }
87
+ }
includes/class-cyr-to-lat-converter.php CHANGED
@@ -12,6 +12,11 @@
12
  */
13
  class Cyr_To_Lat_Converter {
14
 
 
 
 
 
 
15
  /**
16
  * Plugin main class.
17
  *
@@ -26,6 +31,20 @@ class Cyr_To_Lat_Converter {
26
  */
27
  private $settings;
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  /**
30
  * Cyr_To_Lat_Converter constructor.
31
  *
@@ -33,8 +52,10 @@ class Cyr_To_Lat_Converter {
33
  * @param Cyr_To_Lat_Settings $settings Plugin settings.
34
  */
35
  public function __construct( Cyr_To_Lat_Main $main, Cyr_To_Lat_Settings $settings ) {
36
- $this->main = $main;
37
- $this->settings = $settings;
 
 
38
  $this->init_hooks();
39
  }
40
 
@@ -42,45 +63,166 @@ class Cyr_To_Lat_Converter {
42
  * Init class hooks.
43
  */
44
  public function init_hooks() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  if ( 'yes' === $this->settings->get_option( 'convert_existing_slugs' ) ) {
46
  $this->settings->set_option( 'convert_existing_slugs', 'no' );
47
- add_action( 'shutdown', array( $this, 'convert_existing_slugs' ) );
48
  }
 
49
  }
50
 
51
  /**
52
- * Convert Existing Slugs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  */
54
  public function convert_existing_slugs() {
55
  global $wpdb;
56
 
 
 
57
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
58
- $posts = $wpdb->get_results( "SELECT ID, post_name FROM $wpdb->posts WHERE post_name REGEXP('[^A-Za-z0-9\-]+') AND post_status IN ('publish', 'future', 'private')" );
 
 
 
 
 
59
  // phpcs:enable
60
 
61
  foreach ( (array) $posts as $post ) {
62
- $sanitized_name = $this->main->ctl_sanitize_title( urldecode( $post->post_name ) );
63
-
64
- if ( $post->post_name !== $sanitized_name ) {
65
- add_post_meta( $post->ID, '_wp_old_slug', $post->post_name );
66
- // phpcs:disable WordPress.DB.DirectDatabaseQuery
67
- $wpdb->update( $wpdb->posts, array( 'post_name' => $sanitized_name ), array( 'ID' => $post->ID ) );
68
- // phpcs:enable
69
- }
70
  }
71
 
 
 
72
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
73
- $terms = $wpdb->get_results( "SELECT term_id, slug FROM $wpdb->terms WHERE slug REGEXP('[^A-Za-z0-9\-]+') " );
 
 
 
 
 
74
  // phpcs:enable
75
 
76
  foreach ( (array) $terms as $term ) {
77
- $sanitized_slug = $this->main->ctl_sanitize_title( urldecode( $term->slug ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- if ( $term->slug !== $sanitized_slug ) {
80
- // phpcs:disable WordPress.DB.DirectDatabaseQuery
81
- $wpdb->update( $wpdb->terms, array( 'slug' => $sanitized_slug ), array( 'term_id' => $term->term_id ) );
82
- // phpcs:enable
83
- }
 
 
 
 
 
 
 
 
 
 
 
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
  }
12
  */
13
  class Cyr_To_Lat_Converter {
14
 
15
+ /**
16
+ * Query arg in url to start conversion.
17
+ */
18
+ const QUERY_ARG = 'cyr-to-lat-convert';
19
+
20
  /**
21
  * Plugin main class.
22
  *
31
  */
32
  private $settings;
33
 
34
+ /**
35
+ * Background process to convert posts.
36
+ *
37
+ * @var Cyr_To_Lat_Post_Conversion_Process
38
+ */
39
+ private $process_all_posts;
40
+
41
+ /**
42
+ * Background process to convert terms.
43
+ *
44
+ * @var Cyr_To_Lat_Term_Conversion_Process
45
+ */
46
+ private $process_all_terms;
47
+
48
  /**
49
  * Cyr_To_Lat_Converter constructor.
50
  *
52
  * @param Cyr_To_Lat_Settings $settings Plugin settings.
53
  */
54
  public function __construct( Cyr_To_Lat_Main $main, Cyr_To_Lat_Settings $settings ) {
55
+ $this->main = $main;
56
+ $this->settings = $settings;
57
+ $this->process_all_posts = new Cyr_To_Lat_Post_Conversion_Process( $main );
58
+ $this->process_all_terms = new Cyr_To_Lat_Term_Conversion_Process( $main );
59
  $this->init_hooks();
60
  }
61
 
63
  * Init class hooks.
64
  */
65
  public function init_hooks() {
66
+ add_action( 'init', array( $this, 'process_handler' ) );
67
+
68
+ /**
69
+ * Fix bug in WP_Background_Process::memory_exceeded() function.
70
+ * See hook.
71
+ */
72
+ add_filter(
73
+ CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_POST_CONVERSION_ACTION . '_memory_exceeded',
74
+ array( $this, 'memory_exceeded_filter' )
75
+ );
76
+ add_filter(
77
+ CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_TERM_CONVERSION_ACTION . '_memory_exceeded',
78
+ array( $this, 'memory_exceeded_filter' )
79
+ );
80
+
81
+ // Do not limit execution time with WP_CLI.
82
+ add_filter(
83
+ CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_POST_CONVERSION_ACTION . '_time_exceeded',
84
+ array( $this, 'time_exceeded_filter' )
85
+ );
86
+ add_filter(
87
+ CYR_TO_LAT_PREFIX . '_' . CYR_TO_LAT_TERM_CONVERSION_ACTION . '_time_exceeded',
88
+ array( $this, 'time_exceeded_filter' )
89
+ );
90
+
91
  if ( 'yes' === $this->settings->get_option( 'convert_existing_slugs' ) ) {
92
  $this->settings->set_option( 'convert_existing_slugs', 'no' );
93
+ add_action( 'init', array( $this, 'convert_existing_slugs' ) );
94
  }
95
+
96
  }
97
 
98
  /**
99
+ * Process handler.
100
+ */
101
+ public function process_handler() {
102
+ if ( ! isset( $_GET[ self::QUERY_ARG ] ) || ! isset( $_GET['_wpnonce'] ) ) {
103
+ return;
104
+ }
105
+
106
+ if ( ! wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), self::QUERY_ARG ) ) {
107
+ return;
108
+ }
109
+
110
+ $this->convert_existing_slugs();
111
+ }
112
+
113
+ /**
114
+ * Convert Existing Slugs.
115
  */
116
  public function convert_existing_slugs() {
117
  global $wpdb;
118
 
119
+ $regexp = '[^A-Za-z0-9[.hyphen.][.underscore.][.period.][.apostrophe.]]+';
120
+
121
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
122
+ $posts = $wpdb->get_results(
123
+ $wpdb->prepare(
124
+ "SELECT ID, post_name FROM $wpdb->posts WHERE post_name REGEXP(%s) AND post_status IN ('publish', 'future', 'private')",
125
+ $regexp
126
+ )
127
+ );
128
  // phpcs:enable
129
 
130
  foreach ( (array) $posts as $post ) {
131
+ $this->process_all_posts->push_to_queue( $post );
 
 
 
 
 
 
 
132
  }
133
 
134
+ $this->process_all_posts->save()->dispatch();
135
+
136
  // phpcs:disable WordPress.DB.DirectDatabaseQuery
137
+ $terms = $wpdb->get_results(
138
+ $wpdb->prepare(
139
+ "SELECT term_id, slug FROM $wpdb->terms WHERE slug REGEXP(%s)",
140
+ $regexp
141
+ )
142
+ );
143
  // phpcs:enable
144
 
145
  foreach ( (array) $terms as $term ) {
146
+ $this->process_all_terms->push_to_queue( $term );
147
+ }
148
+
149
+ $this->process_all_terms->save()->dispatch();
150
+ }
151
+
152
+ /**
153
+ * Filter WP_Background_Process::memory_exceeded() result.
154
+ * This function expects memory limit coded in php.ini only in megabytes ( as '128M', for instance).
155
+ * Thus, it returns wrong result when memory limit is encoded in other way.
156
+ *
157
+ * Filter does this job again.
158
+ *
159
+ * @param bool $return If memory is exceeded.
160
+ *
161
+ * @return mixed
162
+ */
163
+ public function memory_exceeded_filter( $return ) {
164
+ $memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory
165
+ $current_memory = memory_get_usage( true );
166
+
167
+ return $current_memory >= $memory_limit;
168
+ }
169
 
170
+ /**
171
+ * Get memory limit in bytes.
172
+ *
173
+ * @return int
174
+ */
175
+ protected function get_memory_limit() {
176
+ if ( function_exists( 'ini_get' ) ) {
177
+ $memory_limit = ini_get( 'memory_limit' );
178
+ } else {
179
+ // Sensible default.
180
+ $memory_limit = '128M';
181
+ }
182
+
183
+ if ( ! $memory_limit || - 1 === intval( $memory_limit ) ) {
184
+ // Unlimited, set to 32GB.
185
+ $memory_limit = '32000M';
186
  }
187
+
188
+ return $this->convert_shorthand_to_bytes( $memory_limit );
189
+ }
190
+
191
+ /**
192
+ * Converts a shorthand byte value to an integer byte value.
193
+ *
194
+ * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
195
+ * @return int An integer byte value.
196
+ */
197
+ protected function convert_shorthand_to_bytes( $value ) {
198
+ $value = strtolower( trim( $value ) );
199
+ $bytes = (int) $value;
200
+
201
+ if ( false !== strpos( $value, 'g' ) ) {
202
+ $bytes *= 1024 * 1024 * 1024;
203
+ } elseif ( false !== strpos( $value, 'm' ) ) {
204
+ $bytes *= 1024 * 1024;
205
+ } elseif ( false !== strpos( $value, 'k' ) ) {
206
+ $bytes *= 1024;
207
+ }
208
+
209
+ // Deal with large (float) values which run into the maximum integer size.
210
+ return min( $bytes, PHP_INT_MAX );
211
+ }
212
+
213
+ /**
214
+ * Filter WP_Background_Process::time_exceeded() result.
215
+ * Return false with WP_CLI.
216
+ *
217
+ * @param bool $return If memory is exceeded.
218
+ *
219
+ * @return mixed
220
+ */
221
+ protected function time_exceeded_filter( $return ) {
222
+ if ( defined( 'WP_CLI' ) && WP_CLI ) {
223
+ return false;
224
+ }
225
+
226
+ return $return;
227
  }
228
  }
includes/class-cyr-to-lat-main.php CHANGED
@@ -37,9 +37,9 @@ class Cyr_To_Lat_Main {
37
  */
38
  public function init() {
39
  $this->settings = new Cyr_To_Lat_Settings();
 
40
 
41
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
42
- $converter = new Cyr_To_Lat_Converter( $this, $this->settings );
43
  $this->cli = new Cyr_To_Lat_WP_CLI( $converter );
44
  try {
45
  /**
@@ -116,7 +116,7 @@ class Cyr_To_Lat_Main {
116
  $title = iconv( 'UTF-8', 'UTF-8//TRANSLIT//IGNORE', $title );
117
  }
118
 
119
- $title = preg_replace( "/[^A-Za-z0-9'_\-\.%]/", '-', $title );
120
  $title = preg_replace( '/\-+/', '-', $title );
121
  $title = trim( $title, '-' );
122
  }
37
  */
38
  public function init() {
39
  $this->settings = new Cyr_To_Lat_Settings();
40
+ $converter = new Cyr_To_Lat_Converter( $this, $this->settings );
41
 
42
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
 
43
  $this->cli = new Cyr_To_Lat_WP_CLI( $converter );
44
  try {
45
  /**
116
  $title = iconv( 'UTF-8', 'UTF-8//TRANSLIT//IGNORE', $title );
117
  }
118
 
119
+ $title = preg_replace( "/[^A-Za-z0-9'_\-\.]/", '-', $title );
120
  $title = preg_replace( '/\-+/', '-', $title );
121
  $title = trim( $title, '-' );
122
  }
includes/class-cyr-to-lat-wp-cli.php CHANGED
@@ -52,12 +52,6 @@ class Cyr_To_Lat_WP_CLI extends WP_CLI_Command {
52
  */
53
  $notify = \WP_CLI\Utils\make_progress_bar( 'Regenerate old slugs', 1 );
54
 
55
- //for ( $i = 0; $i < 5; $i ++ ) {
56
- /// sleep( wp_rand( 1, 2 ) );
57
- // $notify->tick();
58
- //}
59
- //$notify->finish();
60
-
61
  $this->converter->convert_existing_slugs();
62
  $notify->tick();
63
  $notify->finish();
52
  */
53
  $notify = \WP_CLI\Utils\make_progress_bar( 'Regenerate old slugs', 1 );
54
 
 
 
 
 
 
 
55
  $this->converter->convert_existing_slugs();
56
  $notify->tick();
57
  $notify->finish();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kaggdesign
3
  Tags: cyrillic, georgian, latin, l10n, russian, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
  Tested up to: 5.1
6
- Stable tag: 3.6.4
7
  Requires PHP: 5.2
8
 
9
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
@@ -46,6 +46,9 @@ Yes you can! Join in on our [GitHub repository](https://github.com/mihdan/cyr2la
46
 
47
  == Changelog ==
48
 
 
 
 
49
  = 3.6.4 (06.02.2019) =
50
  * Fixed bug with `_wp_old_slug` redirect.
51
  * Fixed bug with `urldecode` in posts.
3
  Tags: cyrillic, georgian, latin, l10n, russian, rustolat, slugs, translations, transliteration
4
  Requires at least: 2.3
5
  Tested up to: 5.1
6
+ Stable tag: 3.6.5
7
  Requires PHP: 5.2
8
 
9
  Converts Cyrillic characters in post, page and term slugs to Latin characters.
46
 
47
  == Changelog ==
48
 
49
+ = 3.6.5 (11.02.2019) =
50
+ * Added queues for background slug conversion process
51
+
52
  = 3.6.4 (06.02.2019) =
53
  * Fixed bug with `_wp_old_slug` redirect.
54
  * Fixed bug with `urldecode` in posts.
vendor/a5hleyrich/wp-background-processing/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /vendor/
vendor/a5hleyrich/wp-background-processing/README.md ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WP Background Processing
2
+
3
+ WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks. Check out the [example plugin](https://github.com/A5hleyRich/wp-background-processing-example) or read the [accompanying article](https://deliciousbrains.com/background-processing-wordpress/).
4
+
5
+ Inspired by [TechCrunch WP Asynchronous Tasks](https://github.com/techcrunch/wp-async-task).
6
+
7
+ __Requires PHP 5.2+__
8
+
9
+ ### Async Request
10
+
11
+ Async requests are useful for pushing slow one-off tasks such as sending emails to a background process. Once the request has been dispatched it will process in the background instantly.
12
+
13
+ Extend the `WP_Async_Request` class:
14
+
15
+ ```php
16
+ class WP_Example_Request extends WP_Async_Request {
17
+
18
+ /**
19
+ * @var string
20
+ */
21
+ protected $action = 'example_request';
22
+
23
+ /**
24
+ * Handle
25
+ *
26
+ * Override this method to perform any actions required
27
+ * during the async request.
28
+ */
29
+ protected function handle() {
30
+ // Actions to perform
31
+ }
32
+
33
+ }
34
+ ```
35
+
36
+ ##### `protected $action`
37
+
38
+ Should be set to a unique name.
39
+
40
+ ##### `protected function handle()`
41
+
42
+ Should contain any logic to perform during the non-blocking request. The data passed to the request will be accessible via `$_POST`.
43
+
44
+ ##### Dispatching Requests
45
+
46
+ Instantiate your request:
47
+
48
+ `$this->example_request = new WP_Example_Request();`
49
+
50
+ Add data to the request if required:
51
+
52
+ `$this->example_request->data( array( 'value1' => $value1, 'value2' => $value2 ) );`
53
+
54
+ Fire off the request:
55
+
56
+ `$this->example_request->dispatch();`
57
+
58
+ Chaining is also supported:
59
+
60
+ `$this->example_request->data( array( 'data' => $data ) )->dispatch();`
61
+
62
+ ### Background Process
63
+
64
+ Background processes work in a similar fashion to async requests but they allow you to queue tasks. Items pushed onto the queue will be processed in the background once the queue has been dispatched. Queues will also scale based on available server resources, so higher end servers will process more items per batch. Once a batch has completed the next batch will start instantly.
65
+
66
+ Health checks run by default every 5 minutes to ensure the queue is running when queued items exist. If the queue has failed it will be restarted.
67
+
68
+ Queues work on a first in first out basis, which allows additional items to be pushed to the queue even if it’s already processing.
69
+
70
+ Extend the `WP_Background_Process` class:
71
+
72
+ ```php
73
+ class WP_Example_Process extends WP_Background_Process {
74
+
75
+ /**
76
+ * @var string
77
+ */
78
+ protected $action = 'example_process';
79
+
80
+ /**
81
+ * Task
82
+ *
83
+ * Override this method to perform any actions required on each
84
+ * queue item. Return the modified item for further processing
85
+ * in the next pass through. Or, return false to remove the
86
+ * item from the queue.
87
+ *
88
+ * @param mixed $item Queue item to iterate over
89
+ *
90
+ * @return mixed
91
+ */
92
+ protected function task( $item ) {
93
+ // Actions to perform
94
+
95
+ return false;
96
+ }
97
+
98
+ /**
99
+ * Complete
100
+ *
101
+ * Override if applicable, but ensure that the below actions are
102
+ * performed, or, call parent::complete().
103
+ */
104
+ protected function complete() {
105
+ parent::complete();
106
+
107
+ // Show notice to user or perform some other arbitrary task...
108
+ }
109
+
110
+ }
111
+ ```
112
+
113
+ ##### `protected $action`
114
+
115
+ Should be set to a unique name.
116
+
117
+ ##### `protected function task( $item )`
118
+
119
+ Should contain any logic to perform on the queued item. Return `false` to remove the item from the queue or return `$item` to push it back onto the queue for further processing. If the item has been modified and is pushed back onto the queue the current state will be saved before the batch is exited.
120
+
121
+ ##### `protected function complete()`
122
+
123
+ Optionally contain any logic to perform once the queue has completed.
124
+
125
+ ##### Dispatching Processes
126
+
127
+ Instantiate your process:
128
+
129
+ `$this->example_process = new WP_Example_Process();`
130
+
131
+ Push items to the queue:
132
+
133
+ ```php
134
+ foreach ( $items as $item ) {
135
+ $this->example_process->push_to_queue( $item );
136
+ }
137
+ ```
138
+
139
+ Save and dispatch the queue:
140
+
141
+ `$this->example_process->save()->dispatch();`
142
+
143
+ ### BasicAuth
144
+
145
+ If your site is behind BasicAuth, both async requests and background processes will fail to complete. This is because WP Background Processing relies on the [WordPress HTTP API](http://codex.wordpress.org/HTTP_API), which requires you to attach your BasicAuth credentials to requests. The easiest way to do this is using the following filter:
146
+
147
+ ```php
148
+ function wpbp_http_request_args( $r, $url ) {
149
+ $r['headers']['Authorization'] = 'Basic ' . base64_encode( USERNAME . ':' . PASSWORD );
150
+
151
+ return $r;
152
+ }
153
+ add_filter( 'http_request_args', 'wpbp_http_request_args', 10, 2);
154
+ ```
155
+
156
+ ## License
157
+
158
+ [GPLv2+](http://www.gnu.org/licenses/gpl-2.0.html)
vendor/a5hleyrich/wp-background-processing/classes/wp-async-request.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Async Request
4
+ *
5
+ * @package WP-Background-Processing
6
+ */
7
+
8
+ if ( ! class_exists( 'WP_Async_Request' ) ) {
9
+
10
+ /**
11
+ * Abstract WP_Async_Request class.
12
+ *
13
+ * @abstract
14
+ */
15
+ abstract class WP_Async_Request {
16
+
17
+ /**
18
+ * Prefix
19
+ *
20
+ * (default value: 'wp')
21
+ *
22
+ * @var string
23
+ * @access protected
24
+ */
25
+ protected $prefix = 'wp';
26
+
27
+ /**
28
+ * Action
29
+ *
30
+ * (default value: 'async_request')
31
+ *
32
+ * @var string
33
+ * @access protected
34
+ */
35
+ protected $action = 'async_request';
36
+
37
+ /**
38
+ * Identifier
39
+ *
40
+ * @var mixed
41
+ * @access protected
42
+ */
43
+ protected $identifier;
44
+
45
+ /**
46
+ * Data
47
+ *
48
+ * (default value: array())
49
+ *
50
+ * @var array
51
+ * @access protected
52
+ */
53
+ protected $data = array();
54
+
55
+ /**
56
+ * Initiate new async request
57
+ */
58
+ public function __construct() {
59
+ $this->identifier = $this->prefix . '_' . $this->action;
60
+
61
+ add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
62
+ add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
63
+ }
64
+
65
+ /**
66
+ * Set data used during the request
67
+ *
68
+ * @param array $data Data.
69
+ *
70
+ * @return $this
71
+ */
72
+ public function data( $data ) {
73
+ $this->data = $data;
74
+
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * Dispatch the async request
80
+ *
81
+ * @return array|WP_Error
82
+ */
83
+ public function dispatch() {
84
+ $url = add_query_arg( $this->get_query_args(), $this->get_query_url() );
85
+ $args = $this->get_post_args();
86
+
87
+ return wp_remote_post( esc_url_raw( $url ), $args );
88
+ }
89
+
90
+ /**
91
+ * Get query args
92
+ *
93
+ * @return array
94
+ */
95
+ protected function get_query_args() {
96
+ if ( property_exists( $this, 'query_args' ) ) {
97
+ return $this->query_args;
98
+ }
99
+
100
+ return array(
101
+ 'action' => $this->identifier,
102
+ 'nonce' => wp_create_nonce( $this->identifier ),
103
+ );
104
+ }
105
+
106
+ /**
107
+ * Get query URL
108
+ *
109
+ * @return string
110
+ */
111
+ protected function get_query_url() {
112
+ if ( property_exists( $this, 'query_url' ) ) {
113
+ return $this->query_url;
114
+ }
115
+
116
+ return admin_url( 'admin-ajax.php' );
117
+ }
118
+
119
+ /**
120
+ * Get post args
121
+ *
122
+ * @return array
123
+ */
124
+ protected function get_post_args() {
125
+ if ( property_exists( $this, 'post_args' ) ) {
126
+ return $this->post_args;
127
+ }
128
+
129
+ return array(
130
+ 'timeout' => 0.01,
131
+ 'blocking' => false,
132
+ 'body' => $this->data,
133
+ 'cookies' => $_COOKIE,
134
+ 'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
135
+ );
136
+ }
137
+
138
+ /**
139
+ * Maybe handle
140
+ *
141
+ * Check for correct nonce and pass to handler.
142
+ */
143
+ public function maybe_handle() {
144
+ // Don't lock up other requests while processing
145
+ session_write_close();
146
+
147
+ check_ajax_referer( $this->identifier, 'nonce' );
148
+
149
+ $this->handle();
150
+
151
+ wp_die();
152
+ }
153
+
154
+ /**
155
+ * Handle
156
+ *
157
+ * Override this method to perform any actions required
158
+ * during the async request.
159
+ */
160
+ abstract protected function handle();
161
+
162
+ }
163
+ }
vendor/a5hleyrich/wp-background-processing/classes/wp-background-process.php ADDED
@@ -0,0 +1,506 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Background Process
4
+ *
5
+ * @package WP-Background-Processing
6
+ */
7
+
8
+ if ( ! class_exists( 'WP_Background_Process' ) ) {
9
+
10
+ /**
11
+ * Abstract WP_Background_Process class.
12
+ *
13
+ * @abstract
14
+ * @extends WP_Async_Request
15
+ */
16
+ abstract class WP_Background_Process extends WP_Async_Request {
17
+
18
+ /**
19
+ * Action
20
+ *
21
+ * (default value: 'background_process')
22
+ *
23
+ * @var string
24
+ * @access protected
25
+ */
26
+ protected $action = 'background_process';
27
+
28
+ /**
29
+ * Start time of current process.
30
+ *
31
+ * (default value: 0)
32
+ *
33
+ * @var int
34
+ * @access protected
35
+ */
36
+ protected $start_time = 0;
37
+
38
+ /**
39
+ * Cron_hook_identifier
40
+ *
41
+ * @var mixed
42
+ * @access protected
43
+ */
44
+ protected $cron_hook_identifier;
45
+
46
+ /**
47
+ * Cron_interval_identifier
48
+ *
49
+ * @var mixed
50
+ * @access protected
51
+ */
52
+ protected $cron_interval_identifier;
53
+
54
+ /**
55
+ * Initiate new background process
56
+ */
57
+ public function __construct() {
58
+ parent::__construct();
59
+
60
+ $this->cron_hook_identifier = $this->identifier . '_cron';
61
+ $this->cron_interval_identifier = $this->identifier . '_cron_interval';
62
+
63
+ add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) );
64
+ add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) );
65
+ }
66
+
67
+ /**
68
+ * Dispatch
69
+ *
70
+ * @access public
71
+ * @return void
72
+ */
73
+ public function dispatch() {
74
+ // Schedule the cron healthcheck.
75
+ $this->schedule_event();
76
+
77
+ // Perform remote post.
78
+ return parent::dispatch();
79
+ }
80
+
81
+ /**
82
+ * Push to queue
83
+ *
84
+ * @param mixed $data Data.
85
+ *
86
+ * @return $this
87
+ */
88
+ public function push_to_queue( $data ) {
89
+ $this->data[] = $data;
90
+
91
+ return $this;
92
+ }
93
+
94
+ /**
95
+ * Save queue
96
+ *
97
+ * @return $this
98
+ */
99
+ public function save() {
100
+ $key = $this->generate_key();
101
+
102
+ if ( ! empty( $this->data ) ) {
103
+ update_site_option( $key, $this->data );
104
+ }
105
+
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * Update queue
111
+ *
112
+ * @param string $key Key.
113
+ * @param array $data Data.
114
+ *
115
+ * @return $this
116
+ */
117
+ public function update( $key, $data ) {
118
+ if ( ! empty( $data ) ) {
119
+ update_site_option( $key, $data );
120
+ }
121
+
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Delete queue
127
+ *
128
+ * @param string $key Key.
129
+ *
130
+ * @return $this
131
+ */
132
+ public function delete( $key ) {
133
+ delete_site_option( $key );
134
+
135
+ return $this;
136
+ }
137
+
138
+ /**
139
+ * Generate key
140
+ *
141
+ * Generates a unique key based on microtime. Queue items are
142
+ * given a unique key so that they can be merged upon save.
143
+ *
144
+ * @param int $length Length.
145
+ *
146
+ * @return string
147
+ */
148
+ protected function generate_key( $length = 64 ) {
149
+ $unique = md5( microtime() . rand() );
150
+ $prepend = $this->identifier . '_batch_';
151
+
152
+ return substr( $prepend . $unique, 0, $length );
153
+ }
154
+
155
+ /**
156
+ * Maybe process queue
157
+ *
158
+ * Checks whether data exists within the queue and that
159
+ * the process is not already running.
160
+ */
161
+ public function maybe_handle() {
162
+ // Don't lock up other requests while processing
163
+ session_write_close();
164
+
165
+ if ( $this->is_process_running() ) {
166
+ // Background process already running.
167
+ wp_die();
168
+ }
169
+
170
+ if ( $this->is_queue_empty() ) {
171
+ // No data to process.
172
+ wp_die();
173
+ }
174
+
175
+ check_ajax_referer( $this->identifier, 'nonce' );
176
+
177
+ $this->handle();
178
+
179
+ wp_die();
180
+ }
181
+
182
+ /**
183
+ * Is queue empty
184
+ *
185
+ * @return bool
186
+ */
187
+ protected function is_queue_empty() {
188
+ global $wpdb;
189
+
190
+ $table = $wpdb->options;
191
+ $column = 'option_name';
192
+
193
+ if ( is_multisite() ) {
194
+ $table = $wpdb->sitemeta;
195
+ $column = 'meta_key';
196
+ }
197
+
198
+ $key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
199
+
200
+ $count = $wpdb->get_var( $wpdb->prepare( "
201
+ SELECT COUNT(*)
202
+ FROM {$table}
203
+ WHERE {$column} LIKE %s
204
+ ", $key ) );
205
+
206
+ return ( $count > 0 ) ? false : true;
207
+ }
208
+
209
+ /**
210
+ * Is process running
211
+ *
212
+ * Check whether the current process is already running
213
+ * in a background process.
214
+ */
215
+ protected function is_process_running() {
216
+ if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
217
+ // Process already running.
218
+ return true;
219
+ }
220
+
221
+ return false;
222
+ }
223
+
224
+ /**
225
+ * Lock process
226
+ *
227
+ * Lock the process so that multiple instances can't run simultaneously.
228
+ * Override if applicable, but the duration should be greater than that
229
+ * defined in the time_exceeded() method.
230
+ */
231
+ protected function lock_process() {
232
+ $this->start_time = time(); // Set start time of current process.
233
+
234
+ $lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
235
+ $lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
236
+
237
+ set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
238
+ }
239
+
240
+ /**
241
+ * Unlock process
242
+ *
243
+ * Unlock the process so that other instances can spawn.
244
+ *
245
+ * @return $this
246
+ */
247
+ protected function unlock_process() {
248
+ delete_site_transient( $this->identifier . '_process_lock' );
249
+
250
+ return $this;
251
+ }
252
+
253
+ /**
254
+ * Get batch
255
+ *
256
+ * @return stdClass Return the first batch from the queue
257
+ */
258
+ protected function get_batch() {
259
+ global $wpdb;
260
+
261
+ $table = $wpdb->options;
262
+ $column = 'option_name';
263
+ $key_column = 'option_id';
264
+ $value_column = 'option_value';
265
+
266
+ if ( is_multisite() ) {
267
+ $table = $wpdb->sitemeta;
268
+ $column = 'meta_key';
269
+ $key_column = 'meta_id';
270
+ $value_column = 'meta_value';
271
+ }
272
+
273
+ $key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
274
+
275
+ $query = $wpdb->get_row( $wpdb->prepare( "
276
+ SELECT *
277
+ FROM {$table}
278
+ WHERE {$column} LIKE %s
279
+ ORDER BY {$key_column} ASC
280
+ LIMIT 1
281
+ ", $key ) );
282
+
283
+ $batch = new stdClass();
284
+ $batch->key = $query->$column;
285
+ $batch->data = maybe_unserialize( $query->$value_column );
286
+
287
+ return $batch;
288
+ }
289
+
290
+ /**
291
+ * Handle
292
+ *
293
+ * Pass each queue item to the task handler, while remaining
294
+ * within server memory and time limit constraints.
295
+ */
296
+ protected function handle() {
297
+ $this->lock_process();
298
+
299
+ do {
300
+ $batch = $this->get_batch();
301
+
302
+ foreach ( $batch->data as $key => $value ) {
303
+ $task = $this->task( $value );
304
+
305
+ if ( false !== $task ) {
306
+ $batch->data[ $key ] = $task;
307
+ } else {
308
+ unset( $batch->data[ $key ] );
309
+ }
310
+
311
+ if ( $this->time_exceeded() || $this->memory_exceeded() ) {
312
+ // Batch limits reached.
313
+ break;
314
+ }
315
+ }
316
+
317
+ // Update or delete current batch.
318
+ if ( ! empty( $batch->data ) ) {
319
+ $this->update( $batch->key, $batch->data );
320
+ } else {
321
+ $this->delete( $batch->key );
322
+ }
323
+ } while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() );
324
+
325
+ $this->unlock_process();
326
+
327
+ // Start next batch or complete process.
328
+ if ( ! $this->is_queue_empty() ) {
329
+ $this->dispatch();
330
+ } else {
331
+ $this->complete();
332
+ }
333
+
334
+ wp_die();
335
+ }
336
+
337
+ /**
338
+ * Memory exceeded
339
+ *
340
+ * Ensures the batch process never exceeds 90%
341
+ * of the maximum WordPress memory.
342
+ *
343
+ * @return bool
344
+ */
345
+ protected function memory_exceeded() {
346
+ $memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory
347
+ $current_memory = memory_get_usage( true );
348
+ $return = false;
349
+
350
+ if ( $current_memory >= $memory_limit ) {
351
+ $return = true;
352
+ }
353
+
354
+ return apply_filters( $this->identifier . '_memory_exceeded', $return );
355
+ }
356
+
357
+ /**
358
+ * Get memory limit
359
+ *
360
+ * @return int
361
+ */
362
+ protected function get_memory_limit() {
363
+ if ( function_exists( 'ini_get' ) ) {
364
+ $memory_limit = ini_get( 'memory_limit' );
365
+ } else {
366
+ // Sensible default.
367
+ $memory_limit = '128M';
368
+ }
369
+
370
+ if ( ! $memory_limit || -1 === intval( $memory_limit ) ) {
371
+ // Unlimited, set to 32GB.
372
+ $memory_limit = '32000M';
373
+ }
374
+
375
+ return intval( $memory_limit ) * 1024 * 1024;
376
+ }
377
+
378
+ /**
379
+ * Time exceeded.
380
+ *
381
+ * Ensures the batch never exceeds a sensible time limit.
382
+ * A timeout limit of 30s is common on shared hosting.
383
+ *
384
+ * @return bool
385
+ */
386
+ protected function time_exceeded() {
387
+ $finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds
388
+ $return = false;
389
+
390
+ if ( time() >= $finish ) {
391
+ $return = true;
392
+ }
393
+
394
+ return apply_filters( $this->identifier . '_time_exceeded', $return );
395
+ }
396
+
397
+ /**
398
+ * Complete.
399
+ *
400
+ * Override if applicable, but ensure that the below actions are
401
+ * performed, or, call parent::complete().
402
+ */
403
+ protected function complete() {
404
+ // Unschedule the cron healthcheck.
405
+ $this->clear_scheduled_event();
406
+ }
407
+
408
+ /**
409
+ * Schedule cron healthcheck
410
+ *
411
+ * @access public
412
+ * @param mixed $schedules Schedules.
413
+ * @return mixed
414
+ */
415
+ public function schedule_cron_healthcheck( $schedules ) {
416
+ $interval = apply_filters( $this->identifier . '_cron_interval', 5 );
417
+
418
+ if ( property_exists( $this, 'cron_interval' ) ) {
419
+ $interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval );
420
+ }
421
+
422
+ // Adds every 5 minutes to the existing schedules.
423
+ $schedules[ $this->identifier . '_cron_interval' ] = array(
424
+ 'interval' => MINUTE_IN_SECONDS * $interval,
425
+ 'display' => sprintf( __( 'Every %d Minutes' ), $interval ),
426
+ );
427
+
428
+ return $schedules;
429
+ }
430
+
431
+ /**
432
+ * Handle cron healthcheck
433
+ *
434
+ * Restart the background process if not already running
435
+ * and data exists in the queue.
436
+ */
437
+ public function handle_cron_healthcheck() {
438
+ if ( $this->is_process_running() ) {
439
+ // Background process already running.
440
+ exit;
441
+ }
442
+
443
+ if ( $this->is_queue_empty() ) {
444
+ // No data to process.
445
+ $this->clear_scheduled_event();
446
+ exit;
447
+ }
448
+
449
+ $this->handle();
450
+
451
+ exit;
452
+ }
453
+
454
+ /**
455
+ * Schedule event
456
+ */
457
+ protected function schedule_event() {
458
+ if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
459
+ wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier );
460
+ }
461
+ }
462
+
463
+ /**
464
+ * Clear scheduled event
465
+ */
466
+ protected function clear_scheduled_event() {
467
+ $timestamp = wp_next_scheduled( $this->cron_hook_identifier );
468
+
469
+ if ( $timestamp ) {
470
+ wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
471
+ }
472
+ }
473
+
474
+ /**
475
+ * Cancel Process
476
+ *
477
+ * Stop processing queue items, clear cronjob and delete batch.
478
+ *
479
+ */
480
+ public function cancel_process() {
481
+ if ( ! $this->is_queue_empty() ) {
482
+ $batch = $this->get_batch();
483
+
484
+ $this->delete( $batch->key );
485
+
486
+ wp_clear_scheduled_hook( $this->cron_hook_identifier );
487
+ }
488
+
489
+ }
490
+
491
+ /**
492
+ * Task
493
+ *
494
+ * Override this method to perform any actions required on each
495
+ * queue item. Return the modified item for further processing
496
+ * in the next pass through. Or, return false to remove the
497
+ * item from the queue.
498
+ *
499
+ * @param mixed $item Queue item to iterate over.
500
+ *
501
+ * @return mixed
502
+ */
503
+ abstract protected function task( $item );
504
+
505
+ }
506
+ }
vendor/a5hleyrich/wp-background-processing/composer.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "a5hleyrich/wp-background-processing",
3
+ "description": "WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.",
4
+ "type": "library",
5
+ "require": {
6
+ "php": ">=5.2"
7
+ },
8
+ "license": "GPL-2.0-only",
9
+ "authors": [
10
+ {
11
+ "name": "Ashley Rich",
12
+ "email": "hello@ashleyrich.com"
13
+ }
14
+ ],
15
+ "autoload": {
16
+ "classmap": [ "classes/" ]
17
+ }
18
+ }
vendor/a5hleyrich/wp-background-processing/license.txt ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your
13
+ freedom to share and change it. By contrast, the GNU General Public
14
+ License is intended to guarantee your freedom to share and change free
15
+ software--to make sure the software is free for all its users. This
16
+ General Public License applies to most of the Free Software
17
+ Foundation's software and to any other program whose authors commit to
18
+ using it. (Some other Free Software Foundation software is covered by
19
+ the GNU Library General Public License instead.) You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ this service if you wish), that you receive source code or can get it
26
+ if you want it, that you can change the software or use pieces of it
27
+ in new free programs; and that you know you can do these things.
28
+
29
+ To protect your rights, we need to make restrictions that forbid
30
+ anyone to deny you these rights or to ask you to surrender the rights.
31
+ These restrictions translate to certain responsibilities for you if you
32
+ distribute copies of the software, or if you modify it.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must give the recipients all the rights that
36
+ you have. You must make sure that they, too, receive or can get the
37
+ source code. And you must show them these terms so they know their
38
+ rights.
39
+
40
+ We protect your rights with two steps: (1) copyright the software, and
41
+ (2) offer you this license which gives you legal permission to copy,
42
+ distribute and/or modify the software.
43
+
44
+ Also, for each author's protection and ours, we want to make certain
45
+ that everyone understands that there is no warranty for this free
46
+ software. If the software is modified by someone else and passed on, we
47
+ want its recipients to know that what they have is not the original, so
48
+ that any problems introduced by others will not reflect on the original
49
+ authors' reputations.
50
+
51
+ Finally, any free program is threatened constantly by software
52
+ patents. We wish to avoid the danger that redistributors of a free
53
+ program will individually obtain patent licenses, in effect making the
54
+ program proprietary. To prevent this, we have made it clear that any
55
+ patent must be licensed for everyone's free use or not licensed at all.
56
+
57
+ The precise terms and conditions for copying, distribution and
58
+ modification follow.
59
+
60
+ GNU GENERAL PUBLIC LICENSE
61
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
+
63
+ 0. This License applies to any program or other work which contains
64
+ a notice placed by the copyright holder saying it may be distributed
65
+ under the terms of this General Public License. The "Program", below,
66
+ refers to any such program or work, and a "work based on the Program"
67
+ means either the Program or any derivative work under copyright law:
68
+ that is to say, a work containing the Program or a portion of it,
69
+ either verbatim or with modifications and/or translated into another
70
+ language. (Hereinafter, translation is included without limitation in
71
+ the term "modification".) Each licensee is addressed as "you".
72
+
73
+ Activities other than copying, distribution and modification are not
74
+ covered by this License; they are outside its scope. The act of
75
+ running the Program is not restricted, and the output from the Program
76
+ is covered only if its contents constitute a work based on the
77
+ Program (independent of having been made by running the Program).
78
+ Whether that is true depends on what the Program does.
79
+
80
+ 1. You may copy and distribute verbatim copies of the Program's
81
+ source code as you receive it, in any medium, provided that you
82
+ conspicuously and appropriately publish on each copy an appropriate
83
+ copyright notice and disclaimer of warranty; keep intact all the
84
+ notices that refer to this License and to the absence of any warranty;
85
+ and give any other recipients of the Program a copy of this License
86
+ along with the Program.
87
+
88
+ You may charge a fee for the physical act of transferring a copy, and
89
+ you may at your option offer warranty protection in exchange for a fee.
90
+
91
+ 2. You may modify your copy or copies of the Program or any portion
92
+ of it, thus forming a work based on the Program, and copy and
93
+ distribute such modifications or work under the terms of Section 1
94
+ above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices
97
+ stating that you changed the files and the date of any change.
98
+
99
+ b) You must cause any work that you distribute or publish, that in
100
+ whole or in part contains or is derived from the Program or any
101
+ part thereof, to be licensed as a whole at no charge to all third
102
+ parties under the terms of this License.
103
+
104
+ c) If the modified program normally reads commands interactively
105
+ when run, you must cause it, when started running for such
106
+ interactive use in the most ordinary way, to print or display an
107
+ announcement including an appropriate copyright notice and a
108
+ notice that there is no warranty (or else, saying that you provide
109
+ a warranty) and that users may redistribute the program under
110
+ these conditions, and telling the user how to view a copy of this
111
+ License. (Exception: if the Program itself is interactive but
112
+ does not normally print such an announcement, your work based on
113
+ the Program is not required to print an announcement.)
114
+
115
+ These requirements apply to the modified work as a whole. If
116
+ identifiable sections of that work are not derived from the Program,
117
+ and can be reasonably considered independent and separate works in
118
+ themselves, then this License, and its terms, do not apply to those
119
+ sections when you distribute them as separate works. But when you
120
+ distribute the same sections as part of a whole which is a work based
121
+ on the Program, the distribution of the whole must be on the terms of
122
+ this License, whose permissions for other licensees extend to the
123
+ entire whole, and thus to each and every part regardless of who wrote it.
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
vendor/a5hleyrich/wp-background-processing/wp-background-processing.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP-Background Processing
4
+ *
5
+ * @package WP-Background-Processing
6
+ */
7
+
8
+ /*
9
+ Plugin Name: WP Background Processing
10
+ Plugin URI: https://github.com/A5hleyRich/wp-background-processing
11
+ Description: Asynchronous requests and background processing in WordPress.
12
+ Author: Delicious Brains Inc.
13
+ Version: 1.0
14
+ Author URI: https://deliciousbrains.com/
15
+ GitHub Plugin URI: https://github.com/A5hleyRich/wp-background-processing
16
+ GitHub Branch: master
17
+ */
18
+
19
+ require_once plugin_dir_path( __FILE__ ) . 'classes/wp-async-request.php';
20
+ require_once plugin_dir_path( __FILE__ ) . 'classes/wp-background-process.php';
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit266b0aa0ebaaec076b4dabe0a066b31e::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit786610186433dbfeb9e2e79b41d77986::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -9,6 +9,10 @@ return array(
9
  'Cyr_To_Lat_Conversion_Tables' => $baseDir . '/includes/class-cyr-to-lat-conversion-tables.php',
10
  'Cyr_To_Lat_Converter' => $baseDir . '/includes/class-cyr-to-lat-converter.php',
11
  'Cyr_To_Lat_Main' => $baseDir . '/includes/class-cyr-to-lat-main.php',
 
12
  'Cyr_To_Lat_Settings' => $baseDir . '/includes/class-cyr-to-lat-settings.php',
 
13
  'Cyr_To_Lat_WP_CLI' => $baseDir . '/includes/class-cyr-to-lat-wp-cli.php',
 
 
14
  );
9
  'Cyr_To_Lat_Conversion_Tables' => $baseDir . '/includes/class-cyr-to-lat-conversion-tables.php',
10
  'Cyr_To_Lat_Converter' => $baseDir . '/includes/class-cyr-to-lat-converter.php',
11
  'Cyr_To_Lat_Main' => $baseDir . '/includes/class-cyr-to-lat-main.php',
12
+ 'Cyr_To_Lat_Post_Conversion_Process' => $baseDir . '/includes/background-processes/class-cyr-to-lat-post-conversion-process.php',
13
  'Cyr_To_Lat_Settings' => $baseDir . '/includes/class-cyr-to-lat-settings.php',
14
+ 'Cyr_To_Lat_Term_Conversion_Process' => $baseDir . '/includes/background-processes/class-cyr-to-lat-term-conversion-process.php',
15
  'Cyr_To_Lat_WP_CLI' => $baseDir . '/includes/class-cyr-to-lat-wp-cli.php',
16
+ 'WP_Async_Request' => $vendorDir . '/a5hleyrich/wp-background-processing/classes/wp-async-request.php',
17
+ 'WP_Background_Process' => $vendorDir . '/a5hleyrich/wp-background-processing/classes/wp-background-process.php',
18
  );
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit266b0aa0ebaaec076b4dabe0a066b31e {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit266b0aa0ebaaec076b4dabe0a066b31e {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit266b0aa0ebaaec076b4dabe0a066b31e', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit266b0aa0ebaaec076b4dabe0a066b31e', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit786610186433dbfeb9e2e79b41d77986 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit786610186433dbfeb9e2e79b41d77986', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit786610186433dbfeb9e2e79b41d77986', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/autoload_static.php CHANGED
@@ -34,8 +34,12 @@ class ComposerStaticInitb7c5f930ec4fa1c83689fac301fc90e8
34
  'Cyr_To_Lat_Conversion_Tables' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-conversion-tables.php',
35
  'Cyr_To_Lat_Converter' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-converter.php',
36
  'Cyr_To_Lat_Main' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-main.php',
 
37
  'Cyr_To_Lat_Settings' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-settings.php',
 
38
  'Cyr_To_Lat_WP_CLI' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-wp-cli.php',
 
 
39
  );
40
 
41
  public static function getInitializer(ClassLoader $loader)
34
  'Cyr_To_Lat_Conversion_Tables' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-conversion-tables.php',
35
  'Cyr_To_Lat_Converter' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-converter.php',
36
  'Cyr_To_Lat_Main' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-main.php',
37
+ 'Cyr_To_Lat_Post_Conversion_Process' => __DIR__ . '/../..' . '/includes/background-processes/class-cyr-to-lat-post-conversion-process.php',
38
  'Cyr_To_Lat_Settings' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-settings.php',
39
+ 'Cyr_To_Lat_Term_Conversion_Process' => __DIR__ . '/../..' . '/includes/background-processes/class-cyr-to-lat-term-conversion-process.php',
40
  'Cyr_To_Lat_WP_CLI' => __DIR__ . '/../..' . '/includes/class-cyr-to-lat-wp-cli.php',
41
+ 'WP_Async_Request' => __DIR__ . '/..' . '/a5hleyrich/wp-background-processing/classes/wp-async-request.php',
42
+ 'WP_Background_Process' => __DIR__ . '/..' . '/a5hleyrich/wp-background-processing/classes/wp-background-process.php',
43
  );
44
 
45
  public static function getInitializer(ClassLoader $loader)
vendor/composer/installed.json CHANGED
@@ -1,4 +1,42 @@
1
  [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  {
3
  "name": "composer/installers",
4
  "version": "v1.6.0",
1
  [
2
+ {
3
+ "name": "a5hleyrich/wp-background-processing",
4
+ "version": "1.0.1",
5
+ "version_normalized": "1.0.1.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/A5hleyRich/wp-background-processing.git",
9
+ "reference": "1f070aab5058dbaf45d5435a343033ddd8a641b1"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/A5hleyRich/wp-background-processing/zipball/1f070aab5058dbaf45d5435a343033ddd8a641b1",
14
+ "reference": "1f070aab5058dbaf45d5435a343033ddd8a641b1",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": ">=5.2"
19
+ },
20
+ "time": "2018-02-12T09:24:05+00:00",
21
+ "type": "library",
22
+ "installation-source": "dist",
23
+ "autoload": {
24
+ "classmap": [
25
+ "classes/"
26
+ ]
27
+ },
28
+ "notification-url": "https://packagist.org/downloads/",
29
+ "license": [
30
+ "GPL-2.0-only"
31
+ ],
32
+ "authors": [
33
+ {
34
+ "name": "Ashley Rich",
35
+ "email": "hello@ashleyrich.com"
36
+ }
37
+ ],
38
+ "description": "WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks."
39
+ },
40
  {
41
  "name": "composer/installers",
42
  "version": "v1.6.0",