1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-03-15 19:59:41 +01:00

Update filter for Redis

Make filter work with multiple keys and wildcard search, eg. user/* or ip 10.0.*
This commit is contained in:
Barry vd. Heuvel 2014-01-14 09:54:06 +01:00
parent 1663f3808b
commit 8d00a2ac74

View File

@ -55,7 +55,7 @@ class RedisStorage implements StorageInterface
foreach ($this->redis->hgetall($this->hash) as $id => $data) {
if ($data = unserialize($data)) {
$meta = $data['__meta'];
if (array_keys(array_intersect($meta, $filters)) == array_keys($filters)) {
if ($this->filter($meta, $filters)) {
$results[] = $meta;
}
}
@ -63,6 +63,15 @@ class RedisStorage implements StorageInterface
return array_slice($results, $offset, $max);
}
protected function filter($meta, $filters){
foreach($filters as $key => $value){
if(fnmatch ($value, $meta[$key]) === false){
return false;
}
}
return true;
}
/**
* {@inheritDoc}
*/