Version Description
- Sep 23 2021 =
- Purge In order to clear pages containing 404 CSS/JS, the purge header will always be sent even in cases where purge must be delayed.
- Purge Fixed a potential PHP warning caused when generating different optimized filenames.
- Cron Dropped unnecessary HTML response in cron which sometimes resulted in wp-cron report email. (Gilles)
- Page Optimize Purge caused by CSS/JS file deletion will now be silent.
- Page Optimize Fixed an issue where the homepage failed to purge when addressing the 404 CSS/JS issue.
- Avatar Fixed potential localized Avatar folder creation warning. (mattk0220/josebab)
-
API Added filter
litespeed_optm_html_after_head
to move all optimized code(UCSS/CCSS/Combined CSS/Combined JS) to be right before the</head>
tag. (ducpl/Kris Regmi) - Debug Under debug mode, cache/purge tags will be plaintext.
Download this release
Release Info
Developer | LiteSpeedTech |
Plugin | LiteSpeed Cache |
Version | 4.4.2 |
Comparing to | |
See all releases |
Code changes from version 4.4.1 to 4.4.2
- litespeed-cache.php +2 -2
- readme.txt +11 -1
- src/avatar.cls.php +2 -13
- src/css.cls.php +4 -0
- src/data.cls.php +1 -1
- src/optimize.cls.php +9 -4
- src/purge.cls.php +3 -3
- src/root.cls.php +13 -0
- src/tag.cls.php +4 -1
- tpl/toolbox/beta_test.tpl.php +2 -1
litespeed-cache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: LiteSpeed Cache
|
4 |
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
|
5 |
* Description: High-performance page caching and site optimization from LiteSpeed
|
6 |
-
* Version: 4.4.
|
7 |
* Author: LiteSpeed Technologies
|
8 |
* Author URI: https://www.litespeedtech.com
|
9 |
* License: GPLv3
|
@@ -33,7 +33,7 @@ if ( defined( 'LSCWP_V' ) ) {
|
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
-
! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '4.4.
|
37 |
|
38 |
! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR ) ;
|
39 |
! defined( 'LSCWP_DIR' ) && define( 'LSCWP_DIR', __DIR__ . '/' ) ;// Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
|
3 |
* Plugin Name: LiteSpeed Cache
|
4 |
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
|
5 |
* Description: High-performance page caching and site optimization from LiteSpeed
|
6 |
+
* Version: 4.4.2
|
7 |
* Author: LiteSpeed Technologies
|
8 |
* Author URI: https://www.litespeedtech.com
|
9 |
* License: GPLv3
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
+
! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '4.4.2' );
|
37 |
|
38 |
! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR ) ;
|
39 |
! defined( 'LSCWP_DIR' ) && define( 'LSCWP_DIR', __DIR__ . '/' ) ;// Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: LiteSpeedTech
|
|
3 |
Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.7.2
|
6 |
-
Stable tag: 4.4.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
|
@@ -249,6 +249,16 @@ The vast majority of plugins and themes are compatible with LiteSpeed Cache. The
|
|
249 |
|
250 |
== Changelog ==
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
= 4.4.1 - Sep 16 2021 =
|
253 |
* 🐞**ESI** Fixed ESI failure on non-cached pages caused by `DONOTCACHEPAGE` constant.
|
254 |
* 🐞**Page Optimize** Fixed an issue where the minified CSS/JS file failed to update when the file was changed. (ceap80)
|
3 |
Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.7.2
|
6 |
+
Stable tag: 4.4.2
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
|
249 |
|
250 |
== Changelog ==
|
251 |
|
252 |
+
= 4.4.2 - Sep 23 2021 =
|
253 |
+
* **Purge** In order to clear pages containing 404 CSS/JS, the purge header will always be sent even in cases where purge must be delayed.
|
254 |
+
* 🐞**Purge** Fixed a potential PHP warning caused when generating different optimized filenames.
|
255 |
+
* **Cron** Dropped unnecessary HTML response in cron which sometimes resulted in wp-cron report email. (Gilles)
|
256 |
+
* **Page Optimize** Purge caused by CSS/JS file deletion will now be silent.
|
257 |
+
* **Page Optimize** Fixed an issue where the homepage failed to purge when addressing the 404 CSS/JS issue.
|
258 |
+
* **Avatar** Fixed potential localized Avatar folder creation warning. (mattk0220/josebab)
|
259 |
+
* **API** Added filter `litespeed_optm_html_after_head` to move all optimized code(UCSS/CCSS/Combined CSS/Combined JS) to be right before the `</head>` tag. (ducpl/Kris Regmi)
|
260 |
+
* **Debug** Under debug mode, cache/purge tags will be plaintext.
|
261 |
+
|
262 |
= 4.4.1 - Sep 16 2021 =
|
263 |
* 🐞**ESI** Fixed ESI failure on non-cached pages caused by `DONOTCACHEPAGE` constant.
|
264 |
* 🐞**Page Optimize** Fixed an issue where the minified CSS/JS file failed to update when the file was changed. (ceap80)
|
src/avatar.cls.php
CHANGED
@@ -124,16 +124,6 @@ class Avatar extends Base {
|
|
124 |
return $this->_avatar_realtime_gen_dict[ $url ];
|
125 |
}
|
126 |
|
127 |
-
/**
|
128 |
-
* make cache folder
|
129 |
-
*
|
130 |
-
* @since 3.0
|
131 |
-
* @access private
|
132 |
-
*/
|
133 |
-
private function _mkdir() {
|
134 |
-
mkdir( LITESPEED_STATIC_DIR . '/avatar', 0755, true );
|
135 |
-
}
|
136 |
-
|
137 |
/**
|
138 |
* Read last time generated info
|
139 |
*
|
@@ -240,9 +230,8 @@ class Avatar extends Base {
|
|
240 |
self::save_summary();
|
241 |
|
242 |
// Generate
|
243 |
-
|
244 |
-
|
245 |
-
}
|
246 |
$response = wp_remote_get( $url, array( 'timeout' => 180, 'stream' => true, 'filename' => $file ) );
|
247 |
|
248 |
Debug2::debug( '[Avatar] _generate [url] ' . $url );
|
124 |
return $this->_avatar_realtime_gen_dict[ $url ];
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
/**
|
128 |
* Read last time generated info
|
129 |
*
|
230 |
self::save_summary();
|
231 |
|
232 |
// Generate
|
233 |
+
$this->_maybe_mk_cache_folder( 'avatar' );
|
234 |
+
|
|
|
235 |
$response = wp_remote_get( $url, array( 'timeout' => 180, 'stream' => true, 'filename' => $file ) );
|
236 |
|
237 |
Debug2::debug( '[Avatar] _generate [url] ' . $url );
|
src/css.cls.php
CHANGED
@@ -352,6 +352,10 @@ class CSS extends Base {
|
|
352 |
unset( $this->_queue[ $k ] );
|
353 |
$this->save_queue( $type, $this->_queue );
|
354 |
|
|
|
|
|
|
|
|
|
355 |
if ( $i > 3 ) {
|
356 |
$this->_print_loading( count( $this->_queue ), $type_tag );
|
357 |
return Router::self_redirect( Router::ACTION_CSS, $type == 'ccss' ? CSS::TYPE_GEN_CCSS : CSS::TYPE_GEN_UCSS );
|
352 |
unset( $this->_queue[ $k ] );
|
353 |
$this->save_queue( $type, $this->_queue );
|
354 |
|
355 |
+
if ( ! $continue ) {
|
356 |
+
return;
|
357 |
+
}
|
358 |
+
|
359 |
if ( $i > 3 ) {
|
360 |
$this->_print_loading( count( $this->_queue ), $type_tag );
|
361 |
return Router::self_redirect( Router::ACTION_CSS, $type == 'ccss' ? CSS::TYPE_GEN_CCSS : CSS::TYPE_GEN_UCSS );
|
src/data.cls.php
CHANGED
@@ -483,7 +483,7 @@ class Data extends Root {
|
|
483 |
$wpdb->query( $wpdb->prepare( $q, array( $filecon_md5, $file_row[ 'id' ] ) ) );
|
484 |
|
485 |
// Purge this URL to avoid cache copy of same URL w/ diff QS
|
486 |
-
Purge
|
487 |
|
488 |
// Check if has other records used this file or not
|
489 |
$file_to_del = $path . '/' . $file_row[ 'filename' ] . '.' . ( $file_type == 'js' ? 'js' : 'css' );
|
483 |
$wpdb->query( $wpdb->prepare( $q, array( $filecon_md5, $file_row[ 'id' ] ) ) );
|
484 |
|
485 |
// Purge this URL to avoid cache copy of same URL w/ diff QS
|
486 |
+
$this->cls( 'Purge' )->purge_url( Utility::make_relative( $request_url ) ?: '/', true, true );
|
487 |
|
488 |
// Check if has other records used this file or not
|
489 |
$file_to_del = $path . '/' . $file_row[ 'filename' ] . '.' . ( $file_type == 'js' ? 'js' : 'css' );
|
src/optimize.cls.php
CHANGED
@@ -458,12 +458,17 @@ class Optimize extends Base {
|
|
458 |
// Replace html head part
|
459 |
$this->html_head = apply_filters( 'litespeed_optm_html_head', $this->html_head );
|
460 |
if ( $this->html_head ) {
|
461 |
-
|
462 |
-
|
463 |
-
$this->content = preg_replace( '#<meta charset([^>]*)>#isU', '<meta charset$1>' . $this->html_head , $this->content, 1 );
|
464 |
}
|
465 |
else {
|
466 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
}
|
468 |
}
|
469 |
|
458 |
// Replace html head part
|
459 |
$this->html_head = apply_filters( 'litespeed_optm_html_head', $this->html_head );
|
460 |
if ( $this->html_head ) {
|
461 |
+
if ( apply_filters( 'litespeed_optm_html_after_head', false ) ) {
|
462 |
+
$this->content = str_replace( '</head>', $this->html_head . '</head>', $this->content );
|
|
|
463 |
}
|
464 |
else {
|
465 |
+
// Put header content to be after charset
|
466 |
+
if ( strpos( $this->content, '<meta charset' ) !== false ) {
|
467 |
+
$this->content = preg_replace( '#<meta charset([^>]*)>#isU', '<meta charset$1>' . $this->html_head , $this->content, 1 );
|
468 |
+
}
|
469 |
+
else {
|
470 |
+
$this->content = preg_replace( '#<head([^>]*)>#isU', '<head$1>' . $this->html_head , $this->content, 1 );
|
471 |
+
}
|
472 |
}
|
473 |
}
|
474 |
|
src/purge.cls.php
CHANGED
@@ -418,13 +418,13 @@ class Purge extends Base {
|
|
418 |
|
419 |
// Send purge header immediately
|
420 |
$curr_built = $this->_build( $purge2 );
|
|
|
421 |
if ( defined( 'LITESPEED_DID_send_headers' ) || defined( 'LITESPEED_CLI' ) ) {
|
422 |
// Can't send, already has output, need to save and wait for next run
|
423 |
self::update_option( $purge2 ? self::DB_QUEUE2 : self::DB_QUEUE, $curr_built );
|
424 |
Debug2::debug( '[Purge] Output existed, queue stored: ' . $curr_built );
|
425 |
}
|
426 |
else {
|
427 |
-
@header( $curr_built );
|
428 |
Debug2::debug( $curr_built );
|
429 |
}
|
430 |
|
@@ -655,7 +655,7 @@ class Purge extends Base {
|
|
655 |
* @since 1.0.7
|
656 |
* @access public
|
657 |
*/
|
658 |
-
public function purge_url( $url, $purge2 = false ) {
|
659 |
$val = trim( $url );
|
660 |
if ( empty( $val ) ) {
|
661 |
return;
|
@@ -677,7 +677,7 @@ class Purge extends Base {
|
|
677 |
|
678 |
self::add( $hash, $purge2 );
|
679 |
|
680 |
-
! defined( 'LITESPEED_PURGE_SILENT' ) && Admin_Display::succeed( sprintf( __( 'Purge url %s', 'litespeed-cache' ), $val ) );
|
681 |
}
|
682 |
|
683 |
/**
|
418 |
|
419 |
// Send purge header immediately
|
420 |
$curr_built = $this->_build( $purge2 );
|
421 |
+
@header( $curr_built );
|
422 |
if ( defined( 'LITESPEED_DID_send_headers' ) || defined( 'LITESPEED_CLI' ) ) {
|
423 |
// Can't send, already has output, need to save and wait for next run
|
424 |
self::update_option( $purge2 ? self::DB_QUEUE2 : self::DB_QUEUE, $curr_built );
|
425 |
Debug2::debug( '[Purge] Output existed, queue stored: ' . $curr_built );
|
426 |
}
|
427 |
else {
|
|
|
428 |
Debug2::debug( $curr_built );
|
429 |
}
|
430 |
|
655 |
* @since 1.0.7
|
656 |
* @access public
|
657 |
*/
|
658 |
+
public function purge_url( $url, $purge2 = false, $quite = false ) {
|
659 |
$val = trim( $url );
|
660 |
if ( empty( $val ) ) {
|
661 |
return;
|
677 |
|
678 |
self::add( $hash, $purge2 );
|
679 |
|
680 |
+
! $quite && ! defined( 'LITESPEED_PURGE_SILENT' ) && Admin_Display::succeed( sprintf( __( 'Purge url %s', 'litespeed-cache' ), $val ) );
|
681 |
}
|
682 |
|
683 |
/**
|
src/root.cls.php
CHANGED
@@ -67,6 +67,19 @@ abstract class Root {
|
|
67 |
return false;
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
/**
|
71 |
* Delete file-based cache folder for that type
|
72 |
*
|
67 |
return false;
|
68 |
}
|
69 |
|
70 |
+
/**
|
71 |
+
* Maybe make the cache folder if not existed
|
72 |
+
*
|
73 |
+
* @since 4.4.2
|
74 |
+
*/
|
75 |
+
protected function _maybe_mk_cache_folder( $type ) {
|
76 |
+
if ( ! $this->has_cache_folder( $type ) ) {
|
77 |
+
$subsite_id = is_multisite() && ! is_network_admin() ? get_current_blog_id() : '';
|
78 |
+
$path = LITESPEED_STATIC_DIR . '/' . $type . '/' . $subsite_id;
|
79 |
+
mkdir( $path, 0755, true );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
/**
|
84 |
* Delete file-based cache folder for that type
|
85 |
*
|
src/tag.cls.php
CHANGED
@@ -194,7 +194,10 @@ class Tag extends Root {
|
|
194 |
if ( $ori ) {
|
195 |
return $slashed;
|
196 |
}
|
197 |
-
|
|
|
|
|
|
|
198 |
return self::TYPE_URL . md5( $slashed );
|
199 |
}
|
200 |
|
194 |
if ( $ori ) {
|
195 |
return $slashed;
|
196 |
}
|
197 |
+
|
198 |
+
if ( defined( 'LSCWP_LOG' ) ) {
|
199 |
+
return self::TYPE_URL . $slashed;
|
200 |
+
}
|
201 |
return self::TYPE_URL . md5( $slashed );
|
202 |
}
|
203 |
|
tpl/toolbox/beta_test.tpl.php
CHANGED
@@ -4,7 +4,8 @@ defined( 'WPINC' ) || exit;
|
|
4 |
|
5 |
// Existing public version list
|
6 |
$v_list = array(
|
7 |
-
'4.4',
|
|
|
8 |
'4.3',
|
9 |
'4.2',
|
10 |
'4.1',
|
4 |
|
5 |
// Existing public version list
|
6 |
$v_list = array(
|
7 |
+
'4.4.2',
|
8 |
+
'4.4.1',
|
9 |
'4.3',
|
10 |
'4.2',
|
11 |
'4.1',
|