Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
codit_batch_operations
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
codit_batch_operations
Commits
9dbc681b
Commit
9dbc681b
authored
4 months ago
by
Steve Wirt
Browse files
Options
Downloads
Patches
Plain Diff
#3482565
Resolve error for when default user is not set.
parent
ec9c63ff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!27
#3482565 Resolve error for when default user is not set.
Pipeline
#319688
passed with warnings
4 months ago
Stage: build
Stage: validate
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/BatchOperations.php
+6
-5
6 additions, 5 deletions
src/BatchOperations.php
with
6 additions
and
5 deletions
src/BatchOperations.php
+
6
−
5
View file @
9dbc681b
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment