From c0b74d0c7821b9522ddd66951b9b0ebb6a1735fa Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 8 Jul 2008 12:46:23 +0000 Subject: [PATCH] Enhanced reload of menu, iconmenu and ACLs. -If class_location has changed, recreate menus and reload ACLs. Triggered by config->check_and_reload() in main.php git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11559 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_config.inc | 26 +++++++++++++++++++++ gosa-core/include/class_pluglist.inc | 35 ++++++++-------------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index 64039fd3a..b9d34dc6f 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -70,6 +70,32 @@ class config { function check_and_reload() { + + /* Check if class_location.inc has changed, this is the case + if we have installed or removed plugins. + */ + if(session::is_set("class_location.inc:timestamp")){ + $tmp = stat("../include/class_location.inc"); + if($tmp['mtime'] != session::get("class_location.inc:timestamp")){ + + /* Refresh users ACLs */ + $ui= get_userinfo(); + $ui->loadACL(); + session::set('ui',$ui); + + /* Reset menu and iconmenu */ + if(session::is_set("plist")){ + $plist = session::get("plist"); + $plist->reset_menus(); + session::set("plist",$plist); + } + } + } + $tmp = stat("../include/class_location.inc"); + session::set("class_location.inc:timestamp",$tmp['mtime']); + + + if($this->filename != "" && filemtime($this->filename) != $this->last_modified){ $this->config_found= FALSE; diff --git a/gosa-core/include/class_pluglist.inc b/gosa-core/include/class_pluglist.inc index a1937cafd..ba3288a63 100644 --- a/gosa-core/include/class_pluglist.inc +++ b/gosa-core/include/class_pluglist.inc @@ -142,18 +142,6 @@ class pluglist { function gen_menu() { - /* Check if class_location.inc has changed, this is the case - if we have installed or removed plugins. - */ - if(session::is_set("class_location.inc:timestamp")){ - $tmp = stat("../include/class_location.inc"); - if($tmp['mtime'] != session::get("class_location.inc:timestamp")){ - $this->menu = ""; - } - } - $tmp = stat("../include/class_location.inc"); - session::set("class_location.inc:timestamp",$tmp['mtime']); - if ($this->menu == ""){ $first= TRUE; $cfg= $this->config->data['MENU']; @@ -265,19 +253,6 @@ class pluglist { function show_iconmenu() { global $class_mapping; - - /* Check if class_location.inc has changed, this is the case - if we have installed or removed plugins. - */ - if(session::is_set("class_location.inc:timestamp")){ - $tmp = stat("../include/class_location.inc"); - if($tmp['mtime'] != session::get("class_location.inc:timestamp")){ - $this->iconmenu = ""; - } - } - $tmp = stat("../include/class_location.inc"); - session::set("class_location.inc:timestamp",$tmp['mtime']); - if ($this->iconmenu == ""){ $cfg= $this->config->data['MENU']; @@ -413,6 +388,16 @@ class pluglist { { return(isset($this->allowed_plugins[$plug_id])); } + + + /*! \brief Force the menu to be recreated + */ + function reset_menus() + { + $this->menu = ""; + $this->iconmenu =""; + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2