diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-10-31 16:42:54 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-10-31 16:42:54 +0100 |
commit | ebe1d3df0a51f3517ea14ea4d3ba9c770f4f85c1 (patch) | |
tree | 0e5955293b2bd3dba807034c35a0d988abd58e4e /apps/files_versions/lib/hooks.php | |
parent | 206cb5ba632baa70a0317f5412c306708e4788d1 (diff) | |
download | nextcloud-server-ebe1d3df0a51f3517ea14ea4d3ba9c770f4f85c1.tar.gz nextcloud-server-ebe1d3df0a51f3517ea14ea4d3ba9c770f4f85c1.zip |
don't move versions if only the mount point was renamed
Diffstat (limited to 'apps/files_versions/lib/hooks.php')
-rw-r--r-- | apps/files_versions/lib/hooks.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php index 024cb6a3c39..53980463120 100644 --- a/apps/files_versions/lib/hooks.php +++ b/apps/files_versions/lib/hooks.php @@ -115,6 +115,16 @@ class Hooks { public static function pre_renameOrCopy_hook($params) { if (\OCP\App::isEnabled('files_versions')) { + // if we rename a movable mount point, then the versions don't have + // to be renamed + $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']); + $manager = \OC\Files\Filesystem::getMountManager(); + $mount = $manager->find($absOldPath); + $internalPath = $mount->getInternalPath($absOldPath); + if ($internalPath === '' and $mount instanceof \OC\Files\Mount\MoveableMount) { + return; + } + $view = new \OC\Files\View(\OCP\User::getUser() . '/files'); if ($view->file_exists($params['newpath'])) { Storage::store($params['newpath']); |