diff --git a/README-EN.md b/README-EN.md index 26ea0ac1..faf6e649 100644 --- a/README-EN.md +++ b/README-EN.md @@ -28,7 +28,7 @@ Complete PT website building solution. Based on NexusPHP + Laravel + Filament. ## System Requirements - PHP: 8.0, must have extensions: bcmath, ctype, curl, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd, redis, pcntl, sockets, posix - Mysql: 5.7 latest version or above -- Redis:1.0.0 or above +- Redis:2.0.0 or above ## Quick Start Install docker. diff --git a/README.md b/README.md index 41ad6857..fa90400e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ ## 系统要求 - PHP: 8.0,必须扩展:bcmath, ctype, curl, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd, redis, pcntl, sockets, posix - Mysql: 5.7最新版或以上版本 -- Redis:1.0.0或以上版本 +- Redis:2.0.0或以上版本 ## 快速开始 安装 docker。 diff --git a/app/Console/Commands/BackuAll.php b/app/Console/Commands/BackupAll.php similarity index 97% rename from app/Console/Commands/BackuAll.php rename to app/Console/Commands/BackupAll.php index bc2b5436..f268a4ce 100644 --- a/app/Console/Commands/BackuAll.php +++ b/app/Console/Commands/BackupAll.php @@ -5,7 +5,7 @@ namespace App\Console\Commands; use App\Repositories\ToolRepository; use Illuminate\Console\Command; -class BackuAll extends Command +class BackupAll extends Command { /** * The name and signature of the console command. diff --git a/app/Console/Commands/NexusUpdate.php b/app/Console/Commands/NexusUpdate.php index 1a6b44ac..ced9247d 100644 --- a/app/Console/Commands/NexusUpdate.php +++ b/app/Console/Commands/NexusUpdate.php @@ -91,6 +91,7 @@ class NexusUpdate extends Command $symbolicLinks = $settingTableRows['symbolic_links']; $fails = $settingTableRows['fails']; $mysqlInfo = $this->update->getMysqlVersionInfo(); + $redisInfo = $this->update->getRedisVersionInfo(); if (!empty($fails)) { foreach ($fails as $value) { @@ -102,6 +103,10 @@ class NexusUpdate extends Command $this->doLog("Error: MySQL version: {$mysqlInfo['version']} is too low, please use the newest version of 5.7 or above.", 'error'); return 0; } + if (!$redisInfo['match']) { + $this->doLog("Error: Redis version: {$mysqlInfo['version']} is too low, please use 2.0.0 or above.", 'error'); + return 0; + } $this->doLog("going to createSymbolicLinks..."); $this->update->createSymbolicLinks($symbolicLinks); $this->doLog("createSymbolicLinks done!"); diff --git a/app/Repositories/ExamRepository.php b/app/Repositories/ExamRepository.php index e14d619a..1844be26 100644 --- a/app/Repositories/ExamRepository.php +++ b/app/Repositories/ExamRepository.php @@ -293,7 +293,7 @@ class ExamRepository extends BaseRepository $logPrefix = "uid: $uid, examId: $examId, begin: $begin, end: $end"; $exam = Exam::query()->find($examId); $user = User::query()->findOrFail($uid); - if (Auth::user()->Class <= $user->class) { + if (Auth::user()->class <= $user->class) { throw new NexusException("No permission !"); } if (!$this->isExamMatchUser($exam, $user)) { diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 47973fa1..be1180ce 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -233,7 +233,7 @@ class UserRepository extends BaseRepository } $sourceField = $fieldMap[$field]; $targetUser = User::query()->findOrFail($uid, User::$commonFields); - if (Auth::user()->Class <= $targetUser->class) { + if (Auth::user()->class <= $targetUser->class) { throw new NexusException("No permission !"); } $old = $targetUser->{$sourceField}; diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 52759ace..df6cd8db 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -663,6 +663,16 @@ class Install return compact('version', 'match'); } + public function getRedisVersionInfo(): array + { + global $Cache; + $redis = $Cache->getRedis(); + $result = $redis->info(); + $version = $result['redis_version']; + $match = version_compare($version, '2.0.0', '>='); + return compact('version', 'match'); + } + public function checkLock() { $fullFilename = ROOT_PATH . $this->lockFile; diff --git a/nexus/Install/install/install.php b/nexus/Install/install/install.php index 608d5a9d..30ace48a 100644 --- a/nexus/Install/install/install.php +++ b/nexus/Install/install/install.php @@ -104,6 +104,7 @@ if ($currentStep == 4) { $tableRows = $settingTableRows['table_rows']; $pass = $settingTableRows['pass']; $mysqlInfo = $install->getMysqlVersionInfo(); + $redisInfo = $install->getREdisVersionInfo(); while ($isPost) { set_time_limit(300); try { @@ -136,7 +137,11 @@ if ($currentStep == 5) { ]; } -if (!empty($error) || (isset($mysqlInfo) && !$mysqlInfo['match'])) { +if ( + !empty($error) + || (isset($mysqlInfo) && !$mysqlInfo['match']) + || (isset($redisInfo) && !$redisInfo['match']) +) { $pass = false; } ?> @@ -184,6 +189,9 @@ if (!empty($error) || (isset($mysqlInfo) && !$mysqlInfo['match'])) { if (!$mysqlInfo['match']) { echo sprintf('
' . $update->getLogFile() . '