Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
queue_ui
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
queue_ui
Commits
3c6f01be
Commit
3c6f01be
authored
9 years ago
by
Florian Loretan
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2594549
: Update cron integration to match current API
parent
8999a221
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
queue_ui.module
+9
-18
9 additions, 18 deletions
queue_ui.module
with
9 additions
and
18 deletions
queue_ui.module
+
9
−
18
View file @
3c6f01be
...
...
@@ -159,25 +159,16 @@ function queue_ui_defined_queues() {
}
/**
*
Implements hook_cron
()
.
*
hook_queue_info_alter
()
*/
function
queue_ui_cron
()
{
// Retrieve queues set for cron processing.
$defs
=
queue_ui_defined_queues
();
if
(
!
empty
(
$defs
))
{
foreach
(
$defs
as
$name
=>
$definition
)
{
$queue
=
Drupal
::
queue
(
$name
);
// A cron callback must be defined and there must be items in the queue.
if
(
isset
(
$definition
[
'cron'
])
&&
is_object
(
$queue
)
&&
$queue
->
numberOfItems
())
{
$active
=
variable_get
(
'queue_ui_cron_'
.
$name
,
FALSE
);
if
(
$active
)
{
// Pass $queue to cron callback for processing.
$function
=
$definition
[
'cron'
][
'callback'
];
// Definitions can define arguments.
$args
=
isset
(
$definition
[
'cron'
][
'callback'
])
?
$definition
[
'cron'
][
'callback'
]
:
NULL
;
$function
(
$queue
,
$args
);
}
}
function
queue_ui_queue_info_alter
(
&
$queues
)
{
foreach
(
$queues
as
$queue_name
=>
$definition
)
{
// Check if a time limit override exists for this queue.
$time_limit
=
\Drupal
::
state
()
->
get
(
'queue_ui_cron_'
.
$queue_name
);
if
(
!
is_null
(
$time_limit
))
{
// Override the original definition.
$queues
[
$queue_name
][
'cron'
][
'time'
]
=
$time_limit
;
}
}
}
...
...
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