remove hooks of apps, when deleting them (event if sources are no longer there)

This commit is contained in:
Ralf Becker 2010-09-15 20:09:57 +00:00
parent 699ce1b1a9
commit 6154863394
3 changed files with 5 additions and 5 deletions

View File

@ -195,7 +195,7 @@ class hooks
*
* @param string $appname Application 'name'
* @param array $hooks=null hooks to register, eg $setup_info[$app]['hooks'] or not used for only deregister the hooks
* @return boolean false on error, true otherwise
* @return boolean|int false on error, true if new hooks are supplied and registed or number of removed hooks
*/
function register_hooks($appname,$hooks=null)
{
@ -207,7 +207,7 @@ class hooks
if (!is_array($hooks) || !count($hooks)) // only deregister
{
return True;
return $this->db->affected_rows();
}
//echo "<p>ADDING hooks for: $appname</p>";
foreach($hooks as $key => $hook)

View File

@ -138,9 +138,8 @@ if(@get_var('submit',Array('POST')))
$GLOBALS['egw_setup']->deregister_app($setup_info[$appname]['name']);
echo '<br />' . $app_title . ' ' . lang('deregistered') . '.';
if ($setup_info[$appname]['hooks'])
if ($GLOBALS['egw_setup']->deregister_hooks($setup_info[$appname]['name']))
{
$GLOBALS['egw_setup']->deregister_hooks($setup_info[$appname]['name']);
echo '<br />' . $app_title . ' ' . lang('hooks deregistered') . '.';
}
$do_langs = true;

View File

@ -772,6 +772,7 @@ class setup
* de-Register an application's hooks
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
* @return boolean|int false on error or number of removed hooks
*/
function deregister_hooks($appname)
{
@ -790,7 +791,7 @@ class setup
{
$this->hooks =& CreateObject('phpgwapi.hooks',$this->db,$this->hooks_table);
}
$this->hooks->register_hooks($appname);
return $this->hooks->register_hooks($appname);
}
/**