Preprocess PHP version

This commit is contained in:
Pig Fang 2019-09-12 19:31:48 +08:00
parent d5205ede35
commit 050fa45993
2 changed files with 8 additions and 4 deletions

View File

@ -98,7 +98,9 @@ class UpdateController extends Controller
$this->getUpdateInfo(); $this->getUpdateInfo();
$php = Arr::get($this->info, 'php'); $php = Arr::get($this->info, 'php');
if (Comparator::lessThan(PHP_VERSION, $php)) { preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches);
$version = $matches[1];
if (Comparator::lessThan($version, $php)) {
$this->error = trans('admin.update.errors.php', ['version' => $php]); $this->error = trans('admin.update.errors.php', ['version' => $php]);
return false; return false;

View File

@ -7,10 +7,12 @@
exit($error); exit($error);
} }
if (version_compare(PHP_VERSION, '7.2.0', '<')) { preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches);
$version = $matches[1];
if (version_compare($version, '7.2.0', '<')) {
die_with_utf8_encoding( die_with_utf8_encoding(
'[Error] Blessing Skin requires PHP version >= 7.2.0, you are now using '.PHP_VERSION.'<br>'. '[Error] Blessing Skin requires PHP version >= 7.2.0, you are now using '.$version.'<br>'.
'[错误] 你的 PHP 版本过低('.PHP_VERSION.'Blessing Skin 要求至少为 7.2.0' '[错误] 你的 PHP 版本过低('.$version.'Blessing Skin 要求至少为 7.2.0'
); );
} }