diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-01-22 15:21:50 +0400 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-01-22 15:21:50 +0400 |
commit | d41b2c540125e2077f452f82e39c2494c23d272c (patch) | |
tree | ba9f806234212719b59992687fa5474340202f42 /apps/files_versions | |
parent | 5f7bc2cf4d4186b0a4f9f458dd542f3a746512df (diff) | |
parent | fea0ba84c56e468a57ab9412237b47886da2bfe3 (diff) |
Merge pull request #6891 from owncloud/version_fix_array_order_stable6v6.0.1
Version fix array order stable6
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/ajax/getVersions.php | 3 | ||||
-rw-r--r-- | apps/files_versions/lib/versions.php | 8 |
2 files changed, 6 insertions, 5 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 c2435b9cd65..52bc133e2c2 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,12 +397,13 @@ class Storage { } } - ksort($versions); + // newest first + krsort($versions); $result = array(); foreach ($versions as $key => $value) { - $size = $view->filesize($value['path']); + $size = $view->filesize(self::VERSIONS_ROOT.'/'.$value['path'].'.v'.$value['timestamp']); $filename = $value['path']; $result['all'][$key]['version'] = $value['timestamp']; @@ -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']; |