make sure that we always delete oldest first

This commit is contained in:
Bjoern Schiessle 2014-10-09 19:15:58 +02:00
parent 9dea79e341
commit 8e077cf1a4
1 changed files with 3 additions and 0 deletions

View File

@ -517,6 +517,9 @@ class Storage {
// but always keep the two latest versions // but always keep the two latest versions
$numOfVersions = count($allVersions) -2 ; $numOfVersions = count($allVersions) -2 ;
$i = 0; $i = 0;
// sort oldest first and make sure that we start at the first element
ksort($allVersions);
reset($allVersions);
while ($availableSpace < 0 && $i < $numOfVersions) { while ($availableSpace < 0 && $i < $numOfVersions) {
$version = current($allVersions); $version = current($allVersions);
\OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'])); \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version']));