From 6e217d70d969b0ace4d746256f8e80e27af62df6 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 2 Oct 2023 18:44:04 -0700 Subject: [PATCH] Queue - Extract method getStatus() --- CRM/Queue/Queue.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CRM/Queue/Queue.php b/CRM/Queue/Queue.php index 8637957b8e..a7774f20d9 100644 --- a/CRM/Queue/Queue.php +++ b/CRM/Queue/Queue.php @@ -59,6 +59,15 @@ abstract class CRM_Queue_Queue { * @throws \CRM_Core_Exception */ public function isActive(): bool { + return ($this->getStatus() === 'active'); + } + + /** + * @return string|null + * @throws \CRM_Core_Exception + * @see \CRM_Queue_BAO_Queue::getStatuses() + */ + public function getStatus() { // Queues work with concurrent processes. We want to make sure status info is up-to-date (never cached). $status = CRM_Core_DAO::getFieldValue('CRM_Queue_DAO_Queue', $this->_name, 'status', 'name', TRUE); if ($status === 'active') { @@ -72,7 +81,7 @@ abstract class CRM_Queue_Queue { CRM_Utils_Hook::queueActive($status, $this->getName(), $this->queueSpec); // Note in future we might want to consider whether an upgrade is in progress. // Should we set the setting at that point? - return ($status === 'active'); + return $status; } /** -- 2.25.1