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.
"Call to undefined function entity_modified_last"
Use module_invoke('entity_modified', 'last') instead....
Comment | File | Size | Author |
---|---|---|---|
#26 | dfp-2511078-fix.patch | 679 bytes | marcelovani |
#20 | interdiff.txt | 1.8 KB | marcelovani |
#20 | dfp-entity-modified-missing-2511078_20.patch | 5.8 KB | marcelovani |
| |||
#18 | dfp-entity-modified-missing-2511078_18.patch | 5.44 KB | marcelovani |
| |||
#17 | dfp-entity-modified-missing-2511078_17.patch | 5.21 KB | marcelovani |
|
Comments
Comment #1
RobLoachEven while the module is enabled.
Comment #2
RobLoachComment #3
RobLoachComment #4
RobLoachComment #5
bleen CreditAttribution: bleen commentedThis seems reasonable... lets let this marinate for a bit though to see if anyone has some other thoughts
Comment #6
pachabhaiya CreditAttribution: pachabhaiya as a volunteer and at Drupal Nepal commentedThe patch #4 helps site from breaking if entity_modified module is not installed.
The watchdog() function format does not look good.
Also,
I don't understand the way $key variable is used.
static $key = 1000;
return (string)$key++;
$key++ will always return 1001.
Comment #7
pachabhaiya CreditAttribution: pachabhaiya as a volunteer and at Drupal Nepal commentedI've made some corrections in patch #4 and uploaded it.
Similar to what entity_modified module has done here, http://cgit.drupalcode.org/entity_modified/tree/entity_modified.module?i...
we could just return "1" if the entity_modified module is not found.
Comment #8
jmev CreditAttribution: jmev commentedI actually experienced this when importing a database from a production site to a local site. I checked the database and found that the module was enabled, so assumed it to be a caching issue. Clearing caches resolved my issue. Posting this in case someone else experiences the error under similar circumstances.
Comment #10
rwohlebThese patches don't cover the case where the entity_modified module exists in the filesystem but has yet to be installed. The call to module_load_include() doesn't do any checks that the module is enabled and blindly loads that file, which seems pretty dangerous. As a result you will get a PDOException if the table is missing.
Comment #11
rwohlebHere is a patch that avoids trying to load the module file directly. It's either there and enabled, or it's not. If for some reason this function is being called before the entity_modified module is initialized by core, then that seems like a separate issue.
Comment #12
Fabianx CreditAttribution: Fabianx at Tag1 Consulting commentedHi there,
Here is the author of entity_modified. I also originally worked with Crell in IRC on the caching part of dfp.
What needs to happen here is that you disable the caching if entity_modified_last function does not exist and you probably don't want to spam watchdog with messages either to avoid breaking sites. I suggest to add hook_requirements error.
On the other hand it is a clear dependency, so maybe a fatal (as is now) is also fine.
But do not just return 1, because that means your token cache won't be updated in case that you update any referenced node or user.
Comment #13
marcelovaniI think since the module is required as dependency in the info file, it cannot be optional
In other words, if we want to use #11, we need to remove the dependency from the info file.
alternatively, we can simply enable entity_modified in a hook_update()
I am still not sure I would like to have the second option, because we don't have a need to "cache all things"
Comment #14
marcelovaniOk, here is my solution:
Please review and let me know if I forgot anything
Comment #15
marcelovaniComment #17
marcelovaniI forgot to enable the module during the tests
Comment #18
marcelovaniOne last thing
Comment #19
bleen CreditAttribution: bleen commentedCan we disable this if Entity Modified is not enabled?
This can be 1 if statement
Comment #20
marcelovaniGood idea
Comment #21
bleen CreditAttribution: bleen commentedThis looks pretty good to me now .... anyone else want to kick the tires?
Comment #22
AnybodyLooks good! +1 for RTBC
Comment #24
bleen CreditAttribution: bleen commentedComment #25
AnybodyA new stable release would be nice because the last stable is broken due to this error for me.
Thank you!
Comment #26
marcelovaniHold on, I think setting the setting to be disabled when entity_modified is causing a problem.
Because the default value of variable_get("dfp_token_cache_enabled", TRUE) is True, we have a situation where the box is ticked but the form validation fails.
I think we could change the default value to FALSE when the module is not enabled, but when enabled, get the value from the variable as usual
Comment #27
marcelovaniSorry about re-opening this, I just realized the problem with disabling the option after it was already committed
Comment #28
bleen CreditAttribution: bleen commentedGrrrr ... because the value of a disabled form element is sent anyway. Sigh.
This looks like the correct solution to me but havent had a chance to actually test. Will try later today, but if someone else has a minute that would be great
(nice catch @marcelovani)
Comment #30
bleen CreditAttribution: bleen commented