You are here

class RadioactivityDeferredIncidentStorage in Radioactivity 7.2

@file Deferred incident storage class

Hierarchy

Expanded class hierarchy of RadioactivityDeferredIncidentStorage

File

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

View source
class RadioactivityDeferredIncidentStorage extends RadioactivityIncidentStorage {

  /**
   * Constructor
   */
  public function __construct() {
  }

  /**
   * add incident to the deferred storage
   * @entity_energy energy by entity id
   */
  public function addIncident(RadioactivityIncident $incident) {
    db_insert('radioactivity_deferred_incidents')
      ->fields(array(
      'data' => serialize($incident),
    ))
      ->execute();
  }

  /**
   * Process incidents in the deferred queue
   */
  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();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RadioactivityDeferredIncidentStorage::addIncident public function add incident to the deferred storage @entity_energy energy by entity id Overrides RadioactivityIncidentStorage::addIncident
RadioactivityDeferredIncidentStorage::processIncidents public function Process incidents in the deferred queue Overrides RadioactivityIncidentStorage::processIncidents
RadioactivityDeferredIncidentStorage::__construct public function Constructor Overrides RadioactivityIncidentStorage::__construct
RadioactivityIncidentStorage::getDecayProfile public function Get decay profile attached to this instance
RadioactivityIncidentStorage::requiresBootstrap public function Does this require boostrapping? 3