Closed (fixed)
Project:
CPS
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
15 Aug 2016 at 20:10 UTC
Updated:
11 Mar 2019 at 13:24 UTC
Jump to comment: Most recent, Most recent file
CPS took over the hooks from SPS, who relied on a non-applied entitycache patch (without saying so).
This fixes the entitycache integration using #2044291: Add drupal_alter() to entityCacheGet & entityCacheSet & resetEntityCache and also fixes the annoying case that cps_override_changeset() actually clears the whole entitycache via resetCache().
By carefully avoiding that non published items enter the cache its possible to skip clearing the entitycache on override changeset and only clear the static cache.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | interdiff.txt | 360 bytes | David_Rothstein |
| #11 | fix_cps_entitycache-2784487-11.patch | 5.15 KB | David_Rothstein |
| #9 | interdiff.txt | 1.05 KB | David_Rothstein |
| #9 | fix_cps_entitycache-2784487-9.patch | 5.1 KB | David_Rothstein |
| #6 | interdiff.txt | 441 bytes | David_Rothstein |
Comments
Comment #2
fabianx commentedAttached patch fixes the problems for me.
Comment #3
fabianx commentedThe publishing needed a complete disable as well - especially as drafty() did a entity_load_single() after the resetCache() call. (and the resetCache() itself would be a performance bottleneck as well as it deletes all cache entries for every entity published).
Interdiff attached as well.
Comment #6
David_Rothstein commentedIn the previous patch, the code in cps_override_changeset() wasn't actually restoring the previous state - so the entitycache reset functionality was staying disabled for the rest of the page request after that function was called.
Here's a fix for that.
Comment #7
fabianx commented#6: Are you sure about this?
I kinda kept NULL as the state and that worked fine for me as all code was only checking if (x) and if (NULL) is the same as if (FALSE).
However not opposed to making the default FALSE, should then be done for cps_entitycache_disable() as well though.
Comment #8
fabianx commentedOh oh, I see the problem now.
Because the value was NULL, it tried to reset with NULL and that failed as the isset() check was FALSE.
That cannot happen for the other one as that uses direct TRUE / FALSE instead of retrieving the old value.
Comment #9
David_Rothstein commentedRight, exactly.
Here's an untested reroll that changes cps_disable_entitycache() to have a default of FALSE also. It doesn't matter in practice right now (for the reason you mentioned above) but I think you're right that it's good to have them be consistent, especially if anyone ever does try to feed the return value of cps_disable_entitycache() back into it sometime in the future.
Comment #10
fabianx commentedThat however is not true.
I think it might be best to just have the disable entitycache function and have it return something.
As the reset is just used for something that calls resetCache(), which could also disable all of entitycache instead.
---
If I were to rework I would probably do it like this:
That solves all cases and also ensures whatever someone wanted as state before is preserved (for recursive calls and such).
Comment #11
David_Rothstein commentedOh, you're right - I copied the documentation but not the code. Here is another untested reroll that just copies the code over so the two functions behave identically. No other changes.
Comment #12
David_Rothstein commentedIn other words I didn't change the calling code at all, although you're probably right that it shouldn't call cps_disable_entitycache(FALSE) indiscriminately at the end.
Comment #13
fabianx commentedYes, that is what I meant.
It should call it, but then restore the old state (whatever that is).
Also I question (myself) whether we really want two functions given that we only call resetCache() during the disabling of the cps_disable_entitycache_reset().
So it might be enough to just disable entitycache completely during that operation ... - instead of having two functions.
Comment #15
hadsie commentedI've committed the patch in #11 now. Thanks!