Beispiel #1
0
 /**
  * Return a list of Drupal\Prod\Stats\Rrd\Definitions from the Database.
  * 
  * All known definitions for the given set of providers are returned.
  * Note that this function can only retrieve providers attached to the same
  * StatTask (as providers ids are managed by each stat task).
  * 
  * @param int $task_id id of the Stat task for the given providers
  * 
  * @param array $providers_ids list of Providers id
  * 
  * @return multitype:\Drupal\Prod\Stats\Rrd\Definition
  */
 public static function loadDefinitionsByProviders($task_id, $providers_ids)
 {
     $results = db_select('prod_rrd_settings', 's')->fields('s')->condition('ptq_stat_tid', $task_id, '=')->condition('prs_stat_pid', $providers_ids, 'IN')->execute();
     $objects = array();
     foreach ($results as $result) {
         $rrdDef = new Definition($result->ptq_stat_tid, $result->prs_stat_pid, $result->prs_stat_col, $result->prs_interval, $result->prs_points_per_aggregate, $result->prs_points_per_graph);
         $rrdDef->setLastTimestamp($result->prs_last_timestamp)->setPointsBeforeLevel($result->prs_points_before_level_2, $result->prs_points_before_level_3, $result->prs_points_before_level_4, $result->prs_points_before_level_5)->setId($result->prs_id);
         $objects[] = $rrdDef;
     }
     return $objects;
 }
Beispiel #2
0
 /**
  * Preload All RRD definitions stored in database for all providers
  * listed in $this->providers_id_list (each provider can have more than
  * one RRD definition, one for each provided stat).
  */
 protected function _preloadRrdDefinitions($stat_task_id)
 {
     $results = Definition::loadDefinitionsByProviders($stat_task_id, $this->providers_id_list);
     foreach ($results as $rrdDef) {
         $this->_storeRRDDef($stat_task_id, $rrdDef);
     }
 }