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>
This commit is contained in:
Morris Jobke 2017-10-23 23:47:06 +02:00
parent db1096bcfd
commit 5987099d2a
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
3 changed files with 34 additions and 65 deletions

View File

@ -170,11 +170,6 @@ class UserHooks implements IHook {
* @return boolean|null * @return boolean|null
*/ */
public function login($params) { public function login($params) {
if (!App::isEnabled('encryption')) {
return true;
}
// ensure filesystem is loaded // ensure filesystem is loaded
if (!\OC\Files\Filesystem::$loaded) { if (!\OC\Files\Filesystem::$loaded) {
$this->setupFS($params['uid']); $this->setupFS($params['uid']);
@ -200,10 +195,7 @@ class UserHooks implements IHook {
* @param array $params * @param array $params
*/ */
public function postCreateUser($params) { public function postCreateUser($params) {
$this->userSetup->setupUser($params['uid'], $params['password']);
if (App::isEnabled('encryption')) {
$this->userSetup->setupUser($params['uid'], $params['password']);
}
} }
/** /**
@ -213,17 +205,12 @@ class UserHooks implements IHook {
* @note This method should never be called for users using client side encryption * @note This method should never be called for users using client side encryption
*/ */
public function postDeleteUser($params) { public function postDeleteUser($params) {
$this->keyManager->deletePublicKey($params['uid']);
if (App::isEnabled('encryption')) {
$this->keyManager->deletePublicKey($params['uid']);
}
} }
public function prePasswordReset($params) { public function prePasswordReset($params) {
if (App::isEnabled('encryption')) { $user = $params['uid'];
$user = $params['uid']; self::$passwordResetUsers[$user] = true;
self::$passwordResetUsers[$user] = true;
}
} }
public function postPasswordReset($params) { public function postPasswordReset($params) {

View File

@ -39,10 +39,8 @@ class Hooks {
* to remove the used space for the trash bin stored in the database * to remove the used space for the trash bin stored in the database
*/ */
public static function deleteUser_hook($params) { public static function deleteUser_hook($params) {
if( \OCP\App::isEnabled('files_trashbin') ) { $uid = $params['uid'];
$uid = $params['uid']; Trashbin::deleteUser($uid);
Trashbin::deleteUser($uid);
}
} }
public static function post_write_hook($params) { public static function post_write_hook($params) {

View File

@ -54,12 +54,9 @@ class Hooks {
* listen to write event. * listen to write event.
*/ */
public static function write_hook( $params ) { public static function write_hook( $params ) {
$path = $params[\OC\Files\Filesystem::signal_param_path];
if (\OCP\App::isEnabled('files_versions')) { if($path !== '') {
$path = $params[\OC\Files\Filesystem::signal_param_path]; Storage::store($path);
if($path !== '') {
Storage::store($path);
}
} }
} }
@ -72,12 +69,9 @@ class Hooks {
* cleanup the versions directory if the actual file gets deleted * cleanup the versions directory if the actual file gets deleted
*/ */
public static function remove_hook($params) { public static function remove_hook($params) {
$path = $params[\OC\Files\Filesystem::signal_param_path];
if (\OCP\App::isEnabled('files_versions')) { if($path !== '') {
$path = $params[\OC\Files\Filesystem::signal_param_path]; Storage::delete($path);
if($path !== '') {
Storage::delete($path);
}
} }
} }
@ -100,13 +94,10 @@ class Hooks {
* of the stored versions along the actual file * of the stored versions along the actual file
*/ */
public static function rename_hook($params) { public static function rename_hook($params) {
$oldpath = $params['oldpath'];
if (\OCP\App::isEnabled('files_versions')) { $newpath = $params['newpath'];
$oldpath = $params['oldpath']; if($oldpath !== '' && $newpath !== '') {
$newpath = $params['newpath']; Storage::renameOrCopy($oldpath, $newpath, 'rename');
if($oldpath !== '' && $newpath !== '') {
Storage::renameOrCopy($oldpath, $newpath, 'rename');
}
} }
} }
@ -118,13 +109,10 @@ class Hooks {
* the stored versions to the new location * the stored versions to the new location
*/ */
public static function copy_hook($params) { public static function copy_hook($params) {
$oldpath = $params['oldpath'];
if (\OCP\App::isEnabled('files_versions')) { $newpath = $params['newpath'];
$oldpath = $params['oldpath']; if($oldpath !== '' && $newpath !== '') {
$newpath = $params['newpath']; Storage::renameOrCopy($oldpath, $newpath, 'copy');
if($oldpath !== '' && $newpath !== '') {
Storage::renameOrCopy($oldpath, $newpath, 'copy');
}
} }
} }
@ -137,25 +125,21 @@ class Hooks {
* *
*/ */
public static function pre_renameOrCopy_hook($params) { 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
// if we rename a movable mount point, then the versions don't have $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
// to be renamed $manager = \OC\Files\Filesystem::getMountManager();
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']); $mount = $manager->find($absOldPath);
$manager = \OC\Files\Filesystem::getMountManager(); $internalPath = $mount->getInternalPath($absOldPath);
$mount = $manager->find($absOldPath); if ($internalPath === '' and $mount instanceof \OC\Files\Mount\MoveableMount) {
$internalPath = $mount->getInternalPath($absOldPath); return;
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']);
}
$view = new \OC\Files\View(\OCP\User::getUser() . '/files');
if ($view->file_exists($params['newpath'])) {
Storage::store($params['newpath']);
} else {
Storage::setSourcePathAndUser($params['oldpath']);
} }
} }