Browse Source
improve getUserProviderTimestamps
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
pull/35557/head
Julien Veyssier
4 years ago
committed by
Julius Härtl
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with
4 additions and
3 deletions
-
lib/private/Collaboration/Reference/ReferenceManager.php
|
|
|
@ -269,12 +269,13 @@ class ReferenceManager implements IReferenceManager { |
|
|
|
} |
|
|
|
$userId = $user->getUID(); |
|
|
|
$keys = $this->config->getUserKeys($userId, 'references'); |
|
|
|
$keys = array_filter($keys, static function (string $key) { |
|
|
|
return preg_match('/^provider-last-use_/', $key) !== false; |
|
|
|
$prefix = 'provider-last-use_'; |
|
|
|
$keys = array_filter($keys, static function (string $key) use ($prefix) { |
|
|
|
return str_starts_with($key, $prefix); |
|
|
|
}); |
|
|
|
$timestamps = []; |
|
|
|
foreach ($keys as $key) { |
|
|
|
$providerId = preg_replace('/^provider-last-use_/', '', $key); |
|
|
|
$providerId = substr($key, strlen($prefix)); |
|
|
|
$timestamp = (int) $this->config->getUserValue($userId, 'references', $key); |
|
|
|
$timestamps[$providerId] = $timestamp; |
|
|
|
} |
|
|
|
|