Skip to content

Commit b89c82d

Browse files
author
Hai Zheng
committed
v7.9.2-rc1: * **3rd** WCML: guests in the shop currency now use the default cache, and the crawler warms it. (#1057)
1 parent 6cb8e86 commit b89c82d

4 files changed

Lines changed: 39 additions & 3 deletions

File tree

‎litespeed-cache.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: LiteSpeed Cache
44
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
55
* Description: High-performance page caching and site optimization from LiteSpeed
6-
* Version: 7.9.2-b70
6+
* Version: 7.9.2-rc1
77
* Author: LiteSpeed Technologies
88
* Author URI: https://www.litespeedtech.com
99
* License: GPLv3
@@ -35,7 +35,7 @@
3535
return;
3636
}
3737

38-
! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '7.9.2-b70' );
38+
! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '7.9.2-rc1' );
3939

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

‎readme.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Please don't report a suspected vulnerability in this support forum. Reporting d
286286
* **Task** Isolated asynchronous tokens by job type, used constant-time validation, and excluded tokens from logs.
287287
* **Purge** Corrected unpublished-post and empty-archive purges, preserved encoded paths, and prevented site cron from flushing shared backends.
288288
* **3rd** Corrected WooCommerce and NextGEN purges, protected unvaried cart responses, and validated bulk-edit and WCML settings permissions.
289+
* **3rd** WCML: guests in the shop currency now use the default cache, and the crawler warms it. (#1057)
289290
* **Core** Hardened file writes, admin output and static asset headers, replaced React and Babel with plain jQuery/JavaScript forms, and improved installation, upgrade and uninstall handling.
290291
* **Localization** Validated resource patterns while preserving comments, limited remote JavaScript downloads to 10 seconds, cleaned failed downloads, and restored HTTPS fallback redirects.
291292

‎thirdparty/wcml.cls.php‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ public static function apply_vary( $vary_list ) {
113113
/**
114114
* Inject the WCML vary row into the crawler cookie list.
115115
*
116+
* A currency that needs no vary cookie (the shop currency without location mode, Guest Mode off) maps to `_null`, so the crawler also runs it cookie-less.
117+
*
116118
* @since 7.9
117119
* @access public
118120
* @param mixed $cookies Crawler cookie list.
@@ -131,6 +133,11 @@ public static function inject_vary_row( $cookies ) {
131133

132134
$vals = [];
133135
foreach ($selected as $code) {
136+
if (self::_is_cookieless($code)) {
137+
$vals[] = '_null';
138+
continue;
139+
}
140+
// A false hash here is a HASH failure or LITESPEED_GUEST bypass, never proof of no vary: skip it.
134141
$h = self::_vary_hash($code);
135142
if (!empty($h)) {
136143
$vals[] = $h;
@@ -154,9 +161,14 @@ public static function inject_vary_row( $cookies ) {
154161
$other_rows[] = $c;
155162
}
156163
}
164+
$vals = array_values(array_unique(array_merge($existing_vals, $vals)));
165+
// Without an existing or selected hash, the default guest crawl is already cookie-less.
166+
if (!array_diff($vals, [ '_null' ])) {
167+
return $cookies;
168+
}
157169
$other_rows[] = [
158170
'name' => $vary_name,
159-
'vals' => array_values(array_unique(array_merge($existing_vals, $vals))),
171+
'vals' => $vals,
160172
];
161173
return $other_rows;
162174
}
@@ -329,6 +341,28 @@ private static function _by_location() {
329341
return !empty($settings['default_currencies']) && is_array($settings['default_currencies']) && in_array('location', $settings['default_currencies'], true);
330342
}
331343

344+
/**
345+
* Whether a guest in the given currency needs no vary cookie at all.
346+
*
347+
* Mirrors the guest vary list of Vary::finalize_default_vary(-1) with Guest Mode off. With Guest Mode on the crawler already presets a `_null` run.
348+
*
349+
* @since 7.9.2
350+
* @access private
351+
* @param string $currency Currency code.
352+
* @return bool
353+
*/
354+
private static function _is_cookieless( $currency ) {
355+
if (apply_filters('litespeed_conf', \LiteSpeed\Base::O_GUEST)) {
356+
return false;
357+
}
358+
359+
$prev = self::$_currency;
360+
self::$_currency = $currency;
361+
$vary = apply_filters('litespeed_vary', []);
362+
self::$_currency = $prev;
363+
return empty($vary);
364+
}
365+
332366
/**
333367
* Compute the vary cookie value for a guest under the given currency.
334368
*

‎tpl/toolbox/beta_test.tpl.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
// List of available public versions
1616
$v_list = array(
17+
'7.9.2',
1718
'7.9.1',
1819
'7.9',
1920
'7.8.1',

0 commit comments

Comments
 (0)