forked from extern/egroupware
remove hooks of apps, when deleting them (event if sources are no longer there)
This commit is contained in:
parent
699ce1b1a9
commit
6154863394
@ -195,7 +195,7 @@ class hooks
|
|||||||
*
|
*
|
||||||
* @param string $appname Application 'name'
|
* @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
|
* @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)
|
function register_hooks($appname,$hooks=null)
|
||||||
{
|
{
|
||||||
@ -207,7 +207,7 @@ class hooks
|
|||||||
|
|
||||||
if (!is_array($hooks) || !count($hooks)) // only deregister
|
if (!is_array($hooks) || !count($hooks)) // only deregister
|
||||||
{
|
{
|
||||||
return True;
|
return $this->db->affected_rows();
|
||||||
}
|
}
|
||||||
//echo "<p>ADDING hooks for: $appname</p>";
|
//echo "<p>ADDING hooks for: $appname</p>";
|
||||||
foreach($hooks as $key => $hook)
|
foreach($hooks as $key => $hook)
|
||||||
|
@ -138,9 +138,8 @@ if(@get_var('submit',Array('POST')))
|
|||||||
$GLOBALS['egw_setup']->deregister_app($setup_info[$appname]['name']);
|
$GLOBALS['egw_setup']->deregister_app($setup_info[$appname]['name']);
|
||||||
echo '<br />' . $app_title . ' ' . lang('deregistered') . '.';
|
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') . '.';
|
echo '<br />' . $app_title . ' ' . lang('hooks deregistered') . '.';
|
||||||
}
|
}
|
||||||
$do_langs = true;
|
$do_langs = true;
|
||||||
|
@ -772,6 +772,7 @@ class setup
|
|||||||
* de-Register an application's hooks
|
* de-Register an application's hooks
|
||||||
*
|
*
|
||||||
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
|
* @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)
|
function deregister_hooks($appname)
|
||||||
{
|
{
|
||||||
@ -790,7 +791,7 @@ class setup
|
|||||||
{
|
{
|
||||||
$this->hooks =& CreateObject('phpgwapi.hooks',$this->db,$this->hooks_table);
|
$this->hooks =& CreateObject('phpgwapi.hooks',$this->db,$this->hooks_table);
|
||||||
}
|
}
|
||||||
$this->hooks->register_hooks($appname);
|
return $this->hooks->register_hooks($appname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user