Skip to content

Commit 38f5aa8

Browse files
author
Hai Zheng
committed
v7.4-b7: Improved Disable All for a period feature.
1 parent b179739 commit 38f5aa8

8 files changed

Lines changed: 51 additions & 39 deletions

File tree

litespeed-cache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: LiteSpeed Cache
55
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
66
* Description: High-performance page caching and site optimization from LiteSpeed
7-
* Version: 7.4-b5
7+
* Version: 7.4-b7
88
* Author: LiteSpeed Technologies
99
* Author URI: https://www.litespeedtech.com
1010
* License: GPLv3
@@ -32,7 +32,7 @@
3232

3333
if (defined('LSCWP_V')) return;
3434

35-
!defined('LSCWP_V') && define('LSCWP_V', '7.4-b5');
35+
!defined('LSCWP_V') && define('LSCWP_V', '7.4-b7');
3636

3737
!defined('LSCWP_CONTENT_DIR') && define('LSCWP_CONTENT_DIR', WP_CONTENT_DIR);
3838
!defined('LSCWP_DIR') && define('LSCWP_DIR', __DIR__ . '/'); // Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU

phpcs.ruleset.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
5757
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
5858
</rule>
59+
<rule ref="Universal.Arrays.DisallowShortArraySyntax">
60+
<severity>0</severity>
61+
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/>
62+
</rule>
5963
<rule ref="Squiz.PHP.CommentedOutCode">
6064
<severity>0</severity>
6165
</rule>

readme.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro
257257

258258
== Changelog ==
259259

260+
= 7.4 - Aug 26 2025 =
261+
* 🌱**Toolbox** Disable All for 24 Hours. (PR#886)
262+
* **Cache** Better match iPhone browsers for mobile cache detection.
263+
* **Cache** Dropped `advanced-cache.php` since WP version v5.3+ required.
264+
* **Page Optimize** Better compatibility for dummy CSS removal in case other plugins manipulated the quotes.
265+
* **Page Optimize** Dropped v4.2 legacy `LITESPEED_BYPASS_OPTM`.
266+
* **Crawler** Used .html file to test port in case some security plugins blocked .txt which caused port test failure. (#661828)
267+
* **Misc** Allows leading `_` for private func/vars in format checker.
268+
* **Misc** Suppressed frequent version check when certain database option is cached.
269+
260270
= 7.3.0.1 - Jul 30 2025 =
261271
* **Page Optimize** Fixed the page score impact caused by CSS placeholder. (wpconvert, Sean Thompson)
262272
* **Page Optimize** Fixed wrong prefetch/preload injection when a page contains other `<title>` tags. (idatahuy)

src/core.cls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function __construct() {
8181
}
8282

8383

84-
if ( $this->conf( Base::O_DEBUG_DISABLE_ALL ) || Debug2::is_temporary_disable() ) {
84+
if ( $this->conf( Base::O_DEBUG_DISABLE_ALL ) || Debug2::is_tmp_disable() ) {
8585
! defined( 'LITESPEED_DISABLE_ALL' ) && define( 'LITESPEED_DISABLE_ALL', true );
8686
}
8787

src/debug2.cls.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,19 @@ public function __construct() {
5555
* @access public
5656
* @param integer $time How long should we disable LSC functionalities.
5757
*/
58-
public static function temporary_disable( $time = 86400 ) {
58+
public static function tmp_disable( $time = 86400 ) {
5959
$conf = Conf::cls();
6060
$disabled = self::cls()->conf( Base::DEBUG_TMP_DISABLE );
6161

6262
if ( 0 === $disabled ) {
63-
$conf->update_confs( [ Base::DEBUG_TMP_DISABLE => time() + $time ] );
64-
self::debug2( '[Debug] LiteSpeed Cache temporary disabled.' );
63+
$conf->update_confs( array( Base::DEBUG_TMP_DISABLE => time() + $time ) );
64+
self::debug2( 'LiteSpeed Cache temporary disabled.' );
6565

6666
return;
6767
}
6868

69-
$conf->update_confs( [ Base::DEBUG_TMP_DISABLE => 0 ] );
70-
self::debug2( '[Debug] LiteSpeed Cache reactivated.' );
69+
$conf->update_confs( array( Base::DEBUG_TMP_DISABLE => 0 ) );
70+
self::debug2( 'LiteSpeed Cache reactivated.' );
7171
}
7272

7373
/**
@@ -76,21 +76,19 @@ public static function temporary_disable( $time = 86400 ) {
7676
* @since 7.4
7777
* @access public
7878
*/
79-
public static function is_temporary_disable() {
80-
$conf = Conf::cls();
79+
public static function is_tmp_disable() {
8180
$disabled_time = self::cls()->conf( Base::DEBUG_TMP_DISABLE );
8281

8382
if ( 0 === $disabled_time ) {
8483
return false;
85-
} else {
86-
$time = time();
87-
if( 0 > $time - $disabled_time ){
88-
return true;
89-
} else {
90-
$conf->update_confs( [ Base::DEBUG_TMP_DISABLE => 0 ] );
91-
return false;
92-
}
9384
}
85+
86+
if ( time() - $disabled_time < 0 ){
87+
return true;
88+
}
89+
90+
Conf::cls()->update_confs( array( Base::DEBUG_TMP_DISABLE => 0 ) );
91+
return false;
9492
}
9593

9694
/**

src/router.cls.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Router extends Base {
4141
const ACTION_DEBUG2 = 'debug2';
4242
const ACTION_CDN_CLOUDFLARE = 'CDN\Cloudflare';
4343
const ACTION_ADMIN_DISPLAY = 'admin_display';
44-
const ACTION_DISABLE_TEMP = 'disable_temp';
44+
const ACTION_TMP_DISABLE = 'tmp_disable';
4545

4646
// List all handlers here
4747
private static $_HANDLERS = array(
@@ -588,8 +588,8 @@ private function verify_action() {
588588
$_can_option = current_user_can('manage_options');
589589

590590
switch ($action) {
591-
case self::ACTION_DISABLE_TEMP: // disable LSC for 24H
592-
Debug2::temporary_disable();
591+
case self::ACTION_TMP_DISABLE: // Disable LSC for 24H
592+
Debug2::tmp_disable();
593593
Admin::redirect("?page=litespeed-toolbox#settings-debug");
594594
return;
595595

tpl/crawler/entry.tpl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
defined( 'WPINC' ) || exit;
1212

13-
$menu_list = array(
13+
$menu_list = [
1414
'summary' => esc_html__( 'Summary', 'litespeed-cache' ),
1515
'map' => esc_html__( 'Map', 'litespeed-cache' ),
1616
'blacklist' => esc_html__( 'Blocklist', 'litespeed-cache' ),
1717
'settings' => esc_html__( 'Settings', 'litespeed-cache' ),
18-
);
18+
];
1919
?>
2020

2121
<div class="wrap">

tpl/toolbox/settings-debug.tpl.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,27 @@
2929

3030

3131
<?php
32-
$temp_disabled_time = $this->conf( Base::DEBUG_TMP_DISABLE );
33-
$temp_disabled = Debug2::is_temporary_disable();
32+
$temp_disabled_time = $this->conf( Base::DEBUG_TMP_DISABLE );
33+
$temp_disabled = Debug2::is_tmp_disable();
34+
if ( !$temp_disabled ) {
3435
?>
35-
<a href="<?php echo wp_kses_post( Utility::build_url(Router::ACTION_DISABLE_TEMP, false, false, '_ori') ); ?>" class="button button-success">
36-
<?php
37-
if ( !$temp_disabled ) {
38-
esc_html_e( 'Disable all optimizations for 24H', 'litespeed-cache' );
39-
} else {
40-
esc_html_e( 'Enable LSC now', 'litespeed-cache' );
41-
}
42-
?>
43-
</a>
36+
<a href="<?php echo wp_kses_post( Utility::build_url(Router::ACTION_TMP_DISABLE, false, false, '_ori') ); ?>" class="button litespeed-btn-danger">
37+
<?php esc_html_e( 'Disable All Features for 24 Hours', 'litespeed-cache' ); ?>
38+
</a>
4439
<?php
45-
if ( $temp_disabled ) :
46-
$date = wp_date( get_option('date_format') . ' ' . get_option( 'time_format' ), $temp_disabled_time );
40+
} else {
41+
$date = wp_date( get_option('date_format') . ' ' . get_option( 'time_format' ), $temp_disabled_time );
4742
?>
43+
<a href="<?php echo wp_kses_post( Utility::build_url(Router::ACTION_TMP_DISABLE, false, false, '_ori') ); ?>" class="button litespeed-btn-warning">
44+
<?php esc_html_e( 'Remove `Disable All Feature` Flag Now', 'litespeed-cache' ); ?>
45+
</a>
4846
<div class="litespeed-callout notice notice-warning inline">
49-
<h4><?php esc_html_e( 'NOTICE:', 'litespeed-cache' ); ?></h4>
50-
<p><?php echo wp_kses_post( sprintf ( __( 'LiteSpeed Cache is temporary disabled until: %s.', 'litespeed-cache' ), '<strong>' . $date . '</strong>' ) ); ?></p>
47+
<h4><?php esc_html_e( 'NOTICE', 'litespeed-cache' ); ?></h4>
48+
<p><?php echo wp_kses_post( sprintf ( __( 'LiteSpeed Cache is temporarily disabled until: %s.', 'litespeed-cache' ), '<strong>' . $date . '</strong>' ) ); ?></p>
5149
</div>
52-
<?php endif; ?>
50+
<?php
51+
}
52+
?>
5353

5454
<h3 class="litespeed-title-short">
5555
<?php esc_html_e( 'Debug Settings', 'litespeed-cache' ); ?>

0 commit comments

Comments
 (0)