[Pkg-owncloud-commits] [owncloud] 28/42: fix array ordering issue

David Prévot taffit at moszumanska.debian.org
Wed Jan 22 21:21:49 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit cdfc6ff5d5774a1f31263b6e4a85361d885b5d1a
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Wed Jan 22 11:25:19 2014 +0100

    fix array ordering issue
---
 apps/files_versions/ajax/getVersions.php | 3 ++-
 apps/files_versions/lib/versions.php     | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php
index df29f40..4cc1c42 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 01c2e1c..130b714 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'];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list