function Cron::__construct
Same name in this branch
- 10 core/lib/Drupal/Core/ProxyClass/Cron.php \Drupal\Core\ProxyClass\Cron::__construct()
Same name in other branches
- 9 core/lib/Drupal/Core/ProxyClass/Cron.php \Drupal\Core\ProxyClass\Cron::__construct()
- 9 core/lib/Drupal/Core/Cron.php \Drupal\Core\Cron::__construct()
- 8.9.x core/lib/Drupal/Core/ProxyClass/Cron.php \Drupal\Core\ProxyClass\Cron::__construct()
- 8.9.x core/lib/Drupal/Core/Cron.php \Drupal\Core\Cron::__construct()
- 11.x core/lib/Drupal/Core/ProxyClass/Cron.php \Drupal\Core\ProxyClass\Cron::__construct()
- 11.x core/lib/Drupal/Core/Cron.php \Drupal\Core\Cron::__construct()
Constructs a cron object.
Parameters
\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler
\Drupal\Core\Lock\LockBackendInterface $lock: The lock service.
\Drupal\Core\Queue\QueueFactory $queue_factory: The queue service.
\Drupal\Core\State\StateInterface $state: The state service.
\Drupal\Core\Session\AccountSwitcherInterface $account_switcher: The account switching service.
\Psr\Log\LoggerInterface $logger: A logger instance.
\Drupal\Core\Queue\QueueWorkerManagerInterface $queue_manager: The queue plugin manager.
\Drupal\Component\Datetime\TimeInterface|null $time: The time service.
mixed[]|null $queue_config: Queue configuration from the service container.
File
-
core/
lib/ Drupal/ Core/ Cron.php, line 115
Class
- Cron
- The Drupal core Cron service.
Namespace
Drupal\CoreCode
public function __construct(ModuleHandlerInterface $module_handler, LockBackendInterface $lock, QueueFactory $queue_factory, StateInterface $state, AccountSwitcherInterface $account_switcher, LoggerInterface $logger, QueueWorkerManagerInterface $queue_manager, ?TimeInterface $time = NULL, ?array $queue_config = NULL) {
$this->moduleHandler = $module_handler;
$this->lock = $lock;
$this->queueFactory = $queue_factory;
$this->state = $state;
$this->accountSwitcher = $account_switcher;
$this->logger = $logger;
$this->queueManager = $queue_manager;
if (!isset($time)) {
@trigger_error('Calling ' . __METHOD__ . '() without the $time argument is deprecated in drupal:10.1.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3343743', E_USER_DEPRECATED);
$time = \Drupal::service('datetime.time');
}
$this->time = $time;
if (!isset($queue_config)) {
@trigger_error('Calling ' . __METHOD__ . '() without the $queue_config argument is deprecated in drupal:10.1.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3343743', E_USER_DEPRECATED);
$queue_config = \Drupal::getContainer()->getParameter('queue.config');
}
$this->queueConfig = $queue_config + [
'suspendMaximumWait' => 30.0,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.