From 9b17dcc920602242e4be711fb22e3b0b90254132 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 15 Oct 2007 13:26:57 +0000 Subject: [PATCH] Reload config file, if modified timestamp changed. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7554 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/main.php | 1 + include/class_config.inc | 25 +++++++++++++++++++ .../admin/systems/class_printerPPDDialog.inc | 4 +-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/html/main.php b/html/main.php index da788e67e..50a3e87cf 100644 --- a/html/main.php +++ b/html/main.php @@ -70,6 +70,7 @@ if ($_SERVER['REMOTE_ADDR'] != $ui->ip){ exit; } $config= $_SESSION['config']; +$config->check_and_reload(); /* Enable compressed output */ if (isset($config->data['MAIN']['COMPRESSED']) && preg_match('/^(true|on)$/i', $config->data['MAIN']['COMPRESSED'])){ diff --git a/include/class_config.inc b/include/class_config.inc index f1431443c..ce92a8b30 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -47,6 +47,8 @@ class config { var $idepartments= array(); var $adepartments= array(); var $tdepartments= array(); + var $filename = ""; + var $last_modified = 0; function config($filename, $basedir= "") { @@ -62,8 +64,31 @@ class config { } } + + function check_and_reload() + { + if($this->filename != "" && filemtime($this->filename) != $this->last_modified){ + $this->parser = xml_parser_create(); + xml_set_object($this->parser, $this); + xml_set_element_handler($this->parser, "tag_open", "tag_close"); + $this->parse($this->filename); + if(isset($_SESSION['plist'])){ + unset($_SESSION['plist']); + } + if(isset($_SESSION['plug'])){ + unset($_SESSION['plug']); + } + if(isset($_GET['plug'])){ + unset($_GET['plug']); + } + } + } + + function parse($filename) { + $this->last_modified = filemtime($filename); + $this->filename = $filename; $fh= fopen($filename, "r"); $xmldata= fread($fh, 100000); fclose($fh); diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc index 78929670c..1863d8deb 100644 --- a/plugins/admin/systems/class_printerPPDDialog.inc +++ b/plugins/admin/systems/class_printerPPDDialog.inc @@ -290,8 +290,8 @@ class printerPPDDialog extends plugin print_red(sprintf(_("Can't add new ppd file, the source file '%s' is not accessible."),$_PathOnHdd)); }else{ $this->add_ppd_later = $_PathOnHdd."_back"; - $this->add_later_msg_dialog = new msg_dialog(_("PPD file already exists"), - _("There is already a ppd file for this kind of printer."),CONFIRM_DIALOG); + $this->add_later_msg_dialog = new msg_dialog(_("Overwrite existing PPD"), + _("There is already a ppd file for this kind of printer. Do you want to overwrite it?"),CONFIRM_DIALOG); } return; } -- 2.30.2