mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:44:04 +00:00
Fix Redis scan for 5.8 (#46)
* Fix Redis scan for 5.8 * Add comments [ci skip]
This commit is contained in:
parent
beb9a0a903
commit
35abb6191d
2 changed files with 10 additions and 3 deletions
|
|
@ -71,9 +71,16 @@ class RedisStorageDriver implements StorageDriver
|
|||
return "tenants:{$hash}";
|
||||
}, $uuids);
|
||||
|
||||
$hashes = $hashes ?: $this->redis->scan(null, 'tenants:*');
|
||||
// Apparently, the PREFIX is applied to all functions except scan()
|
||||
$redis_prefix = $this->redis->getOption($this->redis->client()::OPT_PREFIX);
|
||||
$hashes = $hashes ?: $this->redis->scan(null, $redis_prefix.'tenants:*');
|
||||
|
||||
return array_map(function ($tenant) use ($redis_prefix) {
|
||||
// Left strip $redis_prefix from $tenant
|
||||
if (substr($tenant, 0, strlen($redis_prefix)) == $redis_prefix) {
|
||||
$tenant = substr($tenant, strlen($redis_prefix));
|
||||
}
|
||||
|
||||
return array_map(function ($tenant) {
|
||||
return $this->redis->hgetall($tenant);
|
||||
}, $hashes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class TenantManager
|
|||
*/
|
||||
public function all($uuids = [])
|
||||
{
|
||||
$uuid = (array) $uuids;
|
||||
$uuids = (array) $uuids;
|
||||
|
||||
return collect(array_map(function ($tenant_array) {
|
||||
return $this->jsonDecodeArrayValues($tenant_array);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue