Code

Reload config file, if modified timestamp changed.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Oct 2007 13:26:57 +0000 (13:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Oct 2007 13:26:57 +0000 (13:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7554 594d385d-05f5-0310-b6e9-bd551577e9d8

html/main.php
include/class_config.inc
plugins/admin/systems/class_printerPPDDialog.inc

index da788e67e42efe173aa283652c8ad0954b9574ea..50a3e87cf72b4cee54dd97a03541ff53e8afe51e 100644 (file)
@@ -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'])){
index f1431443cffc69c2abc8f0877408d40d5d165594..ce92a8b30d6d464461bfd44fab1c46f68297c03b 100644 (file)
@@ -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); 
index 78929670c7f1c277a06507fc056ac3d4e5f62ab4..1863d8deb7d8219c50742f42e5377257854297c8 100644 (file)
@@ -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;
         }