Skip to content
Snippets Groups Projects
Commit 2c97ee4d authored by herbdool's avatar herbdool
Browse files

#4127 move mailing workflow check to userSystem

parent 33d79f57
Branches
Tags
No related merge requests found
......@@ -159,21 +159,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
*/
public static function workflowEnabled() {
$config = CRM_Core_Config::singleton();
// early exit, since not true for most
if (!$config->userSystem->is_drupal ||
!function_exists('module_exists')
) {
return FALSE;
}
if (!module_exists('rules')) {
return FALSE;
}
$enableWorkflow = Civi::settings()->get('civimail_workflow');
return $enableWorkflow && $config->userSystem->is_drupal;
return $config->userSystem->mailingWorkflowIsEnabled();
}
/**
......
......@@ -1152,4 +1152,13 @@ abstract class CRM_Utils_System_Base {
return $_SERVER['REMOTE_ADDR'] ?? NULL;
}
/**
* Check if mailing workflow is enabled
*
* @return bool
*/
public function mailingWorkflowIsEnabled():bool {
return FALSE;
}
}
......@@ -932,4 +932,17 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
return class_exists('Drupal') ? \Drupal::request()->getClientIp() : ($_SERVER['REMOTE_ADDR'] ?? NULL);
}
/**
* @inheritdoc
*/
public function mailingWorkflowIsEnabled():bool {
if (!\Drupal::moduleHandler()->moduleExists('rules')) {
return FALSE;
}
$enableWorkflow = Civi::settings()->get('civimail_workflow');
return (bool) $enableWorkflow;
}
}
......@@ -763,4 +763,17 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base {
return $emailName;
}
/**
* @inheritdoc
*/
public function mailingWorkflowIsEnabled():bool {
if (!module_exists('rules')) {
return FALSE;
}
$enableWorkflow = Civi::settings()->get('civimail_workflow');
return (bool) $enableWorkflow;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment