コード例 #1
0
ファイル: DrupalTask.php プロジェクト: regilero/prod
 public function manageRRD()
 {
     // RRD storage, now that all tables are at least recorded once
     if (variable_get('prod_stats_rrd_enabled', FALSE)) {
         $rrd_manager = new Manager();
         $rrd_manager->loadMultipleProviders($this->getId(), array($this))->manageRotations();
     }
 }
コード例 #2
0
ファイル: TaskHandler.php プロジェクト: regilero/prod
 /**
  * This is the function called when we need to recompute the stats
  *
  * Here we loop on each available database for Drupal and try
  * to extract a reasonable number of stats for tables inside.
  * Several run may be necessary to extract all available informations.
  * @warning: use the global $database variable from drupal core
  * to retrieve databases.
  */
 public function dbCollector()
 {
     // This is the Drupal global database record !!
     global $databases;
     $this->logger->log(__METHOD__, NULL, WATCHDOG_DEBUG);
     // number of tables to handle per run
     $limit = (int) variable_get('prod_stats_batch_limit', 50);
     foreach ($databases as $identifier => $databases_arr) {
         $dbAnalyser = AnalyzerFactory::get($databases_arr, $identifier);
         if ($limit > 0) {
             // still have the right to track some tables on this run
             $tables = $dbAnalyser->extractTables($limit);
             foreach ($tables as $table) {
                 $table->save();
                 $limit--;
             }
         }
         // Add a global aggregate record for the database
         // we always do that, no matter about the limits
         $dbRecord = $dbAnalyser->ManageDbRecord();
         // Add this record on the collection, so that it can be used in rrd
         $tables[] = $dbRecord;
         // RRD storage, now that all tables are at least recorded once
         if (variable_get('prod_stats_rrd_enabled', FALSE)) {
             $rrd_manager = new Manager();
             $rrd_manager->loadMultipleProviders($this->getId(), $tables)->manageRotations();
         }
         // Try to guess some default user group values for records
         // having none
         $dbAnalyser->setDefaultUserGroup();
     }
     // end database loop
 }