diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-03-14 16:47:59 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-03-14 16:47:59 +0100 |
commit | 0cf50d63bfcbe359d850a7ce0228555a3766b31a (patch) | |
tree | 6fbb8c7182e27a798a6054127b79f8fd005f9742 /apps/files_versions | |
parent | abe408e934d1620a500d9be365e265c9fd635b27 (diff) | |
download | nextcloud-server-0cf50d63bfcbe359d850a7ce0228555a3766b31a.tar.gz nextcloud-server-0cf50d63bfcbe359d850a7ce0228555a3766b31a.zip |
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..8874fec6bd2 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($newpath); + } + $abs_newpath = $versions_view->getLocalFile($newpath); if ( $files_view->is_dir($oldpath) && $versions_view->is_dir($oldpath) ) { |