Version Description
- Update cache clearing for the Clear URL Cache admin bar button
- Update scheme-based caching
- Fix advanced cache
Download this release
Release Info
| Developer | keycdn |
| Plugin | |
| Version | 1.4.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.1 to 1.4.2
- advanced-cache.php +9 -6
- cache-enabler.php +1 -2
- inc/cache_enabler.class.php +25 -2
- inc/cache_enabler_disk.class.php +2 -13
- readme.txt +5 -0
advanced-cache.php
CHANGED
|
@@ -14,11 +14,14 @@ if ( ! isset( $_SERVER['REQUEST_METHOD'] ) || $_SERVER['REQUEST_METHOD'] !== 'GE
|
|
| 14 |
// base path
|
| 15 |
$path = _ce_file_path();
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
// path to cached variants
|
| 18 |
-
$path_html = $path . 'index.html';
|
| 19 |
-
$path_gzip = $path . 'index.html.gz';
|
| 20 |
-
$path_webp_html = $path . 'index-webp.html';
|
| 21 |
-
$path_webp_gzip = $path . 'index-webp.html.gz';
|
| 22 |
|
| 23 |
// check if cached file exists
|
| 24 |
if ( ! is_readable( $path_html ) ) {
|
|
@@ -28,7 +31,7 @@ if ( ! is_readable( $path_html ) ) {
|
|
| 28 |
// check if there are settings
|
| 29 |
$settings_file = sprintf(
|
| 30 |
'%s-%s%s.json',
|
| 31 |
-
|
| 32 |
parse_url(
|
| 33 |
'http://' . strtolower( $_SERVER['HTTP_HOST'] ),
|
| 34 |
PHP_URL_HOST
|
|
@@ -157,7 +160,7 @@ function _ce_file_path( $path = null ) {
|
|
| 157 |
WP_CONTENT_DIR . '/cache/cache-enabler',
|
| 158 |
DIRECTORY_SEPARATOR,
|
| 159 |
parse_url(
|
| 160 |
-
'http://' .strtolower( $_SERVER['HTTP_HOST'] ),
|
| 161 |
PHP_URL_HOST
|
| 162 |
),
|
| 163 |
parse_url(
|
| 14 |
// base path
|
| 15 |
$path = _ce_file_path();
|
| 16 |
|
| 17 |
+
// scheme
|
| 18 |
+
$scheme = ( ( isset( $_SERVER['HTTPS'] ) && ! empty( $_SERVER['HTTPS'] ) ) || $_SERVER['SERVER_PORT'] === '443' ) ? 'https' : 'http';
|
| 19 |
+
|
| 20 |
// path to cached variants
|
| 21 |
+
$path_html = $path . $scheme . '-index.html';
|
| 22 |
+
$path_gzip = $path . $scheme . '-index.html.gz';
|
| 23 |
+
$path_webp_html = $path . $scheme . '-index-webp.html';
|
| 24 |
+
$path_webp_gzip = $path . $scheme . '-index-webp.html.gz';
|
| 25 |
|
| 26 |
// check if cached file exists
|
| 27 |
if ( ! is_readable( $path_html ) ) {
|
| 31 |
// check if there are settings
|
| 32 |
$settings_file = sprintf(
|
| 33 |
'%s-%s%s.json',
|
| 34 |
+
WP_CONTENT_DIR . '/plugins/cache-enabler/settings/cache-enabler-advcache',
|
| 35 |
parse_url(
|
| 36 |
'http://' . strtolower( $_SERVER['HTTP_HOST'] ),
|
| 37 |
PHP_URL_HOST
|
| 160 |
WP_CONTENT_DIR . '/cache/cache-enabler',
|
| 161 |
DIRECTORY_SEPARATOR,
|
| 162 |
parse_url(
|
| 163 |
+
'http://' . strtolower( $_SERVER['HTTP_HOST'] ),
|
| 164 |
PHP_URL_HOST
|
| 165 |
),
|
| 166 |
parse_url(
|
cache-enabler.php
CHANGED
|
@@ -6,7 +6,7 @@ Description: Simple and fast WordPress disk caching plugin.
|
|
| 6 |
Author: KeyCDN
|
| 7 |
Author URI: https://www.keycdn.com
|
| 8 |
License: GPLv2 or later
|
| 9 |
-
Version: 1.4.
|
| 10 |
*/
|
| 11 |
|
| 12 |
/*
|
|
@@ -35,7 +35,6 @@ define( 'CE_FILE', __FILE__ );
|
|
| 35 |
define( 'CE_DIR', dirname( __FILE__ ) );
|
| 36 |
define( 'CE_BASE', plugin_basename( __FILE__ ) );
|
| 37 |
define( 'CE_CACHE_DIR', WP_CONTENT_DIR . '/cache/cache-enabler' );
|
| 38 |
-
define( 'CE_SETTINGS_PATH', WP_CONTENT_DIR . '/plugins/cache-enabler/settings/cache-enabler-advcache' );
|
| 39 |
define( 'CE_MIN_WP', '5.1' );
|
| 40 |
|
| 41 |
// hooks
|
| 6 |
Author: KeyCDN
|
| 7 |
Author URI: https://www.keycdn.com
|
| 8 |
License: GPLv2 or later
|
| 9 |
+
Version: 1.4.2
|
| 10 |
*/
|
| 11 |
|
| 12 |
/*
|
| 35 |
define( 'CE_DIR', dirname( __FILE__ ) );
|
| 36 |
define( 'CE_BASE', plugin_basename( __FILE__ ) );
|
| 37 |
define( 'CE_CACHE_DIR', WP_CONTENT_DIR . '/cache/cache-enabler' );
|
|
|
|
| 38 |
define( 'CE_MIN_WP', '5.1' );
|
| 39 |
|
| 40 |
// hooks
|
inc/cache_enabler.class.php
CHANGED
|
@@ -909,7 +909,7 @@ final class Cache_Enabler {
|
|
| 909 |
} else {
|
| 910 |
if ( $_GET['_action'] === 'clearurl' ) {
|
| 911 |
// clear specific site URL cache
|
| 912 |
-
self::
|
| 913 |
} elseif ( $_GET['_action'] === 'clear' ) {
|
| 914 |
// clear specific site complete cache
|
| 915 |
self::clear_blog_id_cache( get_current_blog_id() );
|
|
@@ -930,7 +930,7 @@ final class Cache_Enabler {
|
|
| 930 |
} else {
|
| 931 |
if ( $_GET['_action'] === 'clearurl' ) {
|
| 932 |
// clear URL cache
|
| 933 |
-
self::
|
| 934 |
} elseif ( $_GET['_action'] === 'clear' ) {
|
| 935 |
// clear complete cache
|
| 936 |
self::clear_total_cache();
|
|
@@ -961,6 +961,29 @@ final class Cache_Enabler {
|
|
| 961 |
}
|
| 962 |
|
| 963 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 964 |
/**
|
| 965 |
* notification after clear cache
|
| 966 |
*
|
| 909 |
} else {
|
| 910 |
if ( $_GET['_action'] === 'clearurl' ) {
|
| 911 |
// clear specific site URL cache
|
| 912 |
+
self::process_clear_request_url( $clear_url );
|
| 913 |
} elseif ( $_GET['_action'] === 'clear' ) {
|
| 914 |
// clear specific site complete cache
|
| 915 |
self::clear_blog_id_cache( get_current_blog_id() );
|
| 930 |
} else {
|
| 931 |
if ( $_GET['_action'] === 'clearurl' ) {
|
| 932 |
// clear URL cache
|
| 933 |
+
self::process_clear_request_url( $clear_url );
|
| 934 |
} elseif ( $_GET['_action'] === 'clear' ) {
|
| 935 |
// clear complete cache
|
| 936 |
self::clear_total_cache();
|
| 961 |
}
|
| 962 |
|
| 963 |
|
| 964 |
+
/**
|
| 965 |
+
* process clear request URL
|
| 966 |
+
*
|
| 967 |
+
* @since 1.4.2
|
| 968 |
+
* @change 1.4.2
|
| 969 |
+
*
|
| 970 |
+
* @param string $clear_url URL to be processed
|
| 971 |
+
*/
|
| 972 |
+
|
| 973 |
+
public static function process_clear_request_url( $clear_url ) {
|
| 974 |
+
|
| 975 |
+
// get home page URL
|
| 976 |
+
$home_page_url = get_site_url( null, '/' );
|
| 977 |
+
|
| 978 |
+
// check clear URL
|
| 979 |
+
if ( $clear_url === $home_page_url ) {
|
| 980 |
+
self::clear_home_page_cache();
|
| 981 |
+
} else {
|
| 982 |
+
self::clear_page_cache_by_url( $clear_url );
|
| 983 |
+
}
|
| 984 |
+
}
|
| 985 |
+
|
| 986 |
+
|
| 987 |
/**
|
| 988 |
* notification after clear cache
|
| 989 |
*
|
inc/cache_enabler_disk.class.php
CHANGED
|
@@ -467,18 +467,7 @@ final class Cache_Enabler_Disk {
|
|
| 467 |
|
| 468 |
private static function _file_scheme() {
|
| 469 |
|
| 470 |
-
|
| 471 |
-
if ( $_SERVER['SERVER_PORT'] === '443' ) {
|
| 472 |
-
return 'https';
|
| 473 |
-
}
|
| 474 |
-
|
| 475 |
-
// http
|
| 476 |
-
if ( $_SERVER['SERVER_PORT'] === '80' ) {
|
| 477 |
-
return 'http';
|
| 478 |
-
}
|
| 479 |
-
|
| 480 |
-
// port
|
| 481 |
-
return $_SERVER['SERVER_PORT'];
|
| 482 |
}
|
| 483 |
|
| 484 |
|
|
@@ -569,7 +558,7 @@ final class Cache_Enabler_Disk {
|
|
| 569 |
// get settings file
|
| 570 |
$settings_file = sprintf(
|
| 571 |
'%s-%s%s.json',
|
| 572 |
-
|
| 573 |
Cache_Enabler::get_blog_domain(),
|
| 574 |
$path
|
| 575 |
);
|
| 467 |
|
| 468 |
private static function _file_scheme() {
|
| 469 |
|
| 470 |
+
return ( ( isset( $_SERVER['HTTPS'] ) && ! empty( $_SERVER['HTTPS'] ) ) || $_SERVER['SERVER_PORT'] === '443' ) ? 'https' : 'http';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
}
|
| 472 |
|
| 473 |
|
| 558 |
// get settings file
|
| 559 |
$settings_file = sprintf(
|
| 560 |
'%s-%s%s.json',
|
| 561 |
+
WP_CONTENT_DIR . '/plugins/cache-enabler/settings/cache-enabler-advcache',
|
| 562 |
Cache_Enabler::get_blog_domain(),
|
| 563 |
$path
|
| 564 |
);
|
readme.txt
CHANGED
|
@@ -81,6 +81,11 @@ When combined with Optimus, the WordPress Cache Enabler allows you to easily del
|
|
| 81 |
|
| 82 |
== Changelog ==
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
= 1.4.1 =
|
| 85 |
* Fix minor bugs
|
| 86 |
|
| 81 |
|
| 82 |
== Changelog ==
|
| 83 |
|
| 84 |
+
= 1.4.2 =
|
| 85 |
+
* Update cache clearing for the Clear URL Cache admin bar button
|
| 86 |
+
* Update scheme-based caching
|
| 87 |
+
* Fix advanced cache
|
| 88 |
+
|
| 89 |
= 1.4.1 =
|
| 90 |
* Fix minor bugs
|
| 91 |
|
