some small changes/fixes
This commit is contained in:
parent
92009c5d8e
commit
87cccb2e32
|
@ -242,14 +242,16 @@ class Storage {
|
||||||
$versions = array();
|
$versions = array();
|
||||||
// fetch for old versions
|
// fetch for old versions
|
||||||
$view = new \OC\Files\View('/' . $uid . '/files_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) {
|
foreach ($files as $file) {
|
||||||
if ($file['type'] === 'file') {
|
if ($file['type'] === 'file') {
|
||||||
$pos = strrpos($file['path'], '.v');
|
$pos = strrpos($file['path'], '.v');
|
||||||
$length = $pos - strlen('files_versions/'.dirname($filename));
|
|
||||||
$currentFile = substr($file['name'], 0, strrpos($file['name'], '.v'));
|
$currentFile = substr($file['name'], 0, strrpos($file['name'], '.v'));
|
||||||
if ($currentFile === $versionedFile) {
|
if ($currentFile === $versionedFile) {
|
||||||
$version = substr($file['path'], $pos + 2);
|
$version = substr($file['path'], $pos + 2);
|
||||||
|
@ -264,11 +266,10 @@ class Storage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort with oldest version first
|
// sort with newest version first
|
||||||
ksort($versions);
|
krsort($versions);
|
||||||
|
|
||||||
// return newest versions first
|
return $versions;
|
||||||
return array_reverse($versions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,8 +368,6 @@ class Storage {
|
||||||
|
|
||||||
ksort($versions);
|
ksort($versions);
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
foreach ($versions as $key => $value) {
|
foreach ($versions as $key => $value) {
|
||||||
|
|
Loading…
Reference in New Issue