Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If expire_include_base_url is set to TRUE then ExpireAPI::executeExpiration() calls url() to turn the url into a string. $urls is then an array of url strings.
If expire_include_base_url is FALSE, then url() is *not* called and $urls is passed to hook_expire_cache() as an array of arrays, with each url array containing at least the 'path' and 'query' keys.
This defies the documentation for the hook.
Comment | File | Size | Author |
---|---|---|---|
#9 | expire-n2710401-9.patch | 1.66 KB | pobster |
#6 | expire-n2710401-6.patch | 1.14 KB | DamienMcKenna |
#4 | expire-n2710401-4.patch | 1.08 KB | DamienMcKenna |
Comments
Comment #2
azinck CreditAttribution: azinck at Forum One commentedComment #3
azinck CreditAttribution: azinck at Forum One commentedHere's a stab at a patch.
Comment #4
DamienMcKennaOn top of that, it converts the URLs to an absolute path, whereas the documentation shows:
This patch converts them to relative paths, though I still wonder if that is the correct approach to take.
Comment #5
DamienMcKennaI'm starting to think that the base_path() should not be added to the front of the paths, that it should be stripped off the front. What do you think?
Comment #6
DamienMcKennaThis removes the base_path().
Comment #7
DamienMcKennaThe question is - should it use url() at all, or should it just manually combine $path['path'] and $url['query']? The $language string throws some confusion into this..
Comment #8
erwangel CreditAttribution: erwangel commentedIndeed URL displays empty in debugLog and this makes the Expire module unusable when used in conjunction with varnish module as in configuration it is stated "Enabling this setting (Include base URL in expires) when Varnish or Acquia Purge modules are used as a cache backend is *not* recommended."
Of course the change suggested by Damien's patch at #6 could be done inside hook_expire_cache of the Varnish module but in such case Expire will continue to complain throwing "strpos() expects parameter 1 to be string, array given". So I think #6 gives the right place to patch.
As for the $language string (see #7), I think we need to keep it in case sites have more than one language activated. From the url() API documentation "$options['language'] is used to look up the alias for the URL".
Comment #9
pobster CreditAttribution: pobster at ArcadeGeek LTD commentedHow about this instead?
Bit confused why we're dropping the absolute part though?
Comment #10
ron_s CreditAttribution: ron_s commentedThis patch has been around for over 4 years and needs review: https://www.drupal.org/project/expire/issues/2549647#comment-10282873
Should be consolidated.
Comment #11
pobster CreditAttribution: pobster at ArcadeGeek LTD commentedAgreed, closing this as a duplicate. I don't agree with the patch in that issue though ... It absolutely should take query strings and language into account. I'll open it up for discussion with an altered patch.