Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Cron.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Core; | 3 namespace Drupal\Core; |
4 | 4 |
5 use Drupal\Component\Datetime\TimeInterface; | 5 use Drupal\Component\Datetime\TimeInterface; |
6 use Drupal\Component\Utility\Environment; | |
6 use Drupal\Component\Utility\Timer; | 7 use Drupal\Component\Utility\Timer; |
7 use Drupal\Core\Extension\ModuleHandlerInterface; | 8 use Drupal\Core\Extension\ModuleHandlerInterface; |
9 use Drupal\Core\Lock\LockBackendInterface; | |
10 use Drupal\Core\Queue\QueueFactory; | |
8 use Drupal\Core\Queue\QueueWorkerManagerInterface; | 11 use Drupal\Core\Queue\QueueWorkerManagerInterface; |
9 use Drupal\Core\Queue\RequeueException; | 12 use Drupal\Core\Queue\RequeueException; |
13 use Drupal\Core\Queue\SuspendQueueException; | |
14 use Drupal\Core\Session\AccountSwitcherInterface; | |
15 use Drupal\Core\Session\AnonymousUserSession; | |
10 use Drupal\Core\State\StateInterface; | 16 use Drupal\Core\State\StateInterface; |
11 use Drupal\Core\Lock\LockBackendInterface; | |
12 use Drupal\Core\Queue\QueueFactory; | |
13 use Drupal\Core\Session\AnonymousUserSession; | |
14 use Drupal\Core\Session\AccountSwitcherInterface; | |
15 use Drupal\Core\Queue\SuspendQueueException; | |
16 use Psr\Log\LoggerInterface; | 17 use Psr\Log\LoggerInterface; |
17 use Psr\Log\NullLogger; | 18 use Psr\Log\NullLogger; |
18 | 19 |
19 /** | 20 /** |
20 * The Drupal core Cron service. | 21 * The Drupal core Cron service. |
118 // Force the current user to anonymous to ensure consistent permissions on | 119 // Force the current user to anonymous to ensure consistent permissions on |
119 // cron runs. | 120 // cron runs. |
120 $this->accountSwitcher->switchTo(new AnonymousUserSession()); | 121 $this->accountSwitcher->switchTo(new AnonymousUserSession()); |
121 | 122 |
122 // Try to allocate enough time to run all the hook_cron implementations. | 123 // Try to allocate enough time to run all the hook_cron implementations. |
123 drupal_set_time_limit(240); | 124 Environment::setTimeLimit(240); |
124 | 125 |
125 $return = FALSE; | 126 $return = FALSE; |
126 | 127 |
127 // Try to acquire cron lock. | 128 // Try to acquire cron lock. |
128 if (!$this->lock->acquire('cron', 900.0)) { | 129 if (!$this->lock->acquire('cron', 900.0)) { |