You are here

public function RadioactivityDeferredIncidentStorage::processIncidents in Radioactivity 7.2

Process incidents in the deferred queue

Overrides RadioactivityIncidentStorage::processIncidents

File

includes/RadioactivityDeferredIncidentStorage.inc, line 26
Deferred incident storage class

Class

RadioactivityDeferredIncidentStorage
@file Deferred incident storage class

Code

public function processIncidents() {

  // grab rows from table and push them to fields
  $query = db_select("radioactivity_deferred_incidents", "rds")
    ->fields("rds", array(
    "data",
  ));
  $result = $query
    ->execute();
  while ($row = $result
    ->fetch()) {
    $incident = unserialize($row->data);
    if ($incident
      ->floodCheck()) {
      $incident
        ->updateEnergy();
    }
  }

  // Flush the processed entries from the db
  db_delete("radioactivity_deferred_incidents")
    ->execute();
}