From: Bjoern Schiessle Date: Thu, 10 Oct 2013 18:06:42 +0000 (+0200) Subject: some small changes/fixes X-Git-Tag: v6.0.0alpha2~29^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=87cccb2e32a7e09f9df95b41909964bad5b4acb7;p=nextcloud-server.git some small changes/fixes --- diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 8151324696f..48c25831ebb 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -242,14 +242,16 @@ class Storage { $versions = array(); // fetch for old versions $view = new \OC\Files\View('/' . $uid . '/files_versions/'); - $files = $view->getDirectoryContent(dirname($filename)); - $versionedFile = pathinfo($filename, PATHINFO_BASENAME); + $pathinfo = pathinfo($filename); + + $files = $view->getDirectoryContent($pathinfo['dirname']); + + $versionedFile = $pathinfo['basename']; foreach ($files as $file) { if ($file['type'] === 'file') { $pos = strrpos($file['path'], '.v'); - $length = $pos - strlen('files_versions/'.dirname($filename)); $currentFile = substr($file['name'], 0, strrpos($file['name'], '.v')); if ($currentFile === $versionedFile) { $version = substr($file['path'], $pos + 2); @@ -264,11 +266,10 @@ class Storage { } } - // sort with oldest version first - ksort($versions); + // sort with newest version first + krsort($versions); - // return newest versions first - return array_reverse($versions); + return $versions; } /** @@ -367,8 +368,6 @@ class Storage { ksort($versions); - $i = 0; - $result = array(); foreach ($versions as $key => $value) {