summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2035e2a)
raw | patch | inline | side by side (parent: 2035e2a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 11 May 2009 08:22:10 +0000 (08:22 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 11 May 2009 08:22:10 +0000 (08:22 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13644 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/ppd/class_ppdManager.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/systems/ppd/class_ppdManager.inc b/gosa-plugins/goto/admin/systems/ppd/class_ppdManager.inc
index ade6e78f62ed9127de6d7a0568c20f1d151458d5..b151dc579a12f4026619f99f064e3b0c39dfe2f7 100644 (file)
var $cachedList= array();
var $timestamps = array();
+ var $useGzip = true;
+
function ppdManager($path)
{
+ global $config;
+ $value =$config->get_cfg_value("ppdGzip","true");
+ if(preg_match('/false/i',$value)){
+ $this->useGzip = false;
+ }
+
if(is_dir($path)){
$this->path= $path;
}elseif(is_link($path) && (is_dir(readlink($path)))) {
msg_dialog::display(_("PPD manager error"), sprintf(_("The specified path '%s' does not exist."),$path), ERROR_DIALOG);
return (false);
}
+
+
}
$section= preg_replace('/^\*/', '', $section);
$attribute= preg_replace('/^\*/', '', $attribute);
- $rp= @gzopen($file, "r");
- $wp= @gzopen("$file.tmp", "w");
-
-
-
- while (!gzeof($rp)){
- $lines[]= gzgets($rp, 1024);
- }
+ if($this->useGzip){
+ $rp= @gzopen($file, "r");
+ $wp= @gzopen("$file.tmp", "w");
+ }else{
+ $rp= @gzopen($file, "r");
+ $wp= @fopen("$file.tmp", "w");
+ }
+
+ if($this->useGzip){
+ while (!gzeof($rp)){
+ $lines[]= gzgets($rp, 1024);
+ }
+ }else{
+ while (!feof($rp)){
+ $lines[]= fgets($rp, 1024);
+ }
+ }
$ret = "";
$done =false;
$ret .=$line;
}
- gzwrite($wp,$ret);
-
- gzclose($wp);
- gzclose($rp);
+ if($this->useGzip){
+ gzwrite($wp,$ret);
+ gzclose($wp);
+ gzclose($rp);
+ }else{
+ fwrite($wp,$ret);
+ fclose($wp);
+ gzclose($rp);
+ }
copy("$file.tmp", "$file");
unlink("$file.tmp");
$option= "";
$properties= array();
- $fh= gzopen ($ppdFile, 'r');
- while (!gzeof($fh)) {
+ $fh= gzopen ($ppdFile, 'r');
+ while (!gzeof($fh) && $fh){
/* Read line */
- $line= gzgets($fh, 256);
+ $line= gzgets($fh, 256);
if (strlen($line) >= 256){
trigger_error(_('Parsing PPD file %s failed - line too long. Trailing characters have been ignored'), E_USER_WARNING);
}
}
}
}
- gzclose ($fh);
+ gzclose ($fh);
return ($properties);
}
/* Remember modified timestamp, to speed up next request */
$this->timestamps[$ppdFile] = filemtime($ppdFile);
-
$fh= gzopen ($ppdFile, 'r');
- while ((!gzeof($fh))&&($fh)) {
- /* Read line */
+ while (!gzeof($fh) && $fh){
+
$line= gzgets($fh, 256);
if (strlen($line) >= 256){
trigger_error(_('Parsing PPD file %s failed - line too long. Trailing characters have been ignored'), E_USER_WARNING);
break;
}
}
+
gzclose ($fh);
/* If model contains manufacturer strip it */