public function ContentController::getStatusMessages in Heartbeat 8
File
- modules/
statusmessage/ src/ Controller/ ContentController.php, line 78
Class
- ContentController
- Class ContentController.
Namespace
Drupal\statusmessage\ControllerCode
public function getStatusMessages() {
$data = file_get_contents("public://statusmessages.dat");
$statusmessages = unserialize($data);
$errors = false;
if (is_array($statusmessages)) {
$statusmessages = array_reverse($statusmessages);
foreach ($statusmessages as $statusMessage) {
if ($statusMessage instanceof \Drupal\statusmessage\Entity\Status) {
// try {
// $heartbeat->save();
// } catch (\Exception $e) {
// $message = $e->getMessage();
// }
// }
$status = Status::create([]);
if (!$status
->save()) {
$errors = true;
}
}
}
}
$result = $errors ? 'Error restoring statusmessages' : 'statusmessages restored';
return [
'#type' => 'markup',
'#markup' => $this
->t($result),
];
}