diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-11-13 23:45:17 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-11-13 23:45:17 +0100 |
commit | 530f3f8be9336ec49eab9f00e2c3b15d29bc78c7 (patch) | |
tree | 4554fda5274e69523269ba938878f48bafdd01bb /lib/base.php | |
parent | ad85087fccf52ab68899b38b8bab28c0d17b673d (diff) | |
download | nextcloud-server-530f3f8be9336ec49eab9f00e2c3b15d29bc78c7.tar.gz nextcloud-server-530f3f8be9336ec49eab9f00e2c3b15d29bc78c7.zip |
Create functions to install standard hooks
Also use these in tests that needs them
Fix #151
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/lib/base.php b/lib/base.php index c97700b3dbf..74b53c56658 100644 --- a/lib/base.php +++ b/lib/base.php @@ -433,13 +433,9 @@ class OC{ //setup extra user backends OC_User::setupBackends(); - // register cache cleanup jobs - OC_BackgroundJob_RegularTask::register('OC_Cache_FileGlobal', 'gc'); - OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener'); - - // Check for blacklisted files - OC_Hook::connect('OC_Filesystem', 'write', 'OC_Filesystem', 'isBlacklisted'); - OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); + self::installCacheHooks(); + self::installFilesystemHooks(); + self::installShareHooks(); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); @@ -475,6 +471,34 @@ class OC{ } /** + * install hooks for the cache + */ + public static function installCacheHooks() { + // register cache cleanup jobs + OC_BackgroundJob_RegularTask::register('OC_Cache_FileGlobal', 'gc'); + OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener'); + } + + /** + * install hooks for the filesystem + */ + public static function installFilesystemHooks() { + // Check for blacklisted files + OC_Hook::connect('OC_Filesystem', 'write', 'OC_Filesystem', 'isBlacklisted'); + OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); + } + + /** + * install hooks for sharing + */ + public static function installShareHooks() { + OC_Hook::connect('OC_User', 'post_deleteUser', 'OCP\Share', 'post_deleteUser'); + OC_Hook::connect('OC_User', 'post_addToGroup', 'OCP\Share', 'post_addToGroup'); + OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OCP\Share', 'post_removeFromGroup'); + OC_Hook::connect('OC_User', 'post_deleteGroup', 'OCP\Share', 'post_deleteGroup'); + } + + /** * @brief Handle the request */ public static function handleRequest() { |