Code

Updated usage of cache directory for all graphs
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Aug 2010 11:36:19 +0000 (11:36 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Aug 2010 11:36:19 +0000 (11:36 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19464 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc
gosa-core/plugins/generic/statistics/chartClasses/class_categoryActionOverTime.inc
gosa-core/plugins/generic/statistics/chartClasses/class_memoryUsageChart.inc
gosa-core/plugins/generic/statistics/chartClasses/class_objectCountChart.inc
gosa-core/plugins/generic/statistics/chartClasses/class_passwordChangeChart.inc
gosa-core/plugins/generic/statistics/chartClasses/class_pieChart1.inc
gosa-core/plugins/generic/statistics/chartClasses/class_statChart.inc

index a983ab28a1f1b958f636ae95bb030a1887764d5d..e78ff90d294b2f4ed30da6ee6b5e4b635cd363f5 100644 (file)
@@ -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']);
index 6d9e912ff5e05589331ef6377fa7a27ad19076d5..99703a56a08ffe6c6f2c854d287feaf25060a666 100644 (file)
@@ -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;    
index ac6b8d3c3e797eaa436e1b3c0ba7a5c7c69d3db7..83d294cef3ba45532b2e02f3dcc9ace035e084e5 100644 (file)
@@ -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;    
index b5cf340b21e80db96436eb93b90abbd668b00248..4c5a2f55948da394ed66fb8e2ed28987f4042deb 100644 (file)
@@ -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;    
index 725afdefac873d0ce2eb058f62e65c77f283efe3..a2fb8d93f323a2efd56eeffb50e3f885a6451d48 100644 (file)
@@ -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;    
index 5bbce475b8692fad7204156553ec4d20fa74cc9e..f13b06d5aba299d55126e15b8dbdef0aab0754b8 100644 (file)
@@ -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;    
index 5b4cd4f428292e7848558667d52cbaf16e780e43..7b5046506ec8aaf853da590378a3a78d97251c9d 100644 (file)
@@ -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