Skip to content

Commit 5da498d

Browse files
author
Hai Zheng
committed
v7.1-b3: Check version after upgraded to reduce the requests.
1 parent 78f942b commit 5da498d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/conf.cls.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ private function _conf_db_init()
7575
/**
7676
* Version is less than v3.0, or, is a new installation
7777
*/
78+
$ver_check_tag = '';
7879
if (!$ver) {
7980
// Try upgrade first (network will upgrade inside too)
80-
Data::cls()->try_upgrade_conf_3_0();
81+
$ver_check_tag = Data::cls()->try_upgrade_conf_3_0();
8182
} else {
8283
defined('LSCWP_CUR_V') || define('LSCWP_CUR_V', $ver);
8384

@@ -87,7 +88,7 @@ private function _conf_db_init()
8788
if ($ver != Core::VER) {
8889
// Plugin version will be set inside
8990
// Site plugin upgrade & version change will do in load_site_conf
90-
Data::cls()->conf_upgrade($ver);
91+
$ver_check_tag = Data::cls()->conf_upgrade($ver);
9192
}
9293
}
9394

@@ -101,8 +102,7 @@ private function _conf_db_init()
101102
// New install
102103
$this->set_conf(self::$_default_options);
103104

104-
// Check new version @since 2.9.3
105-
Cloud::version_check('activate' . (defined('LSCWP_REF') ? '_' . LSCWP_REF : ''));
105+
$ver_check_tag .= ' activate' . (defined('LSCWP_REF') ? '_' . LSCWP_REF : '');
106106
}
107107

108108
// Init new default/missing options
@@ -114,6 +114,10 @@ private function _conf_db_init()
114114

115115
// Force correct version in case a rare unexpected case that `_ver` exists but empty
116116
self::update_option(Base::_VER, Core::VER);
117+
118+
if ($ver_check_tag) {
119+
Cloud::version_check($ver_check_tag);
120+
}
117121
}
118122

119123
/**

src/data.cls.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function conf_upgrade($ver)
146146
!defined('LSWCP_EMPTYCACHE') && define('LSWCP_EMPTYCACHE', true); // clear all sites caches
147147
Purge::purge_all();
148148

149-
Cloud::version_check('upgrade');
149+
return 'upgrade';
150150
}
151151

152152
/**
@@ -256,8 +256,7 @@ public function try_upgrade_conf_3_0()
256256
{
257257
$previous_options = get_option('litespeed-cache-conf');
258258
if (!$previous_options) {
259-
Cloud::version_check('new');
260-
return;
259+
return 'new';
261260
}
262261

263262
$ver = $previous_options['version'];
@@ -288,7 +287,7 @@ public function try_upgrade_conf_3_0()
288287
// Upgrade from 3.0 to latest version
289288
$ver = '3.0';
290289
if (Core::VER != $ver) {
291-
$this->conf_upgrade($ver);
290+
return $this->conf_upgrade($ver);
292291
} else {
293292
// Reload options
294293
$this->cls('Conf')->load_options();
@@ -298,7 +297,7 @@ public function try_upgrade_conf_3_0()
298297
!defined('LSWCP_EMPTYCACHE') && define('LSWCP_EMPTYCACHE', true); // clear all sites caches
299298
Purge::purge_all();
300299

301-
Cloud::version_check('upgrade');
300+
return 'upgrade';
302301
}
303302
}
304303

0 commit comments

Comments
 (0)