diff options
author | Julien Veyssier <julien-nc@posteo.net> | 2023-01-26 13:21:04 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2023-01-27 11:10:56 +0100 |
commit | 0e6d5f824002164835db12e44639a53dc773b0ab (patch) | |
tree | 7bed986d984f597c01184e4b30d1aa3ff5862a68 /lib/private/Collaboration | |
parent | b22d4e630650c2316d96f16b331a3e02c32da3d9 (diff) | |
download | nextcloud-server-0e6d5f824002164835db12e44639a53dc773b0ab.tar.gz nextcloud-server-0e6d5f824002164835db12e44639a53dc773b0ab.zip |
improve getUserProviderTimestamps
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'lib/private/Collaboration')
-rw-r--r-- | lib/private/Collaboration/Reference/ReferenceManager.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/private/Collaboration/Reference/ReferenceManager.php b/lib/private/Collaboration/Reference/ReferenceManager.php index 52f09d3a879..2897410f5d6 100644 --- a/lib/private/Collaboration/Reference/ReferenceManager.php +++ b/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; } |