Code

Save ppd files with correct ending, in case of gzipped files use .gz
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 11 May 2009 10:02:31 +0000 (10:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 11 May 2009 10:02:31 +0000 (10:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13645 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc

index 88bc20956e3b83dab580e5695caf8715bb8e8009..117f5ee612e8b00c3ff6d3f87c956c5c0414a635 100644 (file)
@@ -804,6 +804,24 @@ class printgeneric extends plugin
     /* save ppd configuration */
     if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
       $this->PPDdialogToSave->save_ppd();
+
+      /* Rename the generated ppd to match the gzip ending '.gz', if necessary.
+      */
+      $path = $this->config->get_cfg_value("ppdPath");
+      if(!preg_match("/\/$/",$path)){
+        $path = $path."/";
+      }
+      $ppdManager= new ppdManager($path);
+      if($ppdManager->useGzip && !preg_match('/\.gz$/',$this->gotoPrinterPPD)){
+        if(rename($path.$this->gotoPrinterPPD,$path.$this->gotoPrinterPPD.'.gz')){
+          $this->gotoPrinterPPD .= '.gz';
+        }
+      }elseif(!$ppdManager->useGzip && preg_match('/\.gz$/',$this->gotoPrinterPPD)){
+        $new_ppd = preg_replace('/\.gz$/','',$this->gotoPrinterPPD);
+        if(rename($path.$this->gotoPrinterPPD,$path.$new_ppd)){
+          $this->gotoPrinterPPD = $new_ppd; 
+        }
+      }
     }
     if($this->orig_dn != $this->dn){
       if(!empty($this->gotoPrinterPPD)) {