public function Schedule::setLastRun in Backup and Migrate 5.0.x
Same name and namespace in other branches
- 8.4 src/Entity/Schedule.php \Drupal\backup_migrate\Entity\Schedule::setLastRun()
Store the timestamp for the last time this schedule was run.
Parameters
int $timestamp: The unix time this schedule was last run. 0 means never.
1 call to Schedule::setLastRun()
- Schedule::run in src/
Entity/ Schedule.php - Run the schedule.
File
- src/
Entity/ Schedule.php, line 174
Class
- Schedule
- Defines the Schedule entity.
Namespace
Drupal\backup_migrate\EntityCode
public function setLastRun(int $timestamp) : void {
$name = static::STATE_NAME;
$allLast = $this
->state()
->get($name);
if (empty($timestamp)) {
unset($allLast[$this
->id()]);
}
else {
$allLast[$this
->id()] = $timestamp;
}
if (empty($allLast)) {
$this
->state()
->delete($name);
}
else {
$this
->state()
->set($name, $allLast);
}
}