Skip to content
Snippets Groups Projects
Commit 6d404207 authored by lucha's avatar lucha
Browse files

[auto] plugin: wp-super-cache 1.6.2

parent 31bea712
Branches
Tags
No related merge requests found
Showing with 521 additions and 236 deletions
......@@ -64,6 +64,14 @@ function wp_super_cache_jetpack_cookie_check( $cache_key ) {
}
}
if ( isset ( $_COOKIE['akm_mobile'] ) ) {
if ( $_COOKIE['akm_mobile'] == 'true' ) {
return 'mobile';
} elseif ( $_COOKIE['akm_mobile'] == 'false' ) {
return 'normal';
}
}
if ( function_exists( 'jetpack_is_mobile' ) ) {
if ( jetpack_is_mobile() ) {
return 'mobile';
......
......@@ -7,7 +7,7 @@ if ( ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) === t
function wp_super_cache_multisite_init() {
add_filter( 'wpmu_blogs_columns', 'wp_super_cache_blogs_col' );
add_action( 'manage_sites_custom_column', 'wp_super_cache_blogs_field', 10, 2 );
add_action( 'init', 'wp_super_cache_override_on_flag' );
add_action( 'init', 'wp_super_cache_override_on_flag', 9 );
}
function wp_super_cache_blogs_col( $col ) {
......@@ -20,18 +20,20 @@ function wp_super_cache_blogs_field( $name, $blog_id ) {
return false;
}
$blog_id = (int) $blog_id;
if ( isset( $_GET['id'], $_GET['action'], $_GET['_wpnonce'] )
&& $blog_id === intval( $_GET['id'] )
&& $blog_id === filter_input( INPUT_GET, 'id', FILTER_VALIDATE_INT )
&& wp_verify_nonce( $_GET['_wpnonce'], 'wp-cache' . $blog_id )
) {
if ( 'disable_cache' === $_GET['action'] ) {
add_blog_option( $_GET['id'], 'wp_super_cache_disabled', 1 );
} elseif ( 'enable_cache' === $_GET['action'] ) {
delete_blog_option( $_GET['id'], 'wp_super_cache_disabled' );
if ( 'disable_cache' === filter_input( INPUT_GET, 'action' ) ) {
add_blog_option( $blog_id, 'wp_super_cache_disabled', 1 );
} elseif ( 'enable_cache' === filter_input( INPUT_GET, 'action' ) ) {
delete_blog_option( $blog_id, 'wp_super_cache_disabled' );
}
}
if ( get_blog_option( $blog_id, 'wp_super_cache_disabled' ) === 1 ) {
if ( 1 === (int) get_blog_option( $blog_id, 'wp_super_cache_disabled' ) ) {
echo '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'enable_cache', 'id' => $blog_id ) ), 'wp-cache' . $blog_id ) . '">' . __( 'Enable', 'wp-super-cache' ) . '</a>';
} else {
echo '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'disable_cache', 'id' => $blog_id ) ), 'wp-cache' . $blog_id ) . '">' . __( 'Disable', 'wp-super-cache' ) . '</a>';
......@@ -39,7 +41,7 @@ function wp_super_cache_blogs_field( $name, $blog_id ) {
}
function wp_super_cache_multisite_notice() {
if ( isset( $_GET['page'] ) && 'wpsupercache' === $_GET['page'] ) {
if ( 'wpsupercache' === filter_input( INPUT_GET, 'page' ) ) {
echo '<div class="error"><p><strong>' . __( 'Caching has been disabled on this blog on the Network Admin Sites page.', 'wp-super-cache' ) . '</strong></p></div>';
}
}
......@@ -50,7 +52,7 @@ function wp_super_cache_override_on_flag() {
return false;
}
if ( get_option( 'wp_super_cache_disabled' ) ) {
if ( 1 === (int) get_option( 'wp_super_cache_disabled' ) ) {
$cache_enabled = false;
$super_cache_enabled = false;
define( 'DONOTCACHEPAGE', 1 );
......
# WP Super Cache #
* Contributors: donncha, automattic, kraftbj
* Tags: performance, caching, wp-cache, wp-super-cache, cache
* Tested up to: 4.9.1
* Stable tag: 1.5.9
* Tested up to: 4.9.6
* Stable tag: 1.6.2
* Requires at least: 3.0
* Requires PHP: 5.2.4
* License: GPLv2 or later
......@@ -89,7 +89,7 @@ There is one regular WordPress filter too. Use the "do_createsupercache" filter
to customize the checks made before caching. The filter accepts one parameter.
The output of WP-Cache's wp_cache_get_cookies_values() function.
See plugins/searchengine.php as an example I use for my [No Adverts for Friends](https://odd.blog/no-adverts-for-friends/) plugin.
See [plugins/searchengine.php](https://github.com/Automattic/wp-super-cache/blob/4cda5c0f2218e40e118232b5bf22d227fb3206b7/plugins/searchengine.php) as an example I use for my [No Adverts for Friends](https://odd.blog/no-adverts-for-friends/) plugin.
### Troubleshooting ###
If things don't work when you installed the plugin here are a few things to check:
......@@ -136,7 +136,7 @@ If that doesn't work, add this line to your wp-config.php:
27. Use [Cron View](https://wordpress.org/plugins/cron-view/) to help diagnose garbage collection and preload problems. Use the plugin to make sure jobs are scheduled and for what time. Look for the wp_cache_gc and wp_cache_full_preload_hook jobs.
18. The error message, "WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory." appears at the end of every page. You can delete wp-content/advanced-cache.php and reload the plugin settings page or edit wp-config.php and look for WPCACHEHOME and make sure it points at the wp-super-cache folder. This will normally be wp-content/plugins/wp-super-cache/ but you'll likely need the full path to that file (so it's easier to let the settings page fix it). If it is not correct the caching engine will not load.
19. If your server is running into trouble because of the number of semaphores used by the plugin it's because your users are using file locking which is not recommended (but is needed by a small number of users). You can globally disable file locking by defining the constant WPSC_DISABLE_LOCKING, or defining the constant WPSC_REMOVE_SEMAPHORE so that sem_remove() is called after every page is cached but that seems to cause problems for other processes requesting the same semaphore. Best to disable it.
20. Set the variable $htaccess_path in wp-config.php or wp-cache-config.php to the path of your global .htaccess if the plugin is looking for that file in the wrong directory. This might happen if you have WordPress installed in an unusual way.
## Installation ##
Install like any other plugin, directly from your plugins page but make sure you have custom permalinks enabled. Go to the plugin settings page at Settings->WP Super Cache and enable caching.
......@@ -261,6 +261,41 @@ Your theme is probably responsive which means it resizes the page to suit whatev
## Changelog ##
### 1.6.2 ###
* Fixed serving expired supercache files (#562)
* Write directly to the config file to avoid permission problems with wp-content. (#563)
* Correctly set the .htaccess rules on the main site of a multisite. (#557)
* Check if set_transient() exists before using it. (#565)
* Removed searchengine.php example plugin as it sets a cookie to track users. Still available [here](https://github.com/Automattic/wp-super-cache/blob/4cda5c0f2218e40e118232b5bf22d227fb3206b7/plugins/searchengine.php). (#567)
* For advanced users only. Change the vary and cache control headers. See https://github.com/Automattic/wp-super-cache/pull/555 (#555)
### 1.6.1 ###
* Fix the name of the WP Crontrol plugin. (#549)
* Handle errors during deactivation/uninstall by email rather than exiting. (#551)
* Add a notice when settings can't be updated. (#552 and #553)
### 1.6.0 ###
* Fix issues in multisite plugin (#501)
* Fixes wp-cli plugin deactivate/activate (#499)
* Cleanup - change quotes. (#495)
* $htaccess_path defines the path to the global .htacess file. (#507)
* Fix 'cannot redeclare gzip_accepted()' (#511)
* Correct the renaming of tmp_wpcache_filename (removed unnecessary slash in path) which caused renaming to fail. (#516)
* Add check for Jetpack mobile theme cookie (#515)
* Optimize wp_cache_phase2 and create wpsc_register_post_hooks (#508)
* WPCACHEHOME has a trailing slash (#513)
* Cleanup cache enable/disable and update_mod_rewrite_rules (#500)
* Post Update now clears category cache (#519)
* Various fixes for saving the debug page form (#542)
* Expert-caching and empty parameters, like ?amp, should not serve cached page (#533)
* Tiny Yslow description fix (#527)
* Add ipad to mobile list (#525)
* Hide opcache_invalidate() warnings since it's disabled some places. (#543)
* Check that HTTP_REFERER exists before checking it. (#544)
* Replace Cron View" with WP Crontrol because it's still updated. (#546)
* adding hook (wp_cache_cleared) for full cache purges (#537)
### 1.5.9 ###
* Fixed fatal error if the debug log was deleted while debugging was enabled and a visitor came to the site.
* Fixed the dynamic caching test plugin because of PHP7 changes. Dynamic cache mode must be enabled now.
......@@ -628,4 +663,4 @@ Your theme is probably responsive which means it resizes the page to suit whatev
## Upgrade Notice ##
Fixes rare fatal error when using debug log
Fix problems writing to the config file for some users.
......@@ -23,7 +23,7 @@ class WP_Super_Cache_Rest_Get_Settings extends WP_REST_Controller {
}
if ( function_exists( "opcache_invalidate" ) ) {
opcache_invalidate( $wp_cache_config_file );
@opcache_invalidate( $wp_cache_config_file );
}
include( $wp_cache_config_file );
......@@ -78,7 +78,7 @@ class WP_Super_Cache_Rest_Get_Settings extends WP_REST_Controller {
public function get_cache_type() {
global $wp_cache_config_file;
if ( function_exists( "opcache_invalidate" ) ) {
opcache_invalidate( $wp_cache_config_file );
@opcache_invalidate( $wp_cache_config_file );
}
include( $wp_cache_config_file );
......
......@@ -87,7 +87,11 @@ class WP_Super_Cache_Rest_Update_Settings extends WP_REST_Controller {
$set_method = method_exists( $this, 'set_' . $map['global'] ) ?
'set_' . $map['global'] : 'set_global';
$has_error = call_user_func( array( $this, $set_method ), $value );
if ( $set_method == 'set_global' ) {
$has_error = call_user_func( array( $this, $set_method ), $key, $value );
} else {
$has_error = call_user_func( array( $this, $set_method ), $value );
}
}
if ( ! empty( $has_error ) ) {
......@@ -604,7 +608,7 @@ class WP_Super_Cache_Rest_Update_Settings extends WP_REST_Controller {
wp_cache_setting( 'cache_page_secret', $cache_page_secret );
if ( function_exists( "opcache_invalidate" ) ) {
opcache_invalidate( $wp_cache_config_file );
@opcache_invalidate( $wp_cache_config_file );
}
}
wpsc_set_default_gc( true );
......@@ -637,6 +641,9 @@ class WP_Super_Cache_Rest_Update_Settings extends WP_REST_Controller {
}
$_POST[ 'wp_cache_debug' ] = 1;
} else {
if ( ! isset( $GLOBALS[ $setting ] ) ) {
$GLOBALS[ $setting ] = 0;
}
$_POST[ $setting ] = $GLOBALS[ $setting ];
}
}
......
......@@ -236,7 +236,7 @@ class WP_Super_Cache_Settings_Map {
'global' => 'wp_super_cache_debug',
),
'wp_cache_debug_username' => array(
'global' => 'wp_cache_debug_username',
'get' => 'wpsc_debug_username',
),
'wp_cache_debug_log' => array(
'global' => 'wp_cache_debug_log',
......
......@@ -35,7 +35,7 @@ class WP_Super_Cache_Router {
$preload_cache = new WP_Super_Cache_Rest_Preload();
$get_status = new WP_Super_Cache_Rest_Get_Status();
$get_plugins = new WP_Super_Cache_Rest_Get_Plugins();
$update_plugins = new WP_Super_Cache_Rest_Update_plugins();
$update_plugins = new WP_Super_Cache_Rest_Update_Plugins();
register_rest_route( $namespace, '/settings', array(
array(
......
<?php
require_once dirname( __FILE__ ) . '/wp-cache-phase2.php';
if ( ! function_exists( 'wp_cache_phase2' ) ) {
require_once dirname( __FILE__ ) . '/wp-cache-phase2.php';
}
// error_reporting(E_ERROR | E_PARSE); // uncomment to debug this file!
if ( ! @include WP_CONTENT_DIR . '/wp-cache-config.php' ) {
......
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment