summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-03-04 17:20:14 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-03-04 17:20:14 +0100
commit70014d37dcf1cd693d8b8ce723afcfcc3d6d24aa (patch)
tree8d999f8143f81c3c253e009322d10066ff1ecbfb /apps/files_versions/lib
parentef70978524ad0f00c3e5f03a489753547afee45a (diff)
downloadnextcloud-server-70014d37dcf1cd693d8b8ce723afcfcc3d6d24aa.tar.gz
nextcloud-server-70014d37dcf1cd693d8b8ce723afcfcc3d6d24aa.zip
fix expire function
Diffstat (limited to 'apps/files_versions/lib')
-rw-r--r--apps/files_versions/lib/versions.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 178ef722735..c37133cf32c 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -442,12 +442,12 @@ class Storage {
}
}
- // check if enough space is available after versions are rearranged.
- // if not we delete the oldest versions until we meet the size limit for versions
- $numOfVersions = count($all_versions);
+ // Check if enough space is available after versions are rearranged.
+ // If not we delete the oldest versions until we meet the size limit for versions,
+ // but always keep the two latest versions
+ $numOfVersions = count($all_versions) -2 ;
$i = 0;
- while ($availableSpace < 0) {
- if ($i = $numOfVersions-2) break; // keep at least the last version
+ while ($availableSpace < 0 && $i < $numOfVersions) {
$versions_fileview->unlink($all_versions[$i]['path'].'.v'.$all_versions[$i]['version']);
$versionsSize -= $all_versions[$i]['size'];
$availableSpace += $all_versions[$i]['size'];