Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-01-22 14:25:19 +0400
committerBjoern Schiessle <schiessle@owncloud.com>2014-01-22 14:25:19 +0400
commitcdfc6ff5d5774a1f31263b6e4a85361d885b5d1a (patch)
treecdff328f21d7de1b19c0333dc507ade0304978f9 /apps/files_versions
parent14cbec6d6b4952ac9a2caecf3fa3cb81259b7c25 (diff)
fix array ordering issue
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/ajax/getVersions.php3
-rw-r--r--apps/files_versions/lib/versions.php6
2 files changed, 5 insertions, 4 deletions
diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php
index df29f401629..4cc1c428898 100644
--- a/apps/files_versions/ajax/getVersions.php
+++ b/apps/files_versions/ajax/getVersions.php
@@ -5,7 +5,8 @@ $source = $_GET['source'];
$start = $_GET['start'];
list ($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source);
$count = 5; //show the newest revisions
-if( ($versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $source)) ) {
+$versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $source);
+if( $versions ) {
$endReached = false;
if (count($versions) <= $start+$count) {
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 01c2e1ccdee..130b714a995 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 first
*/
public static function getVersions($uid, $filename, $userFullPath = '') {
$versions = array();
@@ -397,7 +397,8 @@ class Storage {
}
}
- ksort($versions);
+ // newest first
+ krsort($versions);
$result = array();
@@ -524,7 +525,6 @@ class Storage {
// delete old versions for every given file
foreach ($versionsByFile as $versions) {
- $versions = array_reverse($versions); // newest version first
$interval = 1;
$step = Storage::$max_versions_per_interval[$interval]['step'];