WP Super Cache - Version 1.5.3

Version Description

Emergency fix of a critical bug that caused wp-super-cache to delete the wp-admin when deleting the plugin thanks to a null cache path

=

Download this release

Release Info

Developer dbtlr
Plugin Icon 128x128 WP Super Cache
Version 1.5.3
Comparing to
See all releases

Code changes from version 1.5.2 to 1.5.3

Files changed (3) hide show
  1. readme.txt +6 -3
  2. wp-cache-phase2.php +6 -0
  3. wp-cache.php +21 -8
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: donncha, automattic, kraftbj
3
  Tags: performance,caching,wp-cache,wp-super-cache,cache
4
  Tested up to: 4.8
5
- Stable tag: 1.5.2
6
  Requires at least: 3.0
7
 
8
  A very fast caching engine for WordPress that produces static html files.
@@ -54,11 +54,14 @@ The cache directory, usually wp-content/cache/ is only for temporary files. Do n
54
 
55
  == Upgrade Notice ==
56
 
57
- = 1.5.2 =
58
- Fix loading the REST API code, finding the .htaccess file, mobile browsers using WP-Cache caching, and more..
59
 
60
  == Changelog ==
61
 
 
 
 
62
  = 1.5.2 =
63
  * Add a trailing slash to home path. Fixes problems with finding the .htaccess file.
64
  * Delete WPCACHEHOME and WP_CACHE from wp-config.php when plugin deactivated.
2
  Contributors: donncha, automattic, kraftbj
3
  Tags: performance,caching,wp-cache,wp-super-cache,cache
4
  Tested up to: 4.8
5
+ Stable tag: 1.5.3
6
  Requires at least: 3.0
7
 
8
  A very fast caching engine for WordPress that produces static html files.
54
 
55
  == Upgrade Notice ==
56
 
57
+ = 1.5.3 =
58
+ Emergency fix of a critical bug that caused wp-super-cache to delete the wp-admin when deleting the plugin thanks to a null cache path
59
 
60
  == Changelog ==
61
 
62
+ = 1.5.3 =
63
+ * Fix a critical bug that caused unlink to be run on null while deleting the plugin.
64
+
65
  = 1.5.2 =
66
  * Add a trailing slash to home path. Fixes problems with finding the .htaccess file.
67
  * Delete WPCACHEHOME and WP_CACHE from wp-config.php when plugin deactivated.
wp-cache-phase2.php CHANGED
@@ -874,6 +874,12 @@ function wp_cache_phase2_clean_cache($file_prefix) {
874
  }
875
 
876
  function prune_super_cache( $directory, $force = false, $rename = false ) {
 
 
 
 
 
 
877
  global $cache_max_time, $cache_path, $blog_cache_dir;
878
  static $log = 0;
879
  static $protected_directories = '';
874
  }
875
 
876
  function prune_super_cache( $directory, $force = false, $rename = false ) {
877
+
878
+ // Don't prune a NULL/empty directory.
879
+ if ( null === $directory || '' === $directory ) {
880
+ return false;
881
+ }
882
+
883
  global $cache_max_time, $cache_path, $blog_cache_dir;
884
  static $log = 0;
885
  static $protected_directories = '';
wp-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Super Cache
4
  Plugin URI: https://wordpress.org/plugins/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
- Version: 1.5.2
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
@@ -127,18 +127,26 @@ function wpsupercache_uninstall() {
127
  global $wp_cache_config_file, $wp_cache_link, $cache_path;
128
  $files = array( $wp_cache_config_file, $wp_cache_link );
129
  foreach( $files as $file ) {
130
- if ( file_exists( $file ) )
131
  unlink( $file );
 
132
  }
 
133
  if ( !function_exists( 'wp_cache_debug' ) )
134
  include_once( 'wp-cache-phase1.php' );
135
  if ( !function_exists( 'prune_super_cache' ) )
136
  include_once( 'wp-cache-phase2.php' );
 
137
  prune_super_cache( $cache_path, true );
 
138
  wp_cache_remove_index();
139
- @unlink( $cache_path . '.htaccess' );
140
- @unlink( $cache_path . 'meta' );
141
- @unlink( $cache_path . 'supercache' );
 
 
 
 
142
  wp_clear_scheduled_hook( 'wp_cache_check_site_hook' );
143
  wp_clear_scheduled_hook( 'wp_cache_gc' );
144
  wp_clear_scheduled_hook( 'wp_cache_gc_watcher' );
@@ -933,7 +941,7 @@ table.wpsc-settings-table {
933
  next_preload_message( 'wp_cache_preload_hook', __( 'Refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ), 60 );
934
  next_preload_message( 'wp_cache_full_preload_hook', __( 'Full refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ) );
935
 
936
- if ( wp_next_scheduled( 'wp_cache_preload_hook' ) || wp_next_scheduled( 'wp_cache_full_preload_hook' ) ) {
937
  $currently_preloading = true;
938
  }
939
  $preload_counter = get_option( 'preload_cache_counter' );
@@ -1964,7 +1972,7 @@ function wpsc_update_debug_settings() {
1964
  global $wp_cache_debug_username;
1965
 
1966
  if ( false == $valid_nonce ) {
1967
- return array (
1968
  'wp_super_cache_debug' => $wp_super_cache_debug,
1969
  'wp_cache_debug_log' => $wp_cache_debug_log,
1970
  'wp_cache_debug_ip' => $wp_cache_debug_ip,
@@ -2013,7 +2021,7 @@ function wpsc_update_debug_settings() {
2013
  }
2014
  }
2015
 
2016
- return array (
2017
  'wp_super_cache_debug' => $wp_super_cache_debug,
2018
  'wp_cache_debug_log' => $wp_cache_debug_log,
2019
  'wp_cache_debug_ip' => $wp_cache_debug_ip,
@@ -2220,6 +2228,11 @@ function wp_cache_replace_line($old, $new, $my_file) {
2220
 
2221
  function wp_cache_remove_index() {
2222
  global $cache_path;
 
 
 
 
 
2223
  @unlink( $cache_path . "index.html" );
2224
  @unlink( $cache_path . "supercache/index.html" );
2225
  @unlink( $cache_path . "blogs/index.html" );
3
  Plugin Name: WP Super Cache
4
  Plugin URI: https://wordpress.org/plugins/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
+ Version: 1.5.3
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
127
  global $wp_cache_config_file, $wp_cache_link, $cache_path;
128
  $files = array( $wp_cache_config_file, $wp_cache_link );
129
  foreach( $files as $file ) {
130
+ if ( null !== $file && '' !== $file && file_exists( $file ) ) {
131
  unlink( $file );
132
+ }
133
  }
134
+
135
  if ( !function_exists( 'wp_cache_debug' ) )
136
  include_once( 'wp-cache-phase1.php' );
137
  if ( !function_exists( 'prune_super_cache' ) )
138
  include_once( 'wp-cache-phase2.php' );
139
+
140
  prune_super_cache( $cache_path, true );
141
+
142
  wp_cache_remove_index();
143
+
144
+ if ( null !== $cache_path && '' !== $cache_path ) {
145
+ @unlink( $cache_path . '.htaccess' );
146
+ @unlink( $cache_path . 'meta' );
147
+ @unlink( $cache_path . 'supercache' );
148
+ }
149
+
150
  wp_clear_scheduled_hook( 'wp_cache_check_site_hook' );
151
  wp_clear_scheduled_hook( 'wp_cache_gc' );
152
  wp_clear_scheduled_hook( 'wp_cache_gc_watcher' );
941
  next_preload_message( 'wp_cache_preload_hook', __( 'Refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ), 60 );
942
  next_preload_message( 'wp_cache_full_preload_hook', __( 'Full refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ) );
943
 
944
+ if ( wp_next_scheduled( 'wp_cache_preload_hook' ) || wp_next_scheduled( 'wp_cache_full_preload_hook' ) ) {
945
  $currently_preloading = true;
946
  }
947
  $preload_counter = get_option( 'preload_cache_counter' );
1972
  global $wp_cache_debug_username;
1973
 
1974
  if ( false == $valid_nonce ) {
1975
+ return array (
1976
  'wp_super_cache_debug' => $wp_super_cache_debug,
1977
  'wp_cache_debug_log' => $wp_cache_debug_log,
1978
  'wp_cache_debug_ip' => $wp_cache_debug_ip,
2021
  }
2022
  }
2023
 
2024
+ return array (
2025
  'wp_super_cache_debug' => $wp_super_cache_debug,
2026
  'wp_cache_debug_log' => $wp_cache_debug_log,
2027
  'wp_cache_debug_ip' => $wp_cache_debug_ip,
2228
 
2229
  function wp_cache_remove_index() {
2230
  global $cache_path;
2231
+
2232
+ if ( null === $cache_path || '' === $cache_path ) {
2233
+ return;
2234
+ }
2235
+
2236
  @unlink( $cache_path . "index.html" );
2237
  @unlink( $cache_path . "supercache/index.html" );
2238
  @unlink( $cache_path . "blogs/index.html" );