Skip to content

Commit

Permalink
v7.0-b26: * **Config** Dropped ver info when comparing md5 to decide …
Browse files Browse the repository at this point in the history
…if sync conf or not in plugin upgrade process.
  • Loading branch information
Hai Zheng committed Dec 12, 2024
1 parent e6eb517 commit 45a09b4
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions litespeed-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: LiteSpeed Cache
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
* Description: High-performance page caching and site optimization from LiteSpeed
* Version: 7.0-b25
* Version: 7.0-b26
* Author: LiteSpeed Technologies
* Author URI: https://www.litespeedtech.com
* License: GPLv3
Expand Down Expand Up @@ -34,7 +34,7 @@
return;
}

!defined('LSCWP_V') && define('LSCWP_V', '7.0-b25');
!defined('LSCWP_V') && define('LSCWP_V', '7.0-b26');

!defined('LSCWP_CONTENT_DIR') && define('LSCWP_CONTENT_DIR', WP_CONTENT_DIR);
!defined('LSCWP_DIR') && define('LSCWP_DIR', __DIR__ . '/'); // Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro
* **Cloud** Supported `list_preferred` in online service node detection.
* **Cloud** Fixed an error domain expiry removal PHP warning. (cheekymate06)
* **Config** Improved QUIC.cloud CDN config to auto turn ON after activiated online service.
* **Config** Dropped ver info when comparing md5 to decide if sync conf or not in plugin upgrade process.
* **Database Optimize** Fixed Autoload summary for WP6.6+. (Mukesh Panchal/Viktor Szépe)
* **CLI** New QUIC.cloud CDN CLI `wp litespeed-online cdn_init --ssl-cert=xxx.pem --ssl-key=xxx -method=cname|ns|cfi`.
* **CLI** New QUIC.cloud CDN CLI `wp litespeed-online link [email protected] --api-key=xxxx`.
Expand Down
1 change: 1 addition & 0 deletions src/base.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ class Base extends Root
protected static $_default_options = array(
self::_VER => '',
self::HASH => '',
self::O_API_KEY => '',
self::O_AUTO_UPGRADE => false,
self::O_SERVER_IP => '',
self::O_GUEST => false,
Expand Down
2 changes: 2 additions & 0 deletions src/cdn/quic.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public function try_sync_conf($force = false)
}
}
unset($options[self::O_MEDIA_LQIP_EXC]);
unset($options[self::O_API_KEY]);
unset($options[self::_VER]);

// Remove overflow multi lines fields
foreach ($options as $k => $v) {
Expand Down
2 changes: 1 addition & 1 deletion src/cloud.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ private function _maybe_cloud($service_tag)
}

if ($service_tag == self::SVC_D_SYNC_CONF && !$this->activated()) {
self::debug('Skip sync conf if API key is not available yet.');
self::debug('Skip sync conf as QC not activated yet.');
return false;
}

Expand Down
32 changes: 16 additions & 16 deletions src/data.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class Data extends Root
{
const LOG_TAG = '[Data]';
const LOG_TAG = '🚀';

private $_db_updater = array(
'3.5.0.3' => array('litespeed_update_3_5'),
Expand All @@ -24,7 +24,7 @@ class Data extends Root
'4.3' => array('litespeed_update_4_3'),
'4.4.4-b1' => array('litespeed_update_4_4_4'),
'5.3-a5' => array('litespeed_update_5_3'),
'7.0-b25' => array('litespeed_update_7'),
'7.0-b26' => array('litespeed_update_7'),
);

private $_db_site_updater = array(
Expand Down Expand Up @@ -120,7 +120,7 @@ public function conf_upgrade($ver)
if (version_compare($ver, $k, '<')) {
// run each callback
foreach ($v as $v2) {
Debug2::debug("[Data] Updating [ori_v] $ver \t[to] $k \t[func] $v2");
self::debug("Updating [ori_v] $ver \t[to] $k \t[func] $v2");
call_user_func($v2);
}
}
Expand All @@ -138,7 +138,7 @@ public function conf_upgrade($ver)
Conf::delete_option(Base::_VER);
Conf::add_option(Base::_VER, Core::VER);

Debug2::debug('[Data] Updated version to ' . Core::VER);
self::debug('Updated version to ' . Core::VER);

$this->_set_upgrade_lock(false);

Expand Down Expand Up @@ -170,7 +170,7 @@ public function conf_site_upgrade($ver)
if (version_compare($ver, $k, '<')) {
// run each callback
foreach ($v as $v2) {
Debug2::debug("[Data] Updating site [ori_v] $ver \t[to] $k \t[func] $v2");
self::debug("Updating site [ori_v] $ver \t[to] $k \t[func] $v2");
call_user_func($v2);
}
}
Expand All @@ -182,7 +182,7 @@ public function conf_site_upgrade($ver)
Conf::delete_site_option(Base::_VER);
Conf::add_site_option(Base::_VER, Core::VER);

Debug2::debug('[Data] Updated site_version to ' . Core::VER);
self::debug('Updated site_version to ' . Core::VER);

$this->_set_upgrade_lock(false);

Expand Down Expand Up @@ -267,7 +267,7 @@ public function try_upgrade_conf_3_0()
if ($this->conf(Base::O_DEBUG)) {
$this->cls('Debug2')->init();
}
Debug2::debug('[Data] Upgrading previous settings [from] ' . $ver . ' [to] v3.0');
self::debug('Upgrading previous settings [from] ' . $ver . ' [to] v3.0');

if ($this->_get_upgrade_lock()) {
return;
Expand All @@ -282,7 +282,7 @@ public function try_upgrade_conf_3_0()

$this->_set_upgrade_lock(false);

Debug2::debug('[Data] Upgraded to v3.0');
self::debug('Upgraded to v3.0');

// Upgrade from 3.0 to latest version
$ver = '3.0';
Expand Down Expand Up @@ -378,15 +378,15 @@ public function tb_create($tb)
{
global $wpdb;

Debug2::debug2('[Data] Checking table ' . $tb);
self::debug2('[Data] Checking table ' . $tb);

// Check if table exists first
if ($this->tb_exist($tb)) {
Debug2::debug2('[Data] Existed');
self::debug2('[Data] Existed');
return;
}

Debug2::debug('[Data] Creating ' . $tb);
self::debug('Creating ' . $tb);

$sql = sprintf(
'CREATE TABLE IF NOT EXISTS `%1$s` (' . $this->_tb_structure($tb) . ') %2$s;',
Expand All @@ -396,7 +396,7 @@ public function tb_create($tb)

$res = $wpdb->query($sql);
if ($res !== true) {
Debug2::debug('[Data] Warning! Creating table failed!', $sql);
self::debug('Warning! Creating table failed!', $sql);
Admin_Display::error(Error::msg('failed_tb_creation', array('<code>' . $tb . '</code>', '<code>' . $sql . '</code>')));
}
}
Expand All @@ -415,7 +415,7 @@ public function tb_del($tb)
return;
}

Debug2::debug('[Data] Deleting table ' . $tb);
self::debug('Deleting table ' . $tb);

$q = 'DROP TABLE IF EXISTS ' . $this->tb($tb);
$wpdb->query($q);
Expand Down Expand Up @@ -545,7 +545,7 @@ public function save_url($request_url, $vary, $file_type, $filecon_md5, $path, $
$file_to_del = $path . '/' . $v['filename'] . '.' . ($file_type == 'js' ? 'js' : 'css');
if (file_exists($file_to_del)) {
// Safe to delete
Debug2::debug('[Data] Delete expired unused file: ' . $file_to_del);
self::debug('Delete expired unused file: ' . $file_to_del);

// Clear related lscache first to avoid cache copy of same URL w/ diff QS
// Purge::add( Tag::TYPE_MIN . '.' . $file_row[ 'filename' ] . '.' . $file_type );
Expand Down Expand Up @@ -606,14 +606,14 @@ public function mark_as_expired($request_url, $auto_q = false)
global $wpdb;
$tb_url = $this->tb('url');

Debug2::debug('[Data] Try to mark as expired: ' . $request_url);
self::debug('Try to mark as expired: ' . $request_url);
$q = "SELECT * FROM `$tb_url` WHERE url=%s";
$url_row = $wpdb->get_row($wpdb->prepare($q, $request_url), ARRAY_A);
if (!$url_row) {
return;
}

Debug2::debug('[Data] Mark url_id=' . $url_row['id'] . ' as expired');
self::debug('Mark url_id=' . $url_row['id'] . ' as expired');

$tb_url_file = $this->tb('url_file');

Expand Down
2 changes: 0 additions & 2 deletions src/data.upgrade.func.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
function litespeed_update_7()
{
global $wpdb;
Debug2::debug('[Data] v7 upgrade started');

$__cloud = Cloud::cls();
Expand All @@ -33,7 +32,6 @@ function litespeed_update_7()
}

$new_prepared = $__cloud->init_qc_prepare();
$cloud_summary = Cloud::get_summary();
if (!$new_prepared && $__cloud->activated()) {
Debug2::debug('[Data] QC previously activated in v7, bypassed migration');
return;
Expand Down

0 comments on commit 45a09b4

Please sign in to comment.