public function RadioactivityFileIncidentStorage::processIncidents in Radioactivity 7.2
Process incidents in the deferred queue
Overrides RadioactivityIncidentStorage::processIncidents
File
- includes/
RadioactivityFileIncidentStorage.inc, line 34 - File incident storage class
Class
- RadioactivityFileIncidentStorage
- @file File incident storage class
Code
public function processIncidents() {
// file incidents are all in the same storage so we'll do this only once
// even though there might be many fields
if (self::$cronDone) {
return;
}
self::$cronDone = TRUE;
$tmp = VAR_RADIOACTIVITY_TEMP_DIR;
$file = $tmp . "/radioactivity-payload.txt";
if (file_exists($file)) {
// get file contents and clear file
$fh = fopen($file, "r");
$data = fread($fh, filesize($file));
fclose($fh);
unlink($file);
$data = explode(PHP_EOL, $data);
foreach ($data as $row) {
if (empty($row)) {
continue;
}
$incident = unserialize($row);
$incident
->updateEnergy();
}
}
}