From facd345880e7624af64b09e7a84eb2300caad863 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 8 May 2015 14:36:47 +0000 Subject: [PATCH] Check if the mail integration hook is registered, if not, try to register it, otherwise throws an exception with useful information. --- mail/inc/class.mail_integration.inc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mail/inc/class.mail_integration.inc.php b/mail/inc/class.mail_integration.inc.php index 2ad5559529..c843fda877 100644 --- a/mail/inc/class.mail_integration.inc.php +++ b/mail/inc/class.mail_integration.inc.php @@ -270,7 +270,17 @@ class mail_integration { unset($mailcontent['attachments'][$key]['add_raw']); } } - + + // Check if the hook is registered + if ($GLOBALS['egw']->hooks->hook_exists('mail_import',$app) == 0) + { + // Try to register hook + if(!$GLOBALS['egw']->hooks->register_single_app_hook($app,'mail_import')) + { + throw new egw_exception_assertion_failed('Hook import_mail registration faild for '.$app.' app! Please, contact your system admin in order to clear cache and register hooks.'); + } + } + // Get the registered hook method of requested app for integration $hook = $GLOBALS['egw']->hooks->single(array('location' => 'mail_import'),$app);