From: hickert Date: Thu, 26 Aug 2010 11:36:19 +0000 (+0000) Subject: Updated usage of cache directory for all graphs X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0595b1ce5c2f528b63adb7988e0a2b45a6a8a2a2;p=gosa.git Updated usage of cache directory for all graphs git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19464 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc index a983ab28a..e78ff90d2 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc @@ -20,7 +20,7 @@ class actionSelectChart extends statChart $gData = $this->graphData; $dataSet = new pData; $seriesCnt = 0; - $pCache = new pCache('/var/spool/gosa/'); + $pCache = new pCache($this->cachePath); // Check if we've received data for the graph we've to render now. $seriesValid = count($gData['actionTypeGraph']); diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_categoryActionOverTime.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_categoryActionOverTime.inc index 6d9e912ff..99703a56a 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_categoryActionOverTime.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_categoryActionOverTime.inc @@ -55,7 +55,7 @@ class categoryActionsOverTime extends statChart $dataSet->SetAbsciseLabelSerie('date'); // Read graph from cache? - $pCache = new pCache('/var/spool/gosa/'); + $pCache = new pCache($this->cachePath); if($this->enableCaching && $pCache->IsInCache(get_class(),$allSeriesDataSet->GetData())){ $filename = $pCache->GetHash(get_class(),$allSeriesDataSet->GetData()); $filename = '/var/spool/gosa/'.$filename; diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_memoryUsageChart.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_memoryUsageChart.inc index ac6b8d3c3..83d294cef 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_memoryUsageChart.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_memoryUsageChart.inc @@ -46,7 +46,7 @@ class memoryUsageChart extends statChart $dataSet->SetAbsciseLabelSerie('date'); // Read graph from cache? - $pCache = new pCache('/var/spool/gosa/'); + $pCache = new pCache($this->cachePath); if($this->enableCaching && $pCache->IsInCache(get_class(),$dataSet->GetData())){ $filename = $pCache->GetHash(get_class(),$dataSet->GetData()); $filename = '/var/spool/gosa/'.$filename; diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_objectCountChart.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_objectCountChart.inc index b5cf340b2..4c5a2f559 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_objectCountChart.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_objectCountChart.inc @@ -47,7 +47,7 @@ class objectCountChart extends statChart $dataSet->SetAbsciseLabelSerie('date'); // Read graph from cache? - $pCache = new pCache('/var/spool/gosa/'); + $pCache = new pCache($this->cachePath); if($this->enableCaching && $pCache->IsInCache(get_class(),$dataSet->GetData())){ $filename = $pCache->GetHash(get_class(),$dataSet->GetData()); $filename = '/var/spool/gosa/'.$filename; diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_passwordChangeChart.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_passwordChangeChart.inc index 725afdefa..a2fb8d93f 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_passwordChangeChart.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_passwordChangeChart.inc @@ -49,7 +49,7 @@ class passwordChangeChart extends statChart $dataSet->SetAbsciseLabelSerie('date'); // Read graph from cache? - $pCache = new pCache('/var/spool/gosa/'); + $pCache = new pCache($this->cachePath); if($this->enableCaching && $pCache->IsInCache(get_class(),$dataSet->GetData())){ $filename = $pCache->GetHash(get_class(),$dataSet->GetData()); $filename = '/var/spool/gosa/'.$filename; diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_pieChart1.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_pieChart1.inc index 5bbce475b..f13b06d5a 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_pieChart1.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_pieChart1.inc @@ -61,7 +61,7 @@ class pieChart1 extends statChart $dataSet->SetAbsciseLabelSerie("Serie2"); // Read graph from cache? - $pCache = new pCache('/var/spool/gosa/'); + $pCache = new pCache($this->cachePath); if($this->enableCaching && $pCache->IsInCache(get_class(),$dataSet->GetData())){ $filename = $pCache->GetHash(get_class(),$dataSet->GetData()); $filename = '/var/spool/gosa/'.$filename; diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_statChart.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_statChart.inc index 5b4cd4f42..7b5046506 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_statChart.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_statChart.inc @@ -14,8 +14,23 @@ class statChart{ protected $graphName = 0; protected $seriesList = array(); + protected $cachePath = ""; + function __construct(&$config,$gData = array()) { + // Try to get the configured stats path to store image for caching reasons + $path = $config->get_cfg_value('core', 'statsDatabaseDirectory'); + if(!empty($path)){ + $this->cachePath = "{$path}/images/"; + }else{ + $this->cachePath = "/var/spool/gosa/stats/images/"; + } + + // Try to create the cache path + if(!is_dir($this->cachePath)){ + @mkdir($this->cachePath); + } + $this->config = $config; // Collect category translations