@@ -360,7 +360,7 @@ public function getAllKeys(): array {
360360 $ filter = Http::get ('s ' , '* ' );
361361 $ this ->template ->addGlobal ('search_value ' , $ filter );
362362
363- if (isset ($ this ->servers [$ this ->current_server ]['scansize ' ]) || !$ this ->redis -> isCommandSupported ('KEYS ' )) {
363+ if (isset ($ this ->servers [$ this ->current_server ]['scansize ' ]) || !$ this ->isCommandSupported ('KEYS ' )) {
364364 $ scansize = (int ) ($ this ->servers [$ this ->current_server ]['scansize ' ] ?? 1000 );
365365 $ keys_array = $ this ->redis ->scanKeys ($ filter , $ scansize );
366366 } else {
@@ -376,6 +376,17 @@ public function getAllKeys(): array {
376376 return $ this ->keysTableView ($ keys );
377377 }
378378
379+ public function isCommandSupported (string $ command ): bool {
380+ try {
381+ $ commands = $ this ->redis ->getCommands ();
382+ $ is_supported = in_array (strtolower ($ command ), $ commands , true );
383+ } catch (Exception ) {
384+ $ is_supported = false ;
385+ }
386+
387+ return $ is_supported ;
388+ }
389+
379390 /**
380391 * @param array<int|string, mixed> $keys
381392 *
@@ -513,6 +524,11 @@ private function dbSelect(): string {
513524 * @throws Exception
514525 */
515526 private function slowlog (): string {
527+ if (!$ this ->isCommandSupported ('SLOWLOG ' )) {
528+ return $ this ->template ->render ('components/tabs ' , ['links ' => ['keys ' => 'Keys ' , 'slowlog ' => 'Slow Log ' ,],]).
529+ 'Slowlog is disabled on your server. ' ;
530+ }
531+
516532 if (isset ($ _GET ['resetlog ' ])) {
517533 $ this ->redis ->resetSlowlog ();
518534 Http::redirect (['tab ' ]);
0 commit comments