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
Merge requests
!59
Issue
#3519846
: Support OOP hooks
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3519846
: Support OOP hooks
issue/queue_ui-3519846:3519846-support-oop-hooks
into
3.2.x
Overview
4
Commits
6
Pipelines
6
Changes
3
All threads resolved!
Show all comments
Open
Robbe Saelens
requested to merge
issue/queue_ui-3519846:3519846-support-oop-hooks
into
3.2.x
1 month ago
Overview
4
Commits
6
Pipelines
6
Changes
3
All threads resolved!
Show all comments
Expand
Closes
#3519846
0
0
Merge request reports
Compare
3.2.x
version 5
bbeecfbb
1 month ago
version 4
6f74cd12
1 month ago
version 3
c2d8220e
1 month ago
version 2
99d6f188
1 month ago
version 1
b2603615
1 month ago
3.2.x (HEAD)
and
latest version
latest version
550cb07e
6 commits,
1 month ago
version 5
bbeecfbb
5 commits,
1 month ago
version 4
6f74cd12
4 commits,
1 month ago
version 3
c2d8220e
3 commits,
1 month ago
version 2
99d6f188
2 commits,
1 month ago
version 1
b2603615
1 commit,
1 month ago
3 files
+
67
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/Hook/AlterHooks.php
0 → 100644
+
57
−
0
Options
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\queue_ui\Hook
;
use
Drupal\Core\State\StateInterface
;
use
Drupal\Core\Hook\Attribute\Hook
;
/**
* Class for the queue_ui alter hooks.
*/
class
AlterHooks
{
/**
* The state service.
*
* @var \Drupal\Core\State\StateInterface
*/
protected
StateInterface
$state
;
/**
* Constructor to inject the state service.
*
* @param \Drupal\Core\State\StateInterface $state
* The state service.
*/
public
function
__construct
(
StateInterface
$state
)
{
$this
->
state
=
$state
;
}
/**
* Hook_queue_info_alter()
*/
#[Hook('queue_info_alter')]
public
function
queueInfoAlter
(
&
$queues
,
$method
)
{
foreach
(
$queues
as
$queueName
=>
$definition
)
{
// Check if a time limit override exists for this queue.
$time_limit
=
$this
->
state
->
get
(
'queue_ui_cron_'
.
$queueName
);
if
(
$time_limit
===
NULL
)
{
// Queue UI didn't manage this queue yet.
continue
;
}
$time_limit
=
(
string
)
$time_limit
;
// Check for the value including 0.
if
(
$time_limit
!==
''
)
{
// Override the original definition.
$queues
[
$queueName
][
'cron'
][
'time'
]
=
(
int
)
$time_limit
;
}
else
{
// Disable cron.
unset
(
$queues
[
$queueName
][
'cron'
]);
}
}
}
}
Loading