$expiration = self::getExpiration();
$threshold = $expiration->getMaxAgeAsTimestamp();
$versions = self::getAllVersions($uid);
- if (!$threshold || !array_key_exists('all', $versions)) {
+ if (!$threshold || empty($versions['all'])) {
return;
}
// 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']);
// 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);