Skip to content
Snippets Groups Projects
Commit 92a86763 authored by Frank Karlitschek's avatar Frank Karlitschek
Browse files

Merge pull request #2317 from owncloud/create_version_on_upload

create new version if the same file is uploaded again over the web interface
parents 0c123ebf f78594c0
Branches
No related tags found
No related merge requests found
...@@ -156,11 +156,18 @@ class Storage { ...@@ -156,11 +156,18 @@ class Storage {
/** /**
* rename versions of a file * rename versions of a file
*/ */
public static function rename($oldpath, $newpath) { public static function rename($old_path, $new_path) {
list($uid, $oldpath) = self::getUidAndFilename($oldpath); list($uid, $oldpath) = self::getUidAndFilename($old_path);
list($uidn, $newpath) = self::getUidAndFilename($newpath); list($uidn, $newpath) = self::getUidAndFilename($new_path);
$versions_view = new \OC\Files\View('/'.$uid .'/files_versions'); $versions_view = new \OC\Files\View('/'.$uid .'/files_versions');
$files_view = new \OC\Files\View('/'.$uid .'/files'); $files_view = new \OC\Files\View('/'.$uid .'/files');
// if the file already exists than it was a upload of a existing file
// over the web interface -> store() is the right function we need here
if ($files_view->file_exists($newpath)) {
return self::store($new_path);
}
$abs_newpath = $versions_view->getLocalFile($newpath); $abs_newpath = $versions_view->getLocalFile($newpath);
if ( $files_view->is_dir($oldpath) && $versions_view->is_dir($oldpath) ) { if ( $files_view->is_dir($oldpath) && $versions_view->is_dir($oldpath) ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment