summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a049f9f)
raw | patch | inline | side by side (parent: a049f9f)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 15 Oct 2007 12:14:18 +0000 (12:14 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 15 Oct 2007 12:14:18 +0000 (12:14 +0000) |
Only reload ppds that have been modified.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7551 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7551 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_ppdManager.inc | patch | blob | history |
index 7e416556d036bcf13f8aa23af19f69c783d3b019..a9dfd1a7f995e5bb292b7985864ebac8984039c3 100644 (file)
{
var $path= "";
var $cachedList= array();
+ var $timestamps = array();
function ppdManager($path)
{
$model= "";
$manufacturer= "";
+
+ /* Only parse complete PPD file again, if it was changed */
+ $modified = filemtime($ppdFile);
+ if(isset($this->cachedList[$ppdFile]) && isset($this->timestamps[$ppdFile]) && $modified == $this->timestamps[$ppdFile]){
+ return($this->cachedList[$ppdFile]);
+ }
+
+ /* Remember modified timestamp, to speed up next request */
+ $this->timestamps[$ppdFile] = filemtime($ppdFile);
+
$fh= fopen ($ppdFile, 'r');
while ((!feof($fh))&&($fh)) {
$list= $this->findPPD($this->path);
/* Load descriptive informations to build final printer list */
- $this->cachedList= array();
+ $new = array();
foreach ($list as $ppdFile){
- $this->cachedList[$ppdFile]= $this->loadDescription($ppdFile);
+ $new[$ppdFile] = $this->loadDescription($ppdFile);
}
+ $this->cachedList= $new ;
}