class Cron in Anti Spam by CleanTalk 9.1.x
Same name in this branch
- 9.1.x src/lib/Cleantalk/Common/Cron.php \Cleantalk\Common\Cron
- 9.1.x src/lib/Cleantalk/ApbctDrupal/Cron.php \Cleantalk\ApbctDrupal\Cron
Same name and namespace in other branches
- 8.4 src/lib/Cleantalk/ApbctDrupal/Cron.php \Cleantalk\ApbctDrupal\Cron
Hierarchy
Expanded class hierarchy of Cron
2 files declare their use of Cron
- BootSubscriber.php in src/
EventSubscriber/ BootSubscriber.php - CleantalkFuncs.php in src/
CleantalkFuncs.php
File
- src/
lib/ Cleantalk/ ApbctDrupal/ Cron.php, line 5
Namespace
Cleantalk\ApbctDrupalView source
class Cron extends \Cleantalk\Common\Cron {
public function saveTasks($tasks) {
\Drupal::state()
->set($this->cron_option_name, array(
'last_start' => time(),
'tasks' => $tasks,
));
}
/**
* Getting all tasks
*
* @return array
*/
public function getTasks() {
$cron = \Drupal::state()
->get($this->cron_option_name);
return !empty($cron) && isset($cron['tasks']) ? $cron['tasks'] : null;
}
/**
* Save option with tasks
*
* @return int timestamp
*/
public function getCronLastStart() {
$cron = \Drupal::state()
->get($this->cron_option_name);
return !empty($cron) && isset($cron['last_start']) ? $cron['last_start'] : 0;
}
/**
* Save timestamp of running Cron.
*
* @return bool
*/
public function setCronLastStart() {
\Drupal::state()
->set($this->cron_option_name, array(
'last_start' => time(),
'tasks' => $this
->getTasks(),
));
return true;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Cron:: |
protected | property | ||
Cron:: |
protected | property | ||
Cron:: |
public | property | ||
Cron:: |
protected | property | ||
Cron:: |
protected | property | ||
Cron:: |
protected | property | ||
Cron:: |
public | function | Adding new cron task. | |
Cron:: |
public | function | Getting tasks which should be run | |
Cron:: |
public | function |
Save option with tasks Overrides Cron:: |
|
Cron:: |
public | function | Get cron option name | |
Cron:: |
public | function |
Getting all tasks Overrides Cron:: |
|
Cron:: |
public | function | Removing cron task | |
Cron:: |
public | function | Run all tasks from $this->tasks_to_run. Saving all results to (array) $this->tasks_completed | |
Cron:: |
public | function |
Save option with tasks Overrides Cron:: |
|
Cron:: |
public | function |
Save timestamp of running Cron. Overrides Cron:: |
|
Cron:: |
public | function | Updates cron task, create task if not exists. | |
Cron:: |
public | function | Cron constructor. Getting tasks option. |