diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2012-11-28 04:35:52 -0800 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2012-11-28 04:35:52 -0800 |
commit | eaa625c9bc426dcba0427457777a79a3944628a5 (patch) | |
tree | 5f257cb937af78d0bc63f555930e23062cd0b16f /lib | |
parent | 1d4d4fd678cd3d76c4b8a0182ec97f65b9d97b0a (diff) | |
parent | 8bed38c78ddea18ed10a253d0838166d4342a171 (diff) | |
download | nextcloud-server-eaa625c9bc426dcba0427457777a79a3944628a5.tar.gz nextcloud-server-eaa625c9bc426dcba0427457777a79a3944628a5.zip |
Merge pull request #401 from owncloud/share_hooks
Create functions to install standard hooks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 38 | ||||
-rw-r--r-- | lib/public/share.php | 5 |
2 files changed, 31 insertions, 12 deletions
diff --git a/lib/base.php b/lib/base.php index 66d2d400285..dff73ef1ae8 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::registerCacheHooks(); + self::registerFilesystemHooks(); + self::registerShareHooks(); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); @@ -475,6 +471,34 @@ class OC{ } /** + * register hooks for the cache + */ + public static function registerCacheHooks() { + // register cache cleanup jobs + OC_BackgroundJob_RegularTask::register('OC_Cache_FileGlobal', 'gc'); + OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener'); + } + + /** + * register hooks for the filesystem + */ + public static function registerFilesystemHooks() { + // Check for blacklisted files + OC_Hook::connect('OC_Filesystem', 'write', 'OC_Filesystem', 'isBlacklisted'); + OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); + } + + /** + * register hooks for sharing + */ + public static function registerShareHooks() { + 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() { diff --git a/lib/public/share.php b/lib/public/share.php index 653ea64fa60..d736871d244 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -20,11 +20,6 @@ */ namespace OCP; -\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'); - /** * This class provides the ability for apps to share their content between users. * Apps must create a backend class that implements OCP\Share_Backend and register it with this class. |