From 797a412ec8d4f08afacfa56b5bfb939bb68d1496 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 13 Apr 2012 14:33:43 +0000 Subject: [PATCH] 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) --- phpgwapi/inc/class.db_backup.inc.php | 3 +++ phpgwapi/inc/class.hooks.inc.php | 16 +++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/phpgwapi/inc/class.db_backup.inc.php b/phpgwapi/inc/class.db_backup.inc.php index a3f2a4bc27..2fcd38f3ba 100644 --- a/phpgwapi/inc/class.db_backup.inc.php +++ b/phpgwapi/inc/class.db_backup.inc.php @@ -587,6 +587,9 @@ class db_backup { return lang('Restore failed'); } + // search-and-register-hooks + $GLOBALS['egw']->hooks->register_all_hooks(); + return ''; } diff --git a/phpgwapi/inc/class.hooks.inc.php b/phpgwapi/inc/class.hooks.inc.php index 15417029dc..5bb952158a 100644 --- a/phpgwapi/inc/class.hooks.inc.php +++ b/phpgwapi/inc/class.hooks.inc.php @@ -308,17 +308,15 @@ class 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 - if (($all_apps = array_keys($GLOBALS['egw_info']['apps']))) + // now register all apps using just filesystem data + foreach(scandir(EGW_SERVER_ROOT) as $appname) { - $this->db->delete($this->table,"hook_appname NOT IN ('".implode("','",$all_apps)."')",__LINE__,__FILE__); - } - // now register the rest again - foreach($GLOBALS['egw_info']['apps'] as $appname => $app) - { - $f = EGW_SERVER_ROOT . $SEP . $appname . $SEP . 'setup' . $SEP . 'setup.inc.php'; + if ($appname[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$appname)) continue; + + $f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php'; $setup_info = array($appname => array()); if(@file_exists($f)) include($f); // some apps have setup_info for more then themselfs (eg. phpgwapi for groupdav)