aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-10 20:06:42 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-10 20:06:42 +0200
commit87cccb2e32a7e09f9df95b41909964bad5b4acb7 (patch)
treeaa64015b5138ab1b38e021858fc33111331f928c /apps/files_versions
parent92009c5d8eb48d8ea89ab6ee803d8a47a7ff98c0 (diff)
downloadnextcloud-server-87cccb2e32a7e09f9df95b41909964bad5b4acb7.tar.gz
nextcloud-server-87cccb2e32a7e09f9df95b41909964bad5b4acb7.zip
some small changes/fixes
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/versions.php17
1 files changed, 8 insertions, 9 deletions
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) {