Beispiel #1
0
 /**
  * Singleton, returns instance
  *
  * @return Piwik_ArchiveProcessing_Record_Manager
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
Beispiel #2
0
 public function delete()
 {
     Piwik_ArchiveProcessing_Record_Manager::getInstance()->unregister($this);
 }
 /**
  * Post processing called at the end of the main archive processing.
  * Makes sure the new archive is marked as "successful" in the DB
  * 
  * We also try to delete some stuff from memory but really there is still a lot...
  * 
  * @return void
  */
 protected function postCompute()
 {
     // delete the first done = ERROR
     Zend_Registry::get('db')->query("\n\t\t\t\t\t\t\tDELETE FROM " . $this->tableArchiveNumeric->getTableName() . " \n\t\t\t\t\t\t\tWHERE idarchive = ? AND name = 'done'", array($this->idArchive));
     $record = new Piwik_ArchiveProcessing_Record_Numeric('done', Piwik_ArchiveProcessing::DONE_OK);
     // save in the database the records
     $records = Piwik_ArchiveProcessing_Record_Manager::getInstance()->getRecords();
     foreach ($records as $record) {
         $this->insertRecord($record);
     }
     // delete the records from the global manager
     foreach ($records as $record) {
         $record->delete();
     }
     unset($records);
     // we delete all tables from the table register
     Piwik_ArchiveProcessing_Record_Manager::getInstance()->deleteAll();
 }