瀏覽代碼

优化安装最低PHP版本限制

Karson 1 年之前
父節點
當前提交
9cf5b91143
共有 2 個文件被更改,包括 11 次插入4 次删除
  1. 10 3
      application/admin/command/Install.php
  2. 1 1
      application/admin/command/Install/zh-cn.php

+ 10 - 3
application/admin/command/Install.php

@@ -17,6 +17,13 @@ use think\View;
 
 class Install extends Command
 {
+
+    /**
+     * 最低PHP版本
+     * @var string
+     */
+    protected $minPhpVersion = '7.4.0';
+
     protected $model = null;
     /**
      * @var \think\View 视图类实例
@@ -70,7 +77,7 @@ class Install extends Command
 
         $adminName = $this->installation($hostname, $hostport, $database, $username, $password, $prefix, $adminUsername, $adminPassword, $adminEmail, $siteName);
         if ($adminName) {
-            $output->highlight("Admin url:http://www.yoursite.com/{$adminName}");
+            $output->highlight("Admin url:https://www.example.com/{$adminName}");
         }
 
         $output->highlight("Admin username:{$adminUsername}");
@@ -309,8 +316,8 @@ class Install extends Command
         //数据库配置文件
         $dbConfigFile = APP_PATH . 'database.php';
 
-        if (version_compare(PHP_VERSION, '7.2.0', '<')) {
-            throw new Exception(__("The current version %s is too low, please use PHP 7.2 or higher", PHP_VERSION));
+        if (version_compare(PHP_VERSION, $this->minPhpVersion, '<')) {
+            throw new Exception(__("The current PHP %s is too low, please use PHP %s or higher", PHP_VERSION, $this->minPhpVersion));
         }
         if (!extension_loaded("PDO")) {
             throw new Exception(__("PDO is not currently installed and cannot be installed"));

+ 1 - 1
application/admin/command/Install/zh-cn.php

@@ -27,7 +27,7 @@ return [
     'Password is too weak'                                                                                  => '密码太简单,请重新输入',
     'The two passwords you entered did not match'                                                           => '两次输入的密码不一致',
     'Please input correct website'                                                                          => '网站名称输入不正确',
-    'The current version %s is too low, please use PHP 7.1 or higher'                                       => '当前版本%s过低,请使用PHP7.1以上版本',
+    'The current PHP %s is too low, please use PHP %s or higher'                                            => '当前版本PHP %s过低,请使用PHP %s及以上版本',
     'PDO is not currently installed and cannot be installed'                                                => '当前未开启PDO,无法进行安装',
     'The current permissions are insufficient to write the file %s'                                         => '当前权限不足,无法写入文件%s',
     'Please go to the official website to download the full package or resource package and try to install' => '当前代码仅包含核心代码,请前往官网下载完整包或资源包覆盖后再尝试安装',