| @@ -3,9 +3,8 @@ | ||
| 3 | 3 | /** @noinspection PhpUndefinedFunctionInspection */ |
| 4 | 4 | /** @noinspection PhpUndefinedNamespaceInspection */ |
| 5 | 5 | /** @noinspection PhpUndefinedClassInspection */ |
| 6 | 6 | |
| 7 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 8 | 7 | /** |
| 9 | 8 | * SQLite Object Cache plugin |
| 10 | 9 | * |
| 11 | 10 | * ## OPTIONS |
| @@ -46,9 +45,9 @@ | ||
| 46 | 45 | $msg = sprintf( |
| 47 | 46 | /* translators: 1: version for sqlite 2: version for plugin 3: igbinary --- for WP-CLI */ |
| 48 | 47 | __( 'Versions: Plugin: %2$s SQLite: %1$s igbinary: %3$s.', 'sqlite-object-cache' ), |
| 49 | 48 | $wp_object_cache->sqlite_get_version(), |
| 50 | - '1.6.5', | |
| 49 | + '1.6.0', | |
| 51 | 50 | $igbinary ); |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | 53 | WP_CLI::log( $this->commentPrefix . $msg ); |
| @@ -150,14 +149,14 @@ | ||
| 150 | 149 | if ( 1 === count( $args ) ) { |
| 151 | 150 | $new_target_size = strval( $args[0] ); |
| 152 | 151 | if ( $new_target_size === $old_target_size ) { |
| 153 | 152 | /* translators: 1: new target cache size --- for WP-CLI */ |
| 154 | - $msg = __( 'Target cache size unchanged at %1$sMiB', 'sqlite-object-cache' ); | |
| 153 | + $msg = __( 'Target cache size unchanged at %1$sMiB', 'sqlite_object_cache' ); | |
| 155 | 154 | $msg = sprintf( $msg, $new_target_size ); |
| 156 | 155 | WP_CLI::log( $this->commentPrefix . $msg ); |
| 157 | 156 | } else { |
| 158 | 157 | /* translators: 1: new target cache size 2:former target cache size */ |
| 159 | - $msg = __( 'Target cache size changed from %2$sMiB to %1$sMiB', 'sqlite-object-cache' ); | |
| 158 | + $msg = __( 'Target cache size changed from %2$sMiB to %1$sMiB', 'sqlite_object_cache' ); | |
| 160 | 159 | $msg = sprintf( $msg, $new_target_size, $old_target_size ); |
| 161 | 160 | $options['target_size'] = strval( $new_target_size ); |
| 162 | 161 | update_option( 'sqlite_object_cache_settings', $options, true ); |
| 163 | 162 | WP_CLI::success( $this->commentPrefix . $msg ); |
| @@ -163,9 +162,9 @@ | ||
| 163 | 162 | WP_CLI::success( $this->commentPrefix . $msg ); |
| 164 | 163 | } |
| 165 | 164 | } else { |
| 166 | 165 | /* translators: 1: target cache size */ |
| 167 | - $msg = __( 'Target cache size is %1$sMiB', 'sqlite-object-cache' ); | |
| 166 | + $msg = __( 'Target cache size is %1$sMiB', 'sqlite_object_cache' ); | |
| 168 | 167 | $msg = sprintf( $msg, $old_target_size ); |
| 169 | 168 | WP_CLI::log( $this->commentPrefix . $msg ); |
| 170 | 169 | } |
| 171 | 170 | |
| @@ -199,14 +198,14 @@ | ||
| 199 | 198 | $new_samplerate = strval( ( $new_samplerate > 100 ) ? 100 : $new_samplerate ); |
| 200 | 199 | $new_capture = ( '0' === $new_samplerate ) ? 'off' : 'on'; |
| 201 | 200 | if ( $old_samplerate === $new_samplerate ) { |
| 202 | 201 | /* translators: 1: new sample rate 0-100 --- for WP-CLI */ |
| 203 | - $msg = __( 'Performance measurement sample rate unchanged at %1$s%%', 'sqlite-object-cache' ); | |
| 202 | + $msg = __( 'Performance measurement sample rate unchanged at %1$s%%', 'sqlite_object_cache' ); | |
| 204 | 203 | $msg = sprintf( $msg, $new_samplerate ); |
| 205 | 204 | WP_CLI::log( $this->commentPrefix . $msg ); |
| 206 | 205 | } else { |
| 207 | 206 | /* translators: 1: new rate 2:former rate --- for WP-CLI */ |
| 208 | - $msg = __( 'Performance measurement sample rate changed from %2$s%% to %1$s%%', 'sqlite-object-cache' ); | |
| 207 | + $msg = __( 'Performance measurement sample rate changed from %2$s%% to %1$s%%', 'sqlite_object_cache' ); | |
| 209 | 208 | $msg = sprintf( $msg, $new_samplerate, $old_samplerate ); |
| 210 | 209 | $options['samplerate'] = strval( $new_samplerate ); |
| 211 | 210 | $options['capture'] = $new_capture; |
| 212 | 211 | |
| @@ -215,9 +214,9 @@ | ||
| 215 | 214 | |
| 216 | 215 | } |
| 217 | 216 | } else { |
| 218 | 217 | /* translators: 1: sample rate --- for WP-CLI */ |
| 219 | - $msg = __( 'Performance measurement sample rate is %1$s%%', 'sqlite-object-cache' ); | |
| 218 | + $msg = __( 'Performance measurement sample rate is %1$s%%', 'sqlite_object_cache' ); | |
| 220 | 219 | $msg = sprintf( $msg, $old_samplerate ); |
| 221 | 220 | WP_CLI::log( $this->commentPrefix . $msg ); |
| 222 | 221 | } |
| 223 | 222 | |
| @@ -244,14 +243,14 @@ | ||
| 244 | 243 | $new_samplerate = strval( $args[0] ); |
| 245 | 244 | $new_samplerate = strval( ( $new_samplerate < 1 ) ? 1 : $new_samplerate ); |
| 246 | 245 | if ( $old_samplerate === $new_samplerate ) { |
| 247 | 246 | /* translators: 1: retention time --- for WP-CLI */ |
| 248 | - $msg = __( 'Performance measurement retention unchanged at %1$shr', 'sqlite-object-cache' ); | |
| 247 | + $msg = __( 'Performance measurement retention unchanged at %1$shr', 'sqlite_object_cache' ); | |
| 249 | 248 | $msg = sprintf( $msg, $new_samplerate ); |
| 250 | 249 | WP_CLI::log( $this->commentPrefix . $msg ); |
| 251 | 250 | } else { |
| 252 | 251 | /* translators: 1: new retention time 2:former time --- for WP-CLI */ |
| 253 | - $msg = __( 'Performance measurement retention changed from %2$shr to %1$shr', 'sqlite-object-cache' ); | |
| 252 | + $msg = __( 'Performance measurement retention changed from %2$shr to %1$shr', 'sqlite_object_cache' ); | |
| 254 | 253 | $msg = sprintf( $msg, $new_samplerate, $old_samplerate ); |
| 255 | 254 | $options['retainmeasurements'] = strval( $new_samplerate ); |
| 256 | 255 | |
| 257 | 256 | update_option( 'sqlite_object_cache_settings', $options, true ); |
| @@ -259,9 +258,9 @@ | ||
| 259 | 258 | |
| 260 | 259 | } |
| 261 | 260 | } else { |
| 262 | 261 | /* translators: 1: retention time --- for WP-CLI */ |
| 263 | - $msg = __( 'Performance measurement retention is %1$shr', 'sqlite-object-cache' ); | |
| 262 | + $msg = __( 'Performance measurement retention is %1$shr', 'sqlite_object_cache' ); | |
| 264 | 263 | $msg = sprintf( $msg, $old_samplerate ); |
| 265 | 264 | WP_CLI::log( $this->commentPrefix . $msg ); |
| 266 | 265 | } |
| 267 | 266 | |
| @@ -267,9 +266,9 @@ | ||
| 267 | 266 | |
| 268 | 267 | } |
| 269 | 268 | |
| 270 | 269 | /** |
| 271 | - * Flush the cache (delete all its entries, including all transients). This briefly puts your site into maintenance mode. | |
| 270 | + * Flush the cache (delete all its entries). This briefly puts your site into maintenance mode. | |
| 272 | 271 | */ |
| 273 | 272 | function flush( $args, $assoc_args ) { |
| 274 | 273 | global $wp_object_cache; |
| 275 | 274 | if ( method_exists( $wp_object_cache, 'flush' ) ) { |
| @@ -319,9 +318,9 @@ | ||
| 319 | 318 | $current_size = $original_size; |
| 320 | 319 | /* Skip this if the current size is small enough. */ |
| 321 | 320 | if ( $current_size <= $threshold_size ) { |
| 322 | 321 | /* translators: 1: size of cache --- For WP-CLI */ |
| 323 | - $msg = __( 'Cache contains %1$01.1fMiB, no cleanup performed', 'sqlite-object-cache' ); | |
| 322 | + $msg = __( 'Cache contains %1$01.1fMiB, no cleanup performed', 'sqlite_object_cache' ); | |
| 324 | 323 | $msg = sprintf( $msg, $original_size / ( 1024.0 * 1024.0 ) ); |
| 325 | 324 | WP_CLI::log( $this->commentPrefix . $msg ); |
| 326 | 325 | |
| 327 | 326 | return; |
| @@ -333,9 +332,9 @@ | ||
| 333 | 332 | $current_size = $wp_object_cache->sqlite_get_size(); |
| 334 | 333 | |
| 335 | 334 | if ( $current_size < $original_size ) { |
| 336 | 335 | /* translators: 1: size removed 2: size remaining */ |
| 337 | - $msg = __( '%1$01.1fMiB of expired items removed from cache, leaving %2$01.1fMiB', 'sqlite-object-cache' ); | |
| 336 | + $msg = __( '%1$01.1fMiB of expired items removed from cache, leaving %2$01.1fMiB', 'sqlite_object_cache' ); | |
| 338 | 337 | $msg = sprintf( $msg, ( $original_size - $current_size ) / ( 1024.0 * 1024.0 ), ( $current_size ) / ( 1024.0 * 1024.0 ) ); |
| 339 | 338 | WP_CLI::success( $this->commentPrefix . $msg ); |
| 340 | 339 | } |
| 341 | 340 | } |
| @@ -350,9 +349,9 @@ | ||
| 350 | 349 | $wp_object_cache->sqlite_delete_old( $target_size, $current_size ); |
| 351 | 350 | $current_size = $wp_object_cache->sqlite_get_size(); |
| 352 | 351 | if ( $current_size < $original_size ) { |
| 353 | 352 | /* translators: 1: size removed 2: size remaining --- For WP-CLI */ |
| 354 | - $msg = __( '%1$01.1fMiB of least recently updated items removed from cache, leaving %2$01.1fMiB', 'sqlite-object-cache' ); | |
| 353 | + $msg = __( '%1$01.1fMiB of least recently updated items removed from cache, leaving %2$01.1fMiB', 'sqlite_object_cache' ); | |
| 355 | 354 | $msg = sprintf( $msg, ( $original_size - $current_size ) / ( 1024.0 * 1024.0 ), ( $current_size ) / ( 1024.0 * 1024.0 ) ); |
| 356 | 355 | WP_CLI::success( $this->commentPrefix . $msg ); |
| 357 | 356 | } |
| 358 | 357 | } |
| @@ -393,9 +392,9 @@ | ||
| 393 | 392 | * @return void |
| 394 | 393 | */ |
| 395 | 394 | private function exit_maintenance_mode() { |
| 396 | 395 | $maintenanceFileName = ABSPATH . '.maintenance'; |
| 397 | - wp_delete_file( $maintenanceFileName ); | |
| 396 | + unlink( $maintenanceFileName ); | |
| 398 | 397 | } |
| 399 | 398 | |
| 400 | 399 | /** |
| 401 | 400 | * Format a UNIX timestamp using WP settings. |