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.
This is just a heads up issue that I made this core patch due to authcache_builtin_expire_v2_expire_cache() + locale #2507795: Improve performance l() function for multilingual sites and cache clear.
Comment | File | Size | Author |
---|---|---|---|
#19 | Cache_Expiration.png | 66.67 KB | joelpittet |
#14 | 2507797-14.patch | 993 bytes | znerol |
#13 | expire-settings.png | 62.32 KB | znerol |
#13 | expire-settings.png | 62.32 KB | znerol |
#5 | 2507797-5.patch | 3.02 KB | joelpittet |
Comments
Comment #1
znerol CreditAttribution: znerol commentedi'm not 100% sure but maybe we could get rid of the
url
call completely. It looks to me like the only thing it is supposed to do is to prepend the (non-locale) url prefix.Do you happen to know whether the expire module expands an url into all its language variants?
Comment #2
joelpittet@znerol I don't think expire module expands it into all variants.
ExpireAPI::processInternalPaths()
takes in a $langcode for "Language code of object that is expiring."That would be cool if we didn't need to call url() though I think my patch still stands on it's own as url() could get called a lot and should scale nicer.
Comment #3
joelpittetI'm chipping away at this slowly but surely!
One thing I noticed that is along the lines of what you were suggesting in removing the
url()
call completely:$wildcards
comes in with no language prefix! buturl()
generates things like this:path:
"admin/config/content/formats/%"
url:
"/us/admin/config/content/formats/%25"
And the wildcard it's trying to match against is this:
"admin/config/content/formats/%"
In my case all those keys are false... so it doesn't matter but it's still wrong. I guess that's a different issue we should look into why they are all false and if that is legit.
Possible quick win:
One quick win here may be to just bail early if the bin is already empty?
Comment #4
joelpittetActual CID samples:
Anonymous:
Admin:
Comment #5
joelpittetHere's a possible solution... though not sure if it's the best...
Also since I gutted url() function I wonder if it would still work with domain based locale instead of prefixed like mine.
Comment #6
das-peter CreditAttribution: das-peter at Cando commented@joelpittet Thanks for the hint! I've just added locale support to following authcache integration: http://cgit.drupalcode.org/enhanced_page_cache/tree/enhanced_page_cache....
And indeed it is crazy! Now
url()
isn't just requested for every path put also for every language with a language prefix.Comment #7
znerol CreditAttribution: znerol commented@das-peter: What about moving that into Authcache Enum? In fact your code looks a lot like #2543352-9: Unable to alter authcache_enum user key generation input..
Comment #8
das-peter CreditAttribution: das-peter at Cando commented@znerol Hmm, I don't think this code belongs to enum, because to me it seems like enums solely purpose is to generate keys that are related to the identification of user specific cache ids - with the only exception of anonymous users which share a "key". So for me the code I wrote belongs more to authcache_builtin_expire_v1 / authcache_builtin_expire_v2
hook_expire_cache()
. I actually wanted to create patches for those modules but hadn't the time yet - since I focused on my own authcache integration in enhanced_page_cache.Comment #9
znerol CreditAttribution: znerol commentedOh, I think the difference is that if you have domain based language negotiation, then Authcache Enum needs to compute all possible values of
$base_root
(because that is part of the key properties). In contrast when working with path prefixes, then that clearly belongs into thehook_expire_cache()
implementation.Comment #10
das-peter CreditAttribution: das-peter at Cando commentedOh indeed, so I absolutely agree that the language domain handling belongs to enum - but not the path prefix.
Yay consensus - now we just need to get all the things done :)
Comment #11
joelpittetI'd like to help but TBH a bit lost at the next steps... Can I do anything to this patch to make it more in line or is it ok as is?
Comment #12
das-peter CreditAttribution: das-peter at Cando commented@joelpittet I just gave your code a test run and it looked fine, so I pushed it to the enhanced page cache repo: http://cgit.drupalcode.org/enhanced_page_cache/commit/?id=cca4be4a24f9a0...
I just found following nitpicks and fixed them there:
Space after
//
missing.I'm tempted to say RTBC - but I tested this just very roughly.
A comma should follow the last multiline array item.
Comment #13
znerol CreditAttribution: znerol commentedI believe it is possible to get away without actually calling
url()
at all. Theexpire
module already does that for us. The idea here is:Do you think that this might be a viable solution?
Comment #14
znerol CreditAttribution: znerol commentedForgot the patch.
Comment #15
joelpittetSomething wrong with the testbot or branch tests? I had to tag a new release in commerce_discount to make testbot smarten up. FYI #2490991: Tests pass locally and not on testbot: commerce_discount
Edit: Oh the branch failed some tests that's why:
https://qa.drupal.org/pifr/test/512338
Comment #16
joelpittet@znerol #14 throws a bunch of
Comment #17
joelpittet$urls
seems to be coming in the form['path' => ['path' => 'user/1', 'query' => '']]
from expire.But I've got the patch from #2267305: Problem when clearing the cache of nodes using entity translation applied and if $include_base_url is not
TRUE
, it will send the array across like that, hmm. Thoughts @das-peter?Comment #18
joelpittetMy mistake, that patch doesn't change that it just makes it more aware of other languages. @znerol back to you.
Edit: and to answer it may only be a viable solution if
$include_base_url
is true. Which is a bit silly if you ask me that you would get an array in one case and a string in another:SComment #19
joelpittetHere's an interesting but confusing UI... compared to what it does with respect to authcache.
Comment #20
znerol CreditAttribution: znerol commented@joelpittet: Do you run expire 7.x-2.x-dev? It seems to me that the array could be due to recent commits #1780144: Should expire.module urlencode urls. I cannot tell whether they intended to pass an array in some cases or whether that is a bug.
Comment #21
das-peter CreditAttribution: das-peter at Cando commentedI was wondering too why the heck one time it's an array and then a string again.
I'd say that should be unified :|
And if we want to have support for queries it might is smart to have an array - that way not all the modules would have to do a
parse_url()
.Comment #22
joelpittetCreated a follow-up over there to maybe resolve that.
#2549647: Expire url should have a consistent output instead of string or array depending on $include_base_url
Comment #23
joelpittetOk resolved that weird array thing. Man the help text on base url inclusion likely need improvement on expire as well. I have to read that like 5-6 times before I grasp what it's trying to say.
Anyways going to try #14
Comment #24
znerol CreditAttribution: znerol commented@joelpittet do you think that #14 should be committed?
Comment #25
joelpittetI've not had these scenarios yet but I've been using and testing with this patch and I think so yes.
Comment #27
znerol CreditAttribution: znerol commented