fix check redis version

This commit is contained in:
xiaomlove
2022-07-18 22:53:56 +08:00
parent e5d996cb75
commit 2912c89202
3 changed files with 15 additions and 8 deletions
+9 -4
View File
@@ -3,8 +3,9 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use App\Events\TorrentUpdated; use App\Events\TorrentUpdated;
use App\Filament\Resources\System\AgentAllowResource;
use App\Http\Resources\TagResource; use App\Http\Resources\TagResource;
use App\Models\Ability; use App\Models\AgentAllow;
use App\Models\Attendance; use App\Models\Attendance;
use App\Models\Exam; use App\Models\Exam;
use App\Models\ExamProgress; use App\Models\ExamProgress;
@@ -12,7 +13,6 @@ use App\Models\ExamUser;
use App\Models\HitAndRun; use App\Models\HitAndRun;
use App\Models\Medal; use App\Models\Medal;
use App\Models\Peer; use App\Models\Peer;
use App\Models\Role;
use App\Models\SearchBox; use App\Models\SearchBox;
use App\Models\Snatch; use App\Models\Snatch;
use App\Models\Tag; use App\Models\Tag;
@@ -37,6 +37,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use JeroenG\Explorer\Domain\Syntax\Matching; use JeroenG\Explorer\Domain\Syntax\Matching;
use JeroenG\Explorer\Infrastructure\Scout\ElasticEngine; use JeroenG\Explorer\Infrastructure\Scout\ElasticEngine;
use League\Flysystem\StorageAttributes; use League\Flysystem\StorageAttributes;
@@ -46,7 +47,6 @@ use NexusPlugin\PostLike\PostLikeRepository;
use NexusPlugin\StickyPromotion\Models\StickyPromotion; use NexusPlugin\StickyPromotion\Models\StickyPromotion;
use NexusPlugin\StickyPromotion\Models\StickyPromotionParticipator; use NexusPlugin\StickyPromotion\Models\StickyPromotionParticipator;
use Rhilip\Bencode\Bencode; use Rhilip\Bencode\Bencode;
use Silber\Bouncer\Bouncer;
class Test extends Command class Test extends Command
{ {
@@ -81,7 +81,12 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
Ability::initDefaults(); $r = Str::of(class_basename(\App\Models\AgentAllow::class))
->plural()
->kebab()
->slug();
dd($r);
} }
+5 -2
View File
@@ -371,13 +371,16 @@ class NexusDB
} }
} }
/**
* @return mixed|\Redis|null
*/
public static function redis() public static function redis()
{ {
if (IN_NEXUS) { if (IN_NEXUS) {
global $Cache; global $Cache;
$Cache->getRedis(); return $Cache->getRedis();
} else { } else {
Redis::connection()->client(); return Redis::connection()->client();
} }
} }
+1 -2
View File
@@ -665,8 +665,7 @@ class Install
public function getRedisVersionInfo(): array public function getRedisVersionInfo(): array
{ {
global $Cache; $redis = NexusDB::redis();
$redis = $Cache->getRedis();
$result = $redis->info(); $result = $redis->info();
$version = $result['redis_version']; $version = $result['redis_version'];
$match = version_compare($version, '2.0.0', '>='); $match = version_compare($version, '2.0.0', '>=');