Code

Updated statistics
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Aug 2010 06:21:38 +0000 (06:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Aug 2010 06:21:38 +0000 (06:21 +0000)
- Fixed detect of unsubmitted stat files
- Only create statistics class once per session.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19452 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/statistics/chartClasses/class_memoryUsageChart.inc
gosa-core/plugins/generic/statistics/class_statistics.inc
gosa-core/plugins/generic/statistics/main.inc

index 73b9ec42b0e65299fa4d2e9fe153e0761e70f561..da16ec54e9c092d81de8c1415202b58503315a5d 100644 (file)
@@ -37,8 +37,6 @@ class memoryUsageChart extends statChart
         $dataSet->AddPoint($this->graphData['dates'], 'date');
         $dataSet->SetAbsciseLabelSerie('date');  
        
-        echo $this->enableCaching;
         // Read graph from cache?
         $pCache = new pCache('/var/spool/gosa/');
         if($this->enableCaching && $pCache->IsInCache(get_class(),$dataSet->GetData())){
index 0fe4889d9c3518077d5a2732840828f20634e05f..e0794141809fac51c9c7bf5dea7a8441f61e26ec 100644 (file)
@@ -21,7 +21,7 @@ class statistics extends plugin
     var $graph1DatePicker2 = 0;
 
     // A collection of timestamps for unsubmitted statistics data.
-    var $unsbmittedFiles = array();
+    var $unsbmittedFiles = NULL;
 
     var $graphs = array();
     var $selectedGraphType = 0;
@@ -53,9 +53,6 @@ class statistics extends plugin
                     "WyukwauWoid2",
                     TRUE);
         }
-
-        // Get list of unsubmitted files.
-        $this->unsbmittedFiles = $this->getUnsubmittedStatistics();
     }
 
 
@@ -83,8 +80,12 @@ class statistics extends plugin
      */ 
     function getUnsubmittedStatistics()
     {
-        $available = $this->getLocalStatisticsFiles();
         $alreadyTransmitted = $this->getStatisticsDatesFromServer();
+        if($alreadyTransmitted == NULL){
+            return(NULL);
+        }
+
+        $available = $this->getLocalStatisticsFiles();
 
         $unsubmitted = array();
         foreach($available as $key => $day){
@@ -113,6 +114,7 @@ class statistics extends plugin
         $dates = array();
         if(!$this->rpcHandle->success()){
             msg_dialog::display(_("Error"),msgPool::rpcError($this->rpcHandle->get_error()),ERROR_DIALOG);
+            return(NULL);
         }else{
             foreach($res as $date){
                 $dates[$date] = strtotime($date);
@@ -129,6 +131,11 @@ class statistics extends plugin
         $smarty->assign('graph1DatePicker1', $this->graph1DatePicker1);
         $smarty->assign('graph1DatePicker2', $this->graph1DatePicker2);
 
+        // Get list of unsubmitted files.
+        if($this->unsbmittedFiles == NULL){
+            $this->unsbmittedFiles = $this->getUnsubmittedStatistics();
+        }
+
         // Do not render anything if we are not prepared to send and receive data via rpc.
         $smarty->assign("rpcConfigured", $this->rpcConfigured);
         $smarty->assign("validRpcHandle", TRUE);
index ae48640d1ff763aed4f72b25d52fc44eca3ceed6..c82c84c925401bc9f8cb9e0b9bd42c712525f7b3 100644 (file)
@@ -30,7 +30,7 @@ if ($remove_lock){
 /* Remove this plugin from session
 */
 if ( $cleanup ){
-  session::un_set('statistics');
+   # session::un_set('statistics');
 }else{