diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-01-11 14:23:28 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-01-11 14:23:28 +0100 |
commit | 67d00bc6bbcb2cbd39753c279f8449f593fa2f06 (patch) | |
tree | 776a6b9ce8406743e0edf1b4e03f6a7946db11b7 /apps/files_versions/lib/hooks.php | |
parent | 6be9c0a97462272674cd6892aee00df752fc99b8 (diff) | |
download | nextcloud-server-67d00bc6bbcb2cbd39753c279f8449f593fa2f06.tar.gz nextcloud-server-67d00bc6bbcb2cbd39753c279f8449f593fa2f06.zip |
some more clean-up, isVersioned() is no longer needed; rename hook fixed if a complete folder gets renamed
Diffstat (limited to 'apps/files_versions/lib/hooks.php')
-rw-r--r-- | apps/files_versions/lib/hooks.php | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php index 736d9cd8687..5fb9dc3c3c5 100644 --- a/apps/files_versions/lib/hooks.php +++ b/apps/files_versions/lib/hooks.php @@ -58,18 +58,16 @@ class Hooks { * of the stored versions along the actual file */ public static function rename_hook($params) { - $versions_fileview = \OCP\Files::getStorage('files_versions'); - $rel_oldpath = $params['oldpath']; - $abs_oldpath = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('').$rel_oldpath.'.v'; - $abs_newpath = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('').$params['newpath'].'.v'; - if(Storage::isversioned($rel_oldpath)) { - $info=pathinfo($abs_newpath); - if(!file_exists($info['dirname'])) mkdir($info['dirname'], 0750, true); - $versions = Storage::getVersions($rel_oldpath); - foreach ($versions as $v) { - rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']); - } + if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+
+ $versions = new Storage( new \OC_FilesystemView('') );
+
+ $oldpath = $params['oldpath']; + $newpath = $params['newpath'];
+
+ if($oldpath<>'' && $newpath<>'') $versions->rename( $oldpath, $newpath );
+
} } - + } |