diff --git a/CRM/Upgrade/Incremental/php/FiveFiftySeven.php b/CRM/Upgrade/Incremental/php/FiveFiftySeven.php index 33afb62b0ef5..32a0260432f6 100644 --- a/CRM/Upgrade/Incremental/php/FiveFiftySeven.php +++ b/CRM/Upgrade/Incremental/php/FiveFiftySeven.php @@ -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']); } } diff --git a/api/v3/examples/Setting/GetFields.ex.php b/api/v3/examples/Setting/GetFields.ex.php index ee1e78de0e29..fae8b857561f 100644 --- a/api/v3/examples/Setting/GetFields.ex.php +++ b/api/v3/examples/Setting/GetFields.ex.php @@ -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', diff --git a/ext/flexmailer/info.xml b/ext/flexmailer/info.xml index c725f129e8e9..11c28e751110 100644 --- a/ext/flexmailer/info.xml +++ b/ext/flexmailer/info.xml @@ -25,6 +25,9 @@ <compatibility> <ver>5.57</ver> </compatibility> + <tags> + <tag>mgmt:required</tag> + </tags> <classloader> <psr4 prefix="Civi\FlexMailer\" path="src"/> </classloader> diff --git a/ext/flexmailer/settings/flexmailer.setting.php b/ext/flexmailer/settings/flexmailer.setting.php deleted file mode 100644 index ea227d9ef0f6..000000000000 --- a/ext/flexmailer/settings/flexmailer.setting.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -use CRM_Flexmailer_ExtensionUtil as E; - -return [ - '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' => E::ts('Traditional Mailing Handler'), - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => E::ts('For greater backward-compatibility, process "<code>traditional</code>" mailings with the CiviMail\'s hard-coded BAO.') . '<br/>' - . E::ts('For greater forward-compatibility, process "<code>traditional</code>" mailings with Flexmailer\'s extensible pipeline.'), - 'help_text' => NULL, - 'settings_pages' => [ - 'flexmailer' => [ - 'weight' => 5, - ], - ], - ], -]; diff --git a/ext/flexmailer/src/Listener/Abdicator.php b/ext/flexmailer/src/Listener/Abdicator.php index b237d5899e6e..dd42953b3d63 100644 --- a/ext/flexmailer/src/Listener/Abdicator.php +++ b/ext/flexmailer/src/Listener/Abdicator.php @@ -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; } /** diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php index 082e2c0f76ac..4533fdaecdb6 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php @@ -27,7 +27,6 @@ public function setUp(): void { } parent::setUp(); - \Civi::settings()->set('flexmailer_traditional', 'flexmailer'); } public function getHrefExamples() { diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php index 64f8b7f8c08d..db9653748549 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php @@ -27,7 +27,6 @@ public function setUp(): void { } parent::setUp(); - \Civi::settings()->set('flexmailer_traditional', 'flexmailer'); } public function getHrefExamples() { diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php index 69a496fa6abf..f9f6061b3f1b 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php @@ -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 ---- diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php index a104bf12d2f7..e2bb57681b18 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php @@ -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) { diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php index a12ddad7c576..f15d8dffeb2e 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php @@ -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; diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php index 642d4527b246..58e81083096e 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php @@ -25,7 +25,6 @@ public function setUp(): void { } parent::setUp(); - \Civi::settings()->set('flexmailer_traditional', 'flexmailer'); } public function getExamples() { diff --git a/ext/flexmailer/xml/Menu/flexmailer.xml b/ext/flexmailer/xml/Menu/flexmailer.xml deleted file mode 100644 index 605cfa1228e7..000000000000 --- a/ext/flexmailer/xml/Menu/flexmailer.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<menu> - <item> - <path>civicrm/admin/setting/flexmailer</path> - <page_callback>CRM_Admin_Form_Generic</page_callback> - <title>Flexmailer Settings</title> - <adminGroup>CiviMail</adminGroup> - <icon>admin/small/Profile.png</icon> - <access_arguments>administer CiviCRM</access_arguments> - </item> -</menu> diff --git a/tests/phpunit/CRM/Mailing/MailingSystemTest.php b/tests/phpunit/CRM/Mailing/MailingSystemTest.php index 0929dbb629f6..d5209996e315 100644 --- a/tests/phpunit/CRM/Mailing/MailingSystemTest.php +++ b/tests/phpunit/CRM/Mailing/MailingSystemTest.php @@ -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); - } } /** @@ -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', @@ -119,7 +112,7 @@ public function testUrlTracking( $htmlUrlRegex, $textUrlRegex, $params - ) { + ): void { parent::testUrlTracking($inputHtml, $htmlUrlRegex, $textUrlRegex, $params); } @@ -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