Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0
This commit is contained in:
parent
2f563ab520
commit
f1c8716f57
1732 changed files with 52334 additions and 11780 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\Core;
|
||||
|
||||
use Drupal\Component\Utility\Timer;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\Core\Queue\QueueWorkerManagerInterface;
|
||||
use Drupal\Core\Queue\RequeueException;
|
||||
|
@ -82,7 +83,7 @@ class Cron implements CronInterface {
|
|||
* The account switching service.
|
||||
* @param \Psr\Log\LoggerInterface $logger
|
||||
* A logger instance.
|
||||
* @param \Drupal\Core\Queue\QueueWorkerManagerInterface
|
||||
* @param \Drupal\Core\Queue\QueueWorkerManagerInterface $queue_manager
|
||||
* The queue plugin manager.
|
||||
*/
|
||||
public function __construct(ModuleHandlerInterface $module_handler, LockBackendInterface $lock, QueueFactory $queue_factory, StateInterface $state, AccountSwitcherInterface $account_switcher, LoggerInterface $logger, QueueWorkerManagerInterface $queue_manager) {
|
||||
|
@ -193,8 +194,25 @@ class Cron implements CronInterface {
|
|||
* Invokes any cron handlers implementing hook_cron.
|
||||
*/
|
||||
protected function invokeCronHandlers() {
|
||||
$module_previous = '';
|
||||
|
||||
// Iterate through the modules calling their cron handlers (if any):
|
||||
foreach ($this->moduleHandler->getImplementations('cron') as $module) {
|
||||
|
||||
if (!$module_previous) {
|
||||
$this->logger->notice('Starting execution of @module_cron().', [
|
||||
'@module' => $module,
|
||||
]);
|
||||
}
|
||||
else {
|
||||
$this->logger->notice('Starting execution of @module_cron(), execution of @module_previous_cron() took @time.', [
|
||||
'@module' => $module,
|
||||
'@module_previous' => $module_previous,
|
||||
'@time' => Timer::read('cron_' . $module_previous) . 'ms',
|
||||
]);
|
||||
}
|
||||
Timer::start('cron_' . $module);
|
||||
|
||||
// Do not let an exception thrown by one module disturb another.
|
||||
try {
|
||||
$this->moduleHandler->invoke($module, 'cron');
|
||||
|
@ -202,6 +220,15 @@ class Cron implements CronInterface {
|
|||
catch (\Exception $e) {
|
||||
watchdog_exception('cron', $e);
|
||||
}
|
||||
|
||||
Timer::stop('cron_' . $module);
|
||||
$module_previous = $module;
|
||||
}
|
||||
if ($module_previous) {
|
||||
$this->logger->notice('Execution of @module_previous_cron() took @time.', [
|
||||
'@module_previous' => $module_previous,
|
||||
'@time' => Timer::read('cron_' . $module_previous) . 'ms',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue