From a7fc3c39e809cd45f2bc6ec46b554eff8b8679c8 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 9 May 2006 08:08:37 +0000 Subject: [PATCH] Added mkdir if base paths are missing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3228 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_printerPPDDialog.inc | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc index c63a68a1d..a7458d53e 100644 --- a/plugins/admin/systems/class_printerPPDDialog.inc +++ b/plugins/admin/systems/class_printerPPDDialog.inc @@ -95,7 +95,7 @@ class printerPPDDialog extends plugin /* Check if path is write/readable*/ $is_r = @is_readable($path); - if((!is_dir($path))||(empty($path)) || (!$is_r)){ + if(((!is_dir($path))||(empty($path)) || (!$is_r)) && (!@mkdir($path))){ print_red(sprintf(_("The specified path '%s' which results from PPD_PATH in your gosa.conf is invalid,". " can't read/write any ppd informations."),$path)); /* Print out template */ @@ -313,24 +313,26 @@ class printerPPDDialog extends plugin */ function getPrinterReload() { - $tmp = $this->ppdManager->getPrinterList(true); + if(is_readable($this->pathToPPD)){ + $tmp = $this->ppdManager->getPrinterList(true); - $this->ppdListHeader = $this->ppdList = array(); + $this->ppdListHeader = $this->ppdList = array(); - /* Sort all available files, and create header (Vendor index) */ - foreach($tmp as $file=>$ppd){ + /* Sort all available files, and create header (Vendor index) */ + foreach($tmp as $file=>$ppd){ - if(preg_match("#".$this->pathToModified."#",$file)) continue; + if(preg_match("#".$this->pathToModified."#",$file)) continue; - $tmp2 = split("\n",$ppd); - if(!isset($this->ppdListHeader[$tmp2[0]])){ - $this->ppdListHeader[$tmp2[0]]=0; + $tmp2 = split("\n",$ppd); + if(!isset($this->ppdListHeader[$tmp2[0]])){ + $this->ppdListHeader[$tmp2[0]]=0; + } + $tmp3['name'] =preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2]); + $tmp3['link'] =$file; + $tmp3['ppd'] =$ppd; + $this->ppdListHeader[$tmp2[0]]++; + $this->ppdList[$tmp2[0]][preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2])]=$tmp3; } - $tmp3['name'] =preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2]); - $tmp3['link'] =$file; - $tmp3['ppd'] =$ppd; - $this->ppdListHeader[$tmp2[0]]++; - $this->ppdList[$tmp2[0]][preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2])]=$tmp3; } } -- 2.30.2