aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-10-09 15:23:10 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-10-12 22:17:06 +0200
commit6ce05bc7d78306bbe06ab2ee47c4e0e0ae0e354c (patch)
treed49203d4dd929e5dcc2eadf676da16d48f4f19cf /apps/files_versions/lib
parent02fa3253fe82673e14b03e78b4e30a61d8982c19 (diff)
downloadnextcloud-server-6ce05bc7d78306bbe06ab2ee47c4e0e0ae0e354c.tar.gz
nextcloud-server-6ce05bc7d78306bbe06ab2ee47c4e0e0ae0e354c.zip
Return all keys in getAllVersions() instead
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_versions/lib')
-rw-r--r--apps/files_versions/lib/Storage.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index f9dbe449e0d..147edeb6726 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -496,7 +496,7 @@ class Storage {
$expiration = self::getExpiration();
$threshold = $expiration->getMaxAgeAsTimestamp();
$versions = self::getAllVersions($uid);
- if (!$threshold || !array_key_exists('all', $versions)) {
+ if (!$threshold || empty($versions['all'])) {
return;
}
@@ -578,7 +578,10 @@ class Storage {
// newest version first
krsort($versions);
- $result = [];
+ $result = [
+ 'all' => [],
+ 'by_file' => [],
+ ];
foreach ($versions as $key => $value) {
$size = $view->filesize(self::VERSIONS_ROOT.'/'.$value['path'].'.v'.$value['timestamp']);
@@ -775,8 +778,8 @@ class Storage {
// if still not enough free space we rearrange the versions from all files
if ($availableSpace <= 0) {
- $result = Storage::getAllVersions($uid);
- $allVersions = $result['all'] ?? [];
+ $result = self::getAllVersions($uid);
+ $allVersions = $result['all'];
foreach ($result['by_file'] as $versions) {
list($toDeleteNew, $size) = self::getExpireList($time, $versions, $availableSpace <= 0);