civicrm / org.civicrm.flexmailer

FlexMailer is now part of civicrm-core. Please see the link below for how to upgrade.
https://civicrm.org/extensions/flexmailer
Other
5 stars 22 forks source link

OpenTracker - Create URL via CRM_Utils_System::externUrl() #56

Closed totten closed 4 years ago

totten commented 4 years ago

This aims to improve cooperation between flexmailer, civicrm-wordpress:wp-rest/, and https://github.com/civicrm/civicrm-core/pull/17312 -- so that flexmailer produces compliant URLs.

Before

The open-tracking URL is constructed as a reference to the standalone script extern/open.php using certain $config properties.

It always links to the standalone script, even if you have a different end-point available (e.g. civicrm/mailing/open or civicrm-wordpress:wp-rest/).

After

On Civi v5.23+, it uses CRM_Utils_System::externUrl() API to request the full URL of extern/open. Flexmailer is no longer responsible for figuring the URL, and other agents (via hook_civicrm_alterExternUrl) can do so.

On Civi v5.22 and earlier, it continues using the same old formula. This provides drop-in/bug-level-compatibility on older versions. This can be removed in a couple months.

Comments

I suspect this also fixes dev/mail#17, wherein the open tracker has flawed URLs in certain multilingual configurations. However, I can't confirm for certain because I don't have that configuration.

But just to game this out...

Either way, addressing dev/mail#17 shouldn't require any further change in flexmailer.

totten commented 4 years ago

This was originally written/tested on roughly civicrm-core@master.

I decided to give it a whirl on 5.21 as well -- and needed to fix the compatibility test (is_callable(...) => version_compare(...) per c4f95e1). However, after fixing that, the test-suite looked good on 5.21, and I was able to successfully send a mailing via Mosaico and track the opens/click-throughs.

I guess we just need to wait for the new test run on civicrm-core@master with the updated patch.