Skip to content

Commit

Permalink
Make flexmailer mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Dec 4, 2022
1 parent 3e31d94 commit 67575d3
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 106 deletions.
1 change: 1 addition & 0 deletions CRM/Upgrade/Incremental/php/FiveFiftySeven.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CRM_Upgrade_Incremental_php_FiveFiftySeven extends CRM_Upgrade_Incremental
public function upgrade_5_57_alpha1($rev): void {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addExtensionTask('Enable SearchKit extension', ['org.civicrm.search_kit'], 1100);
$this->addExtensionTask('Enable Flexmailer extension', ['org.civicrm.flexmailer']);
}

}
25 changes: 0 additions & 25 deletions api/v3/examples/Setting/GetFields.ex.php
Original file line number Diff line number Diff line change
Expand Up @@ -3256,31 +3256,6 @@ function setting_getfields_expectedresult() {
'0' => 'financialacls_toggle',
],
],
'flexmailer_traditional' => [
'group_name' => 'Flexmailer Preferences',
'group' => 'flexmailer',
'name' => 'flexmailer_traditional',
'type' => 'String',
'html_type' => 'select',
'html_attributes' => [
'class' => 'crm-select2',
],
'pseudoconstant' => [
'callback' => '_flexmailer_traditional_options',
],
'default' => 'auto',
'add' => '5.13',
'title' => 'Traditional Mailing Handler',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'For greater backward-compatibility, process \"<code>traditional</code>\" mailings with the CiviMail\'s hard-coded BAO.<br/>For greater forward-compatibility, process \"<code>traditional</code>\" mailings with Flexmailer\'s extensible pipeline.',
'help_text' => '',
'settings_pages' => [
'flexmailer' => [
'weight' => 5,
],
],
],
'recaptchaPublicKey' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
Expand Down
3 changes: 3 additions & 0 deletions ext/flexmailer/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<compatibility>
<ver>5.57</ver>
</compatibility>
<tags>
<tag>mgmt:required</tag>
</tags>
<classloader>
<psr4 prefix="Civi\FlexMailer\" path="src"/>
</classloader>
Expand Down
28 changes: 0 additions & 28 deletions ext/flexmailer/settings/flexmailer.setting.php

This file was deleted.

13 changes: 1 addition & 12 deletions ext/flexmailer/src/Listener/Abdicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,7 @@ public static function isFlexmailPreferred($mailing) {
if ($mailing->template_type && $mailing->template_type !== 'traditional') {
return TRUE;
}

switch (\Civi::settings()->get('flexmailer_traditional')) {
case 'bao':
return FALSE;

case 'auto':
case 'flexmailer':
return TRUE;

default:
throw new \RuntimeException("Unrecognized value for setting 'flexmailer_traditional'");
}
return TRUE;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function setUp(): void {
}

parent::setUp();
\Civi::settings()->set('flexmailer_traditional', 'flexmailer');
}

public function getHrefExamples() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function setUp(): void {
}

parent::setUp();
\Civi::settings()->set('flexmailer_traditional', 'flexmailer');
}

public function getHrefExamples() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ public function setUp(): void {
}

parent::setUp();

\Civi::settings()->set('flexmailer_traditional', 'flexmailer');
}

public function tearDown(): void {
// We're building on someone else's test and don't fully trust them to
// protect our settings. Make sure they did.
$ok = ('flexmailer' == \Civi::settings()->get('flexmailer_traditional'))
&& ('s:10:"flexmailer";' === \CRM_Core_DAO::singleValueQuery('SELECT value FROM civicrm_setting WHERE name ="flexmailer_traditional"'));

parent::tearDown();

$this->assertTrue($ok, 'FlexMailer remained active during testing');
}

// ---- Boilerplate ----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function setUp(): void {
}

parent::setUp();
\Civi::settings()->set('flexmailer_traditional', 'flexmailer');

$dispatcher = \Civi::service('dispatcher');
foreach (FlexMailer::getEventTypes() as $event => $class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public function setUp(): void {

parent::setUp();

\Civi::settings()->set('flexmailer_traditional', 'flexmailer');

$this->useTransaction();
// DGW
\CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function setUp(): void {
}

parent::setUp();
\Civi::settings()->set('flexmailer_traditional', 'flexmailer');
}

public function getExamples() {
Expand Down
11 changes: 0 additions & 11 deletions ext/flexmailer/xml/Menu/flexmailer.xml

This file was deleted.

15 changes: 4 additions & 11 deletions tests/phpunit/CRM/Mailing/MailingSystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,16 @@ class CRM_Mailing_MailingSystemTest extends CRM_Mailing_BaseMailingSystemTest {
*/
public function setUp(): void {
parent::setUp();
// If we happen to execute with flexmailer active, use BAO mode.
// There is a parallel FlexMailerSystemTest which runs in flexmailer mode.
Civi::settings()->add(['flexmailer_traditional' => 'bao']);

$hooks = \CRM_Utils_Hook::singleton();
$hooks->setHook('civicrm_alterMailParams',
[$this, 'hook_alterMailParams']);
error_reporting(E_ALL && !E_USER_DEPRECATED);
}

/**
* @see CRM_Utils_Hook::alterMailParams
*/
public function hook_alterMailParams(&$params, $context = NULL): void {
public function hook_alterMailParams(): void {
$this->counts['hook_alterMailParams'] = 1;
if ($this->checkMailParamsContext) {
$this->assertEquals('civimail', $context);
}
}

/**
Expand All @@ -90,6 +82,7 @@ public function testMailerPreviewExtraScheme(): void {
$this->assertNotEmpty($displayName);

$params = $this->_params;
/** @noinspection HttpUrlsUsage */
$params['body_html'] = '<a href="http://{action.forward}">Forward this email written in ckeditor</a>';
$params['api.Mailing.preview'] = [
'id' => '$value.id',
Expand Down Expand Up @@ -119,7 +112,7 @@ public function testUrlTracking(
$htmlUrlRegex,
$textUrlRegex,
$params
) {
): void {
parent::testUrlTracking($inputHtml, $htmlUrlRegex, $textUrlRegex, $params);
}

Expand Down Expand Up @@ -258,7 +251,7 @@ public function multiLingual() {
* @dataProvider multiLingual
*
*/
public function testGitLabIssue1108($isMultiLingual) {
public function testGitLabIssue1108($isMultiLingual): void {

// We need to make sure the mailing IDs are higher than the groupIDs.
// We do this by adding mailings until the mailing.id value is at least 10
Expand Down

0 comments on commit 67575d3

Please sign in to comment.