Repository: erikdubbelboer/phpRedisAdmin (language: php)

Issue:
dependence predis is deprecated
Hi, I wondered why you don’t have streams (5.0) support. I cloned the repo and thought to add it myself, but found that some methods do not work, for example
```
case 'stream':
	      echo $fullkey;
              $len = $redis->xLen($fullkey);
              break;
```

> Fatal error: Uncaught Predis\ClientException: Command 'XLEN' is not a registered Redis command.

I see composer dependence "predis/predis": "1.1.x-dev" (2017-07-12) and https://github.com/phpredis/phpredis (newer).  They abandoned the composer. Now it is distributed as a compiled library. Please replace the composer dependency in the project with the compiled one so that you can develop the project further, working with the latest redis.


Discussion / hints:
To be honest I don't think the users would like me switching to a compiled dependency. Right now it's super easy to setup phpRedisAdmin. With a compiled dependency it gets a lot more difficult and I'm afraid a lot of users won't be able to do this (because they don't know how or because they don't have access to install C libs).

Have you tried using this? https://github.com/nrk/predis#adding-new-commands
Thanks for the answer. I did not try these crutches. I agree with you that beginners will have difficulty installing a binary library. Of course, you can go the way that you said, but constantly adding something there is also not an ideal option. You better focus on the user-friendliness of your shell and its technical information content. For example, to debug huge databases in real time, a compiled library will do better.
> Have you tried using this? https://github.com/nrk/predis#adding-new-commands

In general, I will try this as a temporary solution. But you'd better think about changing the library.

I'v get an error , my redis version was 2.2.4, trying update the redis use a new version

Fatal error: Uncaught Predis\Response\ServerException: ERR unknown command 'SCAN' in phpRedisAdmin/vendor/src/Client.php:370 Stack trace: #0

> I'v get an error , my redis version was 2.2.4, trying update the redis use a new version
> 
> Fatal error: Uncaught Predis\Response\ServerException: ERR unknown command 'SCAN' in phpRedisAdmin/vendor/src/Client.php:370 Stack trace: #0

USE NEW VERSION , problem resolved
Hi,

On my side, I followed the readme (git clone + git clone in vendor) and copied the config to config.inc.php (without any custom conf) to test and I have this issue:
PHP Fatal error:  Uncaught Predis\Response\ServerException: NOAUTH Authentication required. in /var/www/html/phpredisadmin/vendor/src/Client.php:354

Best regards,
@anthosz its saying Redis requires a password, you have to configure it like this: https://github.com/erikdubbelboer/phpRedisAdmin/blob/1ee43ae7c2ad415cc99086575d66dfd9df6831fb/includes/config.sample.inc.php#L16
> 
> 
> @anthosz its saying Redis requires a password, you have to configure it like this:
> 
> https://github.com/erikdubbelboer/phpRedisAdmin/blob/1ee43ae7c2ad415cc99086575d66dfd9df6831fb/includes/config.sample.inc.php#L16

Ok thx! It cannot be requested via form by example?

I mean, add a new server in config -> select list available on the gui -> ask to submit auth (like user/pass on phpmyadmin by example)
No I'm afraid not. A pull request for this is always welcome.
There exists a new Predis package on Packagist. It would fix PHP 8.1 support as well.

Fix patch:
diff --git a/Dockerfile b/Dockerfile
index fd40ac1..16f313d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
-FROM composer:1.7
+FROM composer:2.2
 
-ENV TINI_VERSION 0.18.0-r0
+ENV TINI_VERSION 0.19.0-r0
 
 RUN apk add --no-cache tini=$TINI_VERSION
 
diff --git a/composer.json b/composer.json
index 823fd5f..544a765 100644
--- a/composer.json
+++ b/composer.json
@@ -13,9 +13,9 @@
         }
     ],
     "require": {
-        "predis/predis": "1.1.x-dev",
+        "predis/predis": "v1.1.9",
         "paragonie/random_compat": ">=2"
     },
     "minimum-stability": "stable",
-    "target-dir": "ErikDubbelboer/phpRedisAdmin"    
+    "target-dir": "ErikDubbelboer/phpRedisAdmin"
 }
diff --git a/composer.lock b/composer.lock
index 43a24c3..41f9438 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "719c08328f6db3021508e7ef84d95588",
+    "content-hash": "ad3fb9bfb043b086870b317dc9eff9b7",
     "packages": [
         {
             "name": "paragonie/random_compat",
@@ -49,20 +49,25 @@
                 "pseudorandom",
                 "random"
             ],
+            "support": {
+                "email": "info@paragonie.com",
+                "issues": "https://github.com/paragonie/random_compat/issues",
+                "source": "https://github.com/paragonie/random_compat"
+            },
             "time": "2020-10-15T08:29:30+00:00"
         },
         {
             "name": "predis/predis",
-            "version": "v1.1.x-dev",
+            "version": "v1.1.9",
             "source": {
                 "type": "git",
                 "url": "https://github.com/predis/predis.git",
-                "reference": "111d100ee389d624036b46b35ed0c9ac59c71313"
+                "reference": "c50c3393bb9f47fa012d0cdfb727a266b0818259"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/predis/predis/zipball/111d100ee389d624036b46b35ed0c9ac59c71313",
-                "reference": "111d100ee389d624036b46b35ed0c9ac59c71313",
+                "url": "https://api.github.com/repos/predis/predis/zipball/c50c3393bb9f47fa012d0cdfb727a266b0818259",
+                "reference": "c50c3393bb9f47fa012d0cdfb727a266b0818259",
                 "shasum": ""
             },
             "require": {
@@ -89,27 +94,42 @@
                 {
                     "name": "Daniele Alessandri",
                     "email": "suppakilla@gmail.com",
-                    "homepage": "http://clorophilla.net"
+                    "homepage": "http://clorophilla.net",
+                    "role": "Creator & Maintainer"
+                },
+                {
+                    "name": "Till Krüss",
+                    "homepage": "https://till.im",
+                    "role": "Maintainer"
                 }
             ],
             "description": "Flexible and feature-complete Redis client for PHP and HHVM",
-            "homepage": "http://github.com/nrk/predis",
+            "homepage": "http://github.com/predis/predis",
             "keywords": [
                 "nosql",
                 "predis",
                 "redis"
             ],
-            "time": "2017-07-12T14:39:17+00:00"
+            "support": {
+                "issues": "https://github.com/predis/predis/issues",
+                "source": "https://github.com/predis/predis/tree/v1.1.9"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/sponsors/tillkruss",
+                    "type": "github"
+                }
+            ],
+            "time": "2021-10-05T19:02:38+00:00"
         }
     ],
     "packages-dev": [],
     "aliases": [],
     "minimum-stability": "stable",
-    "stability-flags": {
-        "predis/predis": 20
-    },
+    "stability-flags": [],
     "prefer-stable": false,
     "prefer-lowest": false,
     "platform": [],
-    "platform-dev": []
+    "platform-dev": [],
+    "plugin-api-version": "2.1.0"
 }
diff --git a/css/frame.css b/css/frame.css
index e54ca9e..8969e10 100644
--- a/css/frame.css
+++ b/css/frame.css
@@ -14,7 +14,6 @@ margin-left: -8em;
 }
 
 form .button {
-margin-left: -7em;
 }
 
 
diff --git a/docker-compose.yml b/docker-compose.yml
index dab64b9..5ef83df 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,15 +1,16 @@
-phpredisadmin:
-  build: .
-  environment:
-    - ADMIN_USER=admin
-    - ADMIN_PASS=admin
-    - REDIS_1_HOST=redis
-    - REDIS_1_PORT=6379
-  links:
-    - redis
-  ports:
-    - "80:80"
+services:
+  phpredisadmin:
+    build: .
+    environment:
+      - ADMIN_USER=admin
+      - ADMIN_PASS=admin
+      - REDIS_1_HOST=redis
+      - REDIS_1_PORT=6379
+    links:
+      - redis
+    ports:
+      - "80:80"
 
-redis:
-  image: redis
-  command: --loglevel verbose
+  redis:
+    image: redis
+    command: --loglevel verbose
diff --git a/edit.php b/edit.php
index 9642171..0e0b360 100644
--- a/edit.php
+++ b/edit.php
@@ -185,9 +185,7 @@
 
 <input type="hidden" name="oldvalue" value="<?php echo format_html($value)?>">
 
-<p>
 <input type="submit" class="button" value="<?php echo $edit ? 'Edit' : 'Add'?>">
-</p>
 
 </form>
 <?php
diff --git a/export.php b/export.php
index 5d88b11..2812705 100644
--- a/export.php
+++ b/export.php
@@ -15,7 +15,7 @@ function export_redis($key, $filter = false, $transform = false) {
     $outputKey = str_replace($filter, $transform, $key);
   else
     $outputKey = $key;
-  
+
   // String
   if ($type == 'string') {
     echo 'SET "',addslashes($outputKey),'" "',addslashes($redis->get($key)),'"',PHP_EOL;
@@ -124,7 +124,7 @@ function export_json($key) {
 
   // JSON
   if ($_POST['type'] == 'json') {
-    
+
     // Single key
     if (isset($_GET['key'])) {
       echo json_encode(export_json($_GET['key']));
@@ -137,13 +137,13 @@ function export_json($key) {
         // if we have a filter and no match, nothing to do
         if($filter !== false && stripos($key, $filter) === false)
           continue;
-        
+
         // we rename the keys as necessary
         if($filter !== false && $transform !== false)
           $outputKey = str_replace($filter, $transform, $key);
         else
           $outputKey = $key;
-        
+
         $vals[$outputKey] = export_json($key);
       }
 
@@ -165,7 +165,7 @@ function export_json($key) {
         // if we have a filter and no match, we skip
         if($filter !== false && stripos($key, $filter) === false)
           continue;
-        
+
         export_redis($key, $filter, $transform);
       }
     }
@@ -195,7 +195,7 @@ function export_json($key) {
 <option value="redis" <?php echo (isset($_GET['type']) && ($_GET['type'] == 'redis')) ? 'selected="selected"' : ''?>>Redis</option>
 <option value="json"  <?php echo (isset($_GET['type']) && ($_GET['type'] == 'json' )) ? 'selected="selected"' : ''?>>JSON</option>
 </select>
-</p> 
+</p>
 
 <?php if (!isset($_GET['key'])): ?>
   <p>
@@ -209,9 +209,7 @@ function export_json($key) {
   </p>
 <?php endif; ?>
 
-<p>
 <input type="submit" class="button" value="Export">
-</p>
 
 </form>
 <?php
diff --git a/import.php b/import.php
index 590467e..e9176dc 100644
--- a/import.php
+++ b/import.php
@@ -111,9 +111,7 @@
 <textarea name="commands" id="commands" cols="80" rows="20"></textarea>
 </p>
 
-<p>
 <input type="submit" class="button" value="Import">
-</p>
 
 </form>
 <?php
diff --git a/rename.php b/rename.php
index 4dbddcd..5a878ba 100644
--- a/rename.php
+++ b/rename.php
@@ -45,9 +45,7 @@
 <input type="text" name="key" id="key" size="30" <?php echo isset($_GET['key']) ? 'value="'.format_html($_GET['key']).'"' : ''?>>
 </p>
 
-<p>
 <input type="submit" class="button" value="Rename">
-</p>
 
 </form>
 <?php
diff --git a/ttl.php b/ttl.php
index d6bdc07..1a50008 100644
--- a/ttl.php
+++ b/ttl.php
@@ -39,9 +39,7 @@
 <input type="text" name="ttl" id="ttl" size="30" <?php echo isset($_GET['ttl']) ? 'value="'.format_html($_GET['ttl']).'"' : ''?>> <span class="info">(-1 to remove the TTL)</span>
 </p>
 
-<p>
 <input type="submit" class="button" value="Edit TTL">
-</p>
 
 </form>
 <?php


Test patch: