Return all keys in getAllVersions() instead
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
92ac576e1c
commit
264250937e
|
@ -496,7 +496,7 @@ class Storage {
|
||||||
$expiration = self::getExpiration();
|
$expiration = self::getExpiration();
|
||||||
$threshold = $expiration->getMaxAgeAsTimestamp();
|
$threshold = $expiration->getMaxAgeAsTimestamp();
|
||||||
$versions = self::getAllVersions($uid);
|
$versions = self::getAllVersions($uid);
|
||||||
if (!$threshold || !array_key_exists('all', $versions)) {
|
if (!$threshold || empty($versions['all'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +578,10 @@ class Storage {
|
||||||
// newest version first
|
// newest version first
|
||||||
krsort($versions);
|
krsort($versions);
|
||||||
|
|
||||||
$result = [];
|
$result = [
|
||||||
|
'all' => [],
|
||||||
|
'by_file' => [],
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($versions as $key => $value) {
|
foreach ($versions as $key => $value) {
|
||||||
$size = $view->filesize(self::VERSIONS_ROOT.'/'.$value['path'].'.v'.$value['timestamp']);
|
$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 still not enough free space we rearrange the versions from all files
|
||||||
if ($availableSpace <= 0) {
|
if ($availableSpace <= 0) {
|
||||||
$result = Storage::getAllVersions($uid);
|
$result = self::getAllVersions($uid);
|
||||||
$allVersions = $result['all'] ?? [];
|
$allVersions = $result['all'];
|
||||||
|
|
||||||
foreach ($result['by_file'] as $versions) {
|
foreach ($result['by_file'] as $versions) {
|
||||||
list($toDeleteNew, $size) = self::getExpireList($time, $versions, $availableSpace <= 0);
|
list($toDeleteNew, $size) = self::getExpireList($time, $versions, $availableSpace <= 0);
|
||||||
|
|
Loading…
Reference in New Issue