diff options
author | Frank Karlitschek <frank@owncloud.org> | 2013-03-15 01:18:20 -0700 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2013-03-15 01:18:20 -0700 |
commit | 92a867635014b44b9cc0c05b77f03cea02c284c2 (patch) | |
tree | da4caa3110ebc6944d8efc3d720a18e2c33e024b /apps/files_versions | |
parent | 0c123ebf9d56d8b6088f82fe25e1571684e27897 (diff) | |
parent | f78594c0aeeb29bfc4365f48dbb967b645fd5c61 (diff) | |
download | nextcloud-server-92a867635014b44b9cc0c05b77f03cea02c284c2.tar.gz nextcloud-server-92a867635014b44b9cc0c05b77f03cea02c284c2.zip |
Merge pull request #2317 from owncloud/create_version_on_upload
create new version if the same file is uploaded again over the web interface
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/versions.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 20611c61ec7..f99e26a0915 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -156,11 +156,18 @@ class Storage { /** * rename versions of a file */ - public static function rename($oldpath, $newpath) { - list($uid, $oldpath) = self::getUidAndFilename($oldpath); - list($uidn, $newpath) = self::getUidAndFilename($newpath); + public static function rename($old_path, $new_path) { + list($uid, $oldpath) = self::getUidAndFilename($old_path); + list($uidn, $newpath) = self::getUidAndFilename($new_path); $versions_view = new \OC\Files\View('/'.$uid .'/files_versions'); $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); if ( $files_view->is_dir($oldpath) && $versions_view->is_dir($oldpath) ) { |