Closed (fixed)
Project:
CDN
Version:
4.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Dec 2019 at 11:32 UTC
Updated:
26 Dec 2022 at 00:09 UTC
Jump to comment: Most recent, Most recent file
#3071814: Drupal 9 readiness / compatibility added Drupal 9 compatibility. We don't need a new major version for that.
But over time a few pieces of backwards compatibility layers were added. Plus, the browser landscape changed. Finally, core infrastructure improvements would allow this module to become simpler.
preconnect vs dns-prefetch: @todo Remove when http://caniuse.com/link-rel-preconnect has support in all browsers or is equivalent with http://caniuse.com/#feat=link-rel-dns-prefetch\Drupal\cdn\CdnFarfutureController, \Drupal\cdn\PathProcessor\CdnFarfuturePathProcessor and cdn.routing.yml.
8.x-3.x hook_update_N() update hooks plus the associated tests.Parameter $event of method Drupal\cdn\EventSubscriber\HtmlResponseSubscriber::onRespond() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead| Comment | File | Size | Author |
|---|---|---|---|
| #45 | 3103682-45.patch | 55.11 KB | wim leers |
| #45 | interdiff.txt | 1.78 KB | wim leers |
| #43 | 3103682-43.patch | 51.68 KB | wim leers |
| #43 | interdiff.txt | 2.23 KB | wim leers |
| #41 | 3103682-41.patch | 51.76 KB | wim leers |
Comments
Comment #2
wim leersThis patch already implements all the certainties. What's left is bumping the PHP version requirement plus taking advantage of that version bump.
Comment #3
andypostComment #4
wim leersTODO: investigate #3061110-12: Automatically prevent CKEditor from loading from the CDN when far future functionality is enabled.
Comment #5
wim leersSo far, this doesn't buy us much. I think it's probably worth waiting for #2669074: Convert file_create_url() & file_url_transform_relative() to service, deprecate it to land.
Comment #6
wim leersI'm thinking it should
Comment #7
wim leers#2669074: Convert file_create_url() & file_url_transform_relative() to service, deprecate it landed!
Comment #8
wim leersNew:
Comment #9
wim leersNew:
Comment #10
wim leersComment #11
wim leersRebased #2.
Comment #13
wim leersRebased incorrectly.
Comment #15
wim leersGenerated patch incorrectly… This is what I should've uploaded in #13.
Comment #16
wim leersRemove the BC layers added in #3228162: Fix Drupal 9-only deprecation notices while retaining Drupal 8 compatibility and #3194164: Harden against invalid calls to file_create_url(): avoid TypeError in CDN module's code execution.
Comment #17
wim leers😬 Again wrong patch. Clearly I'm used to the merge request workflow at this point…
Comment #18
wim leersWith this disappearing, #2870435-21: Support additional stream wrappers is relevant again. Just to be safe, we should clear all caches when updating. That still won't fix edge caches or reverse proxies, but hopefully 99% of sites will have been on the latest Drupal 8 release for a long time before upgrading. They've already had the chance to do so for over 2 years at this point, because https://www.drupal.org/project/cdn/releases/8.x-3.3 is the first release to include #2870435: Support additional stream wrappers.
However esoteric/edge case-y that may be, taking advantage of #2669074: Convert file_create_url() & file_url_transform_relative() to service, deprecate it will require a container rebuild anyway. So … let's do so.
Comment #19
wim leersDid
Comment #20
wim leersSo … I tried using autowiring, but failed miserably:
I figured that the CDN module's service specifying the type
ConfigFactoryInterfacemakes it impossible for the autowiring to reliably figure out the concrete class.But turns out it's worse. The service ID needs to match the class name. This is … not very useful then. This is also why Drupal core is not yet using it: #3049525: Enable service autowiring by adding interface aliases to core service definitions.
Fortunately, this is the case for at least the
cdn.settingsservice: its FQCN is\Drupal\cdn\CdnSettings. But alas:So … in the end … I was able to autowire a single service: the only service that depends only on CDN module-provided services… because until #3049525: Enable service autowiring by adding interface aliases to core service definitions, this will work for almost no service relying on core services!
Comment #21
wim leersThis makes the CDN module as ready for autowiring as it possibly can be — i.e. it makes the CDN module forward-looking.
Since the CDN module's services never were an API, it's fine for me to rename them without notice. Especially when doing a new major release.
Comment #22
wim leersNow let's finally take advantage of #2669074: Convert file_create_url() & file_url_transform_relative() to service, deprecate it!
This is the minimum set of changes. There are probably refactoring opportunities now, but not yet taking action on those.
Comment #23
wim leersFix PHPCS violations.
Comment #24
wim leers#21 made this change.
(As well as a few others like this, but those have been refactored away in #22 + #23.)
The good news is that this means this use of service locator instead of dependency injection becomes less brittle, because we can use
FQCN::classfor it!Comment #25
wim leersMarking RTBC so we hopefully get auto-retesting…
Comment #26
wim leersComment #27
wim leersOh, and do what the issue title says: require PHP >=8 and Drupal >=9.3 (including Drupal 10!).
Comment #28
wim leershttps://dev.acquia.com/drupal10/deprecation_status/errors?name=cdn%203.x... shows:
That's one more thing we should fix here.
Comment #29
wim leersComment #30
wim leersComment #31
wim leersNote: Drupal 10 might require PHP 8.1: #3223435: Track PHP 8.1 support in hosting and distributions.
Comment #32
wim leersPer #3264819: Require PHP 8.1 for Drupal 10.0.0-alpha2, bumping this to PHP 8.1.
Comment #33
wim leersComment #34
wim leersNote to self: all
strpos(…, …) !== 0andstrpos(…, …) === 0occurrences can also be replaced with https://www.php.net/manual/en/function.str-starts-with.php.Comment #35
wim leersI wrote this in #20:
Good news! #3049525: Enable service autowiring by adding interface aliases to core service definitions just landed in
10.0.x, during RC! 🤩Comment #36
wim leersBlocked on #3326410: Get tests passing again: core changed config export order + comply with drupal/coder >=8.3.16.
#35: Bad news: #3049525: Enable service autowiring by adding interface aliases to core service definitions was reverted from
9.5.xand10.0.x, which means the CDN module's4.xbranch can't use it 😬Comment #37
wim leersComment #38
wim leers#3326410: Get tests passing again: core changed config export order + comply with drupal/coder >=8.3.16 landed, and shipped in 3.6, along with a bugfix: #3300982: Drupal core regression: CDN's "far future" responses have wrong Content-Type response header and #3128116: Negated file extensions in file URLs with querystrings or fragments are not recognized correctly.
#3169693: CDN module should override @Filter=filter_html_image_secure implementation to explicitly allow the configured CDN domains is a feature that I'll only add in
4.xminors, as are #2811615: [upstream] [Core bug, fixed since 9.5] AJAX commands that need additional JS to be loaded will fail when JS is loaded from CDN, #3182213: Obtain script errors when loaded from CDN: add `crossorigin` attribute to script tags, #3222572: Add "scheme" condition.Comment #39
wim leersRerolled #29 on top of the changes mentioned in #38.
Comment #40
wim leersRequiring PHP >=8.1 and Drupal >=9.4
Comment #41
wim leersAdopt PHP 8.1-only features.
Comment #42
wim leersComment #43
wim leersRan into Symfony's less-than-stellar
MASTER_REQUEST-to-MAIN_REQUESTtransition again, as described in #3296639-19: Drupal 10 compatibility… 😬Comment #44
wim leersComment #45
wim leersOne more oversight — an update test fixture that is obsolete.
Comment #47
wim leers