Skip to content
Snippets Groups Projects
Commit 9dbc681b authored by Steve Wirt's avatar Steve Wirt
Browse files

#3482565 Resolve error for when default user is not set.

parent ec9c63ff
No related branches found
No related tags found
1 merge request!27#3482565 Resolve error for when default user is not set.
Pipeline #319688 passed with warnings
......@@ -2,9 +2,9 @@
namespace Drupal\codit_batch_operations;
use Drupal\codit_batch_operations\Cron\CronManager;
use Drupal\codit_batch_operations\Entity\BatchOpLog;
use Drupal\codit_batch_operations\Entity\BatchOpLogInterface;
use Drupal\codit_batch_operations\Cron\CronManager;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
......@@ -218,7 +218,8 @@ class BatchOperations implements ContainerInjectionInterface {
public function getUser(): int {
if (empty($this->user)) {
// Not explicitly set, so get it from config.
$default_user_id = ($this->cboConfig->get('default_user')) ? $this->cboConfig->get('default_user') : 0;
// If not set, default to user 1.
$default_user_id = ($this->cboConfig->get('default_user')) ? $this->cboConfig->get('default_user') : 1;
$this->setUser($default_user_id);
}
return $this->user;
......@@ -373,7 +374,7 @@ class BatchOperations implements ContainerInjectionInterface {
// This is as far as we can go, so shutdown the tracking.
$this->state->delete(self::RUNNING_KEY);
if(empty($sandbox['executor'] === 'cron')) {
if (empty($sandbox['executor'] === 'cron')) {
// Not run by cron, so unravel user switching.
$this->switchBackToOriginalUser();
}
......@@ -578,7 +579,7 @@ class BatchOperations implements ContainerInjectionInterface {
$vars['link'] = $link->toString();
$this->logger->info("$logged_message </br> $summary", $vars);
if(empty($sandbox['executor'] === 'cron')) {
if (empty($sandbox['executor'] === 'cron')) {
// Not run by cron, so unravel user switching.
$this->switchBackToOriginalUser();
}
......@@ -874,7 +875,7 @@ class BatchOperations implements ContainerInjectionInterface {
* The string including date & time, and the chron timing that caused it.
*/
public function getNextCronShouldRun(): string {
$cron_timings = (array)$this->getCronTiming();
$cron_timings = (array) $this->getCronTiming();
$future_dates = [];
foreach ($cron_timings as $cron_timing) {
$cron_manager = new CronManager($this->getShortName(), $cron_timing, $this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment