diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-10-23 23:47:06 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-10-23 23:47:06 +0200 |
commit | 5987099d2a7801d89310dc9e829927a67c1af9d2 (patch) | |
tree | 991b9a1b576d6a0f601dd48dac64c470c6dee4cc /apps/files_versions | |
parent | db1096bcfdf2336ccf6aefb70dd902a63ed615db (diff) | |
download | nextcloud-server-5987099d2a7801d89310dc9e829927a67c1af9d2.tar.gz nextcloud-server-5987099d2a7801d89310dc9e829927a67c1af9d2.zip |
Remove unneeded check if app is enabled
App code will not be executable if the app is not enabled, because the autoloader refuses to load that class.
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/Hooks.php | 72 |
1 files changed, 28 insertions, 44 deletions
diff --git a/apps/files_versions/lib/Hooks.php b/apps/files_versions/lib/Hooks.php index a9ebb153eff..1fdf1afef90 100644 --- a/apps/files_versions/lib/Hooks.php +++ b/apps/files_versions/lib/Hooks.php @@ -54,12 +54,9 @@ class Hooks { * listen to write event. */ public static function write_hook( $params ) { - - if (\OCP\App::isEnabled('files_versions')) { - $path = $params[\OC\Files\Filesystem::signal_param_path]; - if($path !== '') { - Storage::store($path); - } + $path = $params[\OC\Files\Filesystem::signal_param_path]; + if($path !== '') { + Storage::store($path); } } @@ -72,12 +69,9 @@ class Hooks { * cleanup the versions directory if the actual file gets deleted */ public static function remove_hook($params) { - - if (\OCP\App::isEnabled('files_versions')) { - $path = $params[\OC\Files\Filesystem::signal_param_path]; - if($path !== '') { - Storage::delete($path); - } + $path = $params[\OC\Files\Filesystem::signal_param_path]; + if($path !== '') { + Storage::delete($path); } } @@ -100,13 +94,10 @@ class Hooks { * of the stored versions along the actual file */ public static function rename_hook($params) { - - if (\OCP\App::isEnabled('files_versions')) { - $oldpath = $params['oldpath']; - $newpath = $params['newpath']; - if($oldpath !== '' && $newpath !== '') { - Storage::renameOrCopy($oldpath, $newpath, 'rename'); - } + $oldpath = $params['oldpath']; + $newpath = $params['newpath']; + if($oldpath !== '' && $newpath !== '') { + Storage::renameOrCopy($oldpath, $newpath, 'rename'); } } @@ -118,13 +109,10 @@ class Hooks { * 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'); - } + $oldpath = $params['oldpath']; + $newpath = $params['newpath']; + if($oldpath !== '' && $newpath !== '') { + Storage::renameOrCopy($oldpath, $newpath, 'copy'); } } @@ -137,25 +125,21 @@ 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']); - } else { - Storage::setSourcePathAndUser($params['oldpath']); - } + // 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']); + } else { + Storage::setSourcePathAndUser($params['oldpath']); } } |