diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-24 15:30:00 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-30 15:14:01 +0200 |
commit | c738f7165762065316bb7594cacb1e628f6e72bc (patch) | |
tree | 2a785a98fd802404b962ff42952628455c5ca07c /apps/files_versions/lib/hooks.php | |
parent | 38e309b0fe5f18c22a6f1b175ff24345e78f1548 (diff) | |
download | nextcloud-server-c738f7165762065316bb7594cacb1e628f6e72bc.tar.gz nextcloud-server-c738f7165762065316bb7594cacb1e628f6e72bc.zip |
make the versions and encryption app aware of the copy operation
Diffstat (limited to 'apps/files_versions/lib/hooks.php')
-rw-r--r-- | apps/files_versions/lib/hooks.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php index 990f1403e8d..17eacc6a6ed 100644 --- a/apps/files_versions/lib/hooks.php +++ b/apps/files_versions/lib/hooks.php @@ -69,7 +69,25 @@ class Hooks { $oldpath = $params['oldpath']; $newpath = $params['newpath']; if($oldpath<>'' && $newpath<>'') { - Storage::rename( $oldpath, $newpath ); + Storage::renameOrCopy($oldpath, $newpath, 'rename'); + } + } + } + + /** + * copy versions of copied files + * @param array $params array with oldpath and newpath + * + * This function is connected to the copy signal of OC_Filesystem and copies the + * the stored versions to the new location + */ + public static function copy_hook($params) { + + if (\OCP\App::isEnabled('files_versions')) { + $oldpath = $params['oldpath']; + $newpath = $params['newpath']; + if($oldpath<>'' && $newpath<>'') { + Storage::renameOrCopy($oldpath, $newpath, 'copy'); } } } |