Check if the mail integration hook is registered, if not, try to register it, otherwise throws an exception with useful information.

This commit is contained in:
Hadi Nategh 2015-05-08 14:36:47 +00:00
parent 110954de73
commit facd345880

View File

@ -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);