Merge pull request #6922 from nextcloud/unneeded-isEnabled-check
Remove unneeded check if app is enabled
This commit is contained in:
commit
306d4e1d40
|
@ -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,11 +195,8 @@ class UserHooks implements IHook {
|
||||||
* @param array $params
|
* @param array $params
|
||||||
*/
|
*/
|
||||||
public function postCreateUser($params) {
|
public function postCreateUser($params) {
|
||||||
|
|
||||||
if (App::isEnabled('encryption')) {
|
|
||||||
$this->userSetup->setupUser($params['uid'], $params['password']);
|
$this->userSetup->setupUser($params['uid'], $params['password']);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cleanup encryption backend upon user deleted
|
* cleanup encryption backend upon user deleted
|
||||||
|
@ -213,18 +205,13 @@ 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) {
|
||||||
|
|
||||||
if (App::isEnabled('encryption')) {
|
|
||||||
$this->keyManager->deletePublicKey($params['uid']);
|
$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) {
|
||||||
$uid = $params['uid'];
|
$uid = $params['uid'];
|
||||||
|
|
|
@ -39,11 +39,9 @@ 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) {
|
||||||
$user = \OCP\User::getUser();
|
$user = \OCP\User::getUser();
|
||||||
|
|
|
@ -54,14 +54,11 @@ class Hooks {
|
||||||
* listen to write event.
|
* listen to write event.
|
||||||
*/
|
*/
|
||||||
public static function write_hook( $params ) {
|
public static function write_hook( $params ) {
|
||||||
|
|
||||||
if (\OCP\App::isEnabled('files_versions')) {
|
|
||||||
$path = $params[\OC\Files\Filesystem::signal_param_path];
|
$path = $params[\OC\Files\Filesystem::signal_param_path];
|
||||||
if($path !== '') {
|
if($path !== '') {
|
||||||
Storage::store($path);
|
Storage::store($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,14 +69,11 @@ 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) {
|
||||||
|
|
||||||
if (\OCP\App::isEnabled('files_versions')) {
|
|
||||||
$path = $params[\OC\Files\Filesystem::signal_param_path];
|
$path = $params[\OC\Files\Filesystem::signal_param_path];
|
||||||
if($path !== '') {
|
if($path !== '') {
|
||||||
Storage::delete($path);
|
Storage::delete($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mark file as "deleted" so that we can clean up the versions if the file is gone
|
* mark file as "deleted" so that we can clean up the versions if the file is gone
|
||||||
|
@ -100,15 +94,12 @@ 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) {
|
||||||
|
|
||||||
if (\OCP\App::isEnabled('files_versions')) {
|
|
||||||
$oldpath = $params['oldpath'];
|
$oldpath = $params['oldpath'];
|
||||||
$newpath = $params['newpath'];
|
$newpath = $params['newpath'];
|
||||||
if($oldpath !== '' && $newpath !== '') {
|
if($oldpath !== '' && $newpath !== '') {
|
||||||
Storage::renameOrCopy($oldpath, $newpath, 'rename');
|
Storage::renameOrCopy($oldpath, $newpath, 'rename');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* copy versions of copied files
|
* copy versions of copied files
|
||||||
|
@ -118,15 +109,12 @@ 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) {
|
||||||
|
|
||||||
if (\OCP\App::isEnabled('files_versions')) {
|
|
||||||
$oldpath = $params['oldpath'];
|
$oldpath = $params['oldpath'];
|
||||||
$newpath = $params['newpath'];
|
$newpath = $params['newpath'];
|
||||||
if($oldpath !== '' && $newpath !== '') {
|
if($oldpath !== '' && $newpath !== '') {
|
||||||
Storage::renameOrCopy($oldpath, $newpath, 'copy');
|
Storage::renameOrCopy($oldpath, $newpath, 'copy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remember owner and the owner path of the source file.
|
* Remember owner and the owner path of the source file.
|
||||||
|
@ -137,8 +125,6 @@ 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
|
// if we rename a movable mount point, then the versions don't have
|
||||||
// to be renamed
|
// to be renamed
|
||||||
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
|
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
|
||||||
|
@ -155,8 +141,6 @@ class Hooks {
|
||||||
} else {
|
} else {
|
||||||
Storage::setSourcePathAndUser($params['oldpath']);
|
Storage::setSourcePathAndUser($params['oldpath']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue