← All changes
|
libraries/action-scheduler/classes/ActionScheduler_DataController.php
+10
-33
3.1.1
→
2.6.3
View file →
| @@ -17,12 +17,12 @@ | ||
| 17 | 17 | /** Action data store class name. */ |
| 18 | 18 | const DATASTORE_CLASS = 'ActionScheduler_DBStore'; |
| 19 | 19 | |
| 20 | 20 | /** Logger data store class name. */ |
| 21 | - const LOGGER_CLASS = 'ActionScheduler_DBLogger'; | |
| 21 | + const LOGGER_CLASS = 'ActionScheduler_DBLogger'; | |
| 22 | 22 | |
| 23 | 23 | /** Migration status option name. */ |
| 24 | - const STATUS_FLAG = 'action_scheduler_migration_status'; | |
| 24 | + const STATUS_FLAG = 'action_scheduler_migration_status'; | |
| 25 | 25 | |
| 26 | 26 | /** Migration status option value. */ |
| 27 | 27 | const STATUS_COMPLETE = 'complete'; |
| 28 | 28 | |
| @@ -28,27 +28,15 @@ | ||
| 28 | 28 | |
| 29 | 29 | /** Migration minimum required PHP version. */ |
| 30 | 30 | const MIN_PHP_VERSION = '5.5'; |
| 31 | 31 | |
| 32 | - /** | |
| 33 | - * Instance. | |
| 34 | - * | |
| 35 | - * @var ActionScheduler_DataController | |
| 36 | - */ | |
| 32 | + /** @var ActionScheduler_DataController */ | |
| 37 | 33 | private static $instance; |
| 38 | 34 | |
| 39 | - /** | |
| 40 | - * Sleep time in seconds. | |
| 41 | - * | |
| 42 | - * @var int | |
| 43 | - */ | |
| 35 | + /** @var int */ | |
| 44 | 36 | private static $sleep_time = 0; |
| 45 | 37 | |
| 46 | - /** | |
| 47 | - * Tick count required for freeing memory. | |
| 48 | - * | |
| 49 | - * @var int | |
| 50 | - */ | |
| 38 | + /** @var int */ | |
| 51 | 39 | private static $free_ticks = 50; |
| 52 | 40 | |
| 53 | 41 | /** |
| 54 | 42 | * Get a flag indicating whether the migration environment dependencies are met. |
| @@ -148,10 +136,8 @@ | ||
| 148 | 136 | |
| 149 | 137 | \WP_CLI::warning( __( 'Attempting to reduce used memory...', 'action-scheduler' ) ); |
| 150 | 138 | |
| 151 | 139 | /** |
| 152 | - * Globals. | |
| 153 | - * | |
| 154 | 140 | * @var $wpdb \wpdb |
| 155 | 141 | * @var $wp_object_cache \WP_Object_Cache |
| 156 | 142 | */ |
| 157 | 143 | global $wpdb, $wp_object_cache; |
| @@ -161,24 +147,15 @@ | ||
| 161 | 147 | if ( ! is_a( $wp_object_cache, 'WP_Object_Cache' ) ) { |
| 162 | 148 | return; |
| 163 | 149 | } |
| 164 | 150 | |
| 165 | - // Not all drop-ins support these props, however, there may be existing installations that rely on these being cleared. | |
| 166 | - if ( property_exists( $wp_object_cache, 'group_ops' ) ) { | |
| 167 | - $wp_object_cache->group_ops = array(); | |
| 168 | - } | |
| 169 | - if ( property_exists( $wp_object_cache, 'stats' ) ) { | |
| 170 | - $wp_object_cache->stats = array(); | |
| 171 | - } | |
| 172 | - if ( property_exists( $wp_object_cache, 'memcache_debug' ) ) { | |
| 173 | - $wp_object_cache->memcache_debug = array(); | |
| 174 | - } | |
| 175 | - if ( property_exists( $wp_object_cache, 'cache' ) ) { | |
| 176 | - $wp_object_cache->cache = array(); | |
| 177 | - } | |
| 151 | + $wp_object_cache->group_ops = array(); | |
| 152 | + $wp_object_cache->stats = array(); | |
| 153 | + $wp_object_cache->memcache_debug = array(); | |
| 154 | + $wp_object_cache->cache = array(); | |
| 178 | 155 | |
| 179 | 156 | if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) { |
| 180 | - call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important! | |
| 157 | + call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important | |
| 181 | 158 | } |
| 182 | 159 | } |
| 183 | 160 | |
| 184 | 161 | /** |