summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-01-22 11:13:15 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-01-22 11:13:15 +0100
commita567f74d868df0ad70be18265876169e296ce0d9 (patch)
treef4a85c9777dc1fcae464d97f12278441450bcb9d /apps/files_versions
parent8d36ddcf0397facb43ae871ef0fba564e50c92bf (diff)
downloadnextcloud-server-a567f74d868df0ad70be18265876169e296ce0d9.tar.gz
nextcloud-server-a567f74d868df0ad70be18265876169e296ce0d9.zip
fix array order
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/versions.php7
-rw-r--r--apps/files_versions/tests/versions.php2
2 files changed, 4 insertions, 5 deletions
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 3dd0c5985e6..328ed4305f4 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -264,7 +264,7 @@ class Storage {
* @param string $uid user id from the owner of the file
* @param string $filename file to find versions of, relative to the user files dir
* @param string $userFullPath
- * @returns array
+ * @returns array versions newest version first
*/
public static function getVersions($uid, $filename, $userFullPath = '') {
$versions = array();
@@ -397,7 +397,8 @@ class Storage {
}
}
- ksort($versions);
+ // newest version first
+ krsort($versions);
$result = array();
@@ -428,8 +429,6 @@ class Storage {
$size = 0;
$toDelete = array(); // versions we want to delete
- $versions = array_reverse($versions); // newest version first
-
$interval = 1;
$step = Storage::$max_versions_per_interval[$interval]['step'];
if (Storage::$max_versions_per_interval[$interval]['intervalEndsAfter'] == -1) {
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index 713f7796c9b..25490aa1a04 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -40,7 +40,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
$startTime = 5000000;
$testClass = new VersionStorageToTest();
- list($deleted, $size) = $testClass->callProtectedGetExpireList($startTime, array_reverse($versions));
+ list($deleted, $size) = $testClass->callProtectedGetExpireList($startTime, $versions);
// we should have deleted 16 files each of the size 1
$this->assertEquals($sizeOfAllDeletedFiles, $size);