fix not working update from 1.6 by running register-all-hooks after restore (old 1.6 wiki_bo::search_link hook can not run in setup, so we need the new hook)

This commit is contained in:
Ralf Becker 2012-04-13 14:33:43 +00:00
parent 747b403973
commit 797a412ec8
2 changed files with 10 additions and 9 deletions

View File

@ -587,6 +587,9 @@ class db_backup
{ {
return lang('Restore failed'); return lang('Restore failed');
} }
// search-and-register-hooks
$GLOBALS['egw']->hooks->register_all_hooks();
return ''; return '';
} }

View File

@ -308,17 +308,15 @@ class hooks
*/ */
function register_all_hooks() function register_all_hooks()
{ {
$SEP = filesystem_separator(); // deleting hooks, to get ride of no longer existing apps
$this->db->delete($this->table,'1=1',__LINE__,__FILE__);
// deleting hooks of all not longer registered apps // now register all apps using just filesystem data
if (($all_apps = array_keys($GLOBALS['egw_info']['apps']))) foreach(scandir(EGW_SERVER_ROOT) as $appname)
{ {
$this->db->delete($this->table,"hook_appname NOT IN ('".implode("','",$all_apps)."')",__LINE__,__FILE__); if ($appname[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$appname)) continue;
}
// now register the rest again $f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
foreach($GLOBALS['egw_info']['apps'] as $appname => $app)
{
$f = EGW_SERVER_ROOT . $SEP . $appname . $SEP . 'setup' . $SEP . 'setup.inc.php';
$setup_info = array($appname => array()); $setup_info = array($appname => array());
if(@file_exists($f)) include($f); if(@file_exists($f)) include($f);
// some apps have setup_info for more then themselfs (eg. phpgwapi for groupdav) // some apps have setup_info for more then themselfs (eg. phpgwapi for groupdav)