From 352132dd79033703571e91c6ee022723d218e1db Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 11 May 2009 10:02:31 +0000 Subject: [PATCH] Save ppd files with correct ending, in case of gzipped files use .gz git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13645 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/goto/class_printGeneric.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc index 88bc20956..117f5ee61 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc @@ -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)) { -- 2.30.2