summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-10-09 19:15:58 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-10-09 19:15:58 +0200
commit8e077cf1a4f1ff52aaaaaf359d6c85778fa51702 (patch)
tree203c84493e1a33cc17947c49bb0ba80161d3881f /apps/files_versions
parent9dea79e341fcc28e6a4e1d8e88f6a7f6ec1bf3fb (diff)
downloadnextcloud-server-8e077cf1a4f1ff52aaaaaf359d6c85778fa51702.tar.gz
nextcloud-server-8e077cf1a4f1ff52aaaaaf359d6c85778fa51702.zip
make sure that we always delete oldest first
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/versions.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 7fadf81426b..bdb26896948 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -517,6 +517,9 @@ class Storage {
// but always keep the two latest versions
$numOfVersions = count($allVersions) -2 ;
$i = 0;
+ // sort oldest first and make sure that we start at the first element
+ ksort($allVersions);
+ reset($allVersions);
while ($availableSpace < 0 && $i < $numOfVersions) {
$version = current($allVersions);
\OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version']));