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.
In classloader.info, weight = -1000 has no effet.
In the install file, we need to update it by a request.
Comment | File | Size | Author |
---|---|---|---|
#9 | classloader-weight-1929278-9.patch | 762 bytes | Eric_A |
Comments
Comment #1
Eric_A CreditAttribution: Eric_A commentedYes, using an insert query in an implementation of hook_install() certainly will have more effect.
For bootstrap modules that depend on Class Loader, the weight is important. Normal modules are not effected by this issue.
Somewhat related: #1869778: Class not found at menu object load time.
Comment #2
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commentedHere is the snippet:
(sorry no patch)
Comment #3
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commentedComment #4
Eric_A CreditAttribution: Eric_A commentedIf the module is already installed the weight needs to be fixed with an update function.
Comment #5
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commenteddon't be silly :)
Comment #6
Eric_A CreditAttribution: Eric_A commentedMuch better! :-)
Though 7000 is the wrong hook_update_N() number here, since 70xx is reserved for initial porting to a new Drupal core API.
A 71xx number would be correct.
Comment #7
sunAny chance to see a proper patch? :)
I don't really care too much for the module update number, since this module most likely won't see any other module update. But for the sake of completeness, @Eric_A is right with his interpretation of the module update numbering scheme. In the end, all module updates are ran and applied sequentially though, so the most important aspect is that we're counting up ;)
Comment #8
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commentedOk:
Comment #9
Eric_A CreditAttribution: Eric_A commentedAttached is a straight copy and paste based patch (from #8).
EDIT: Note that there already is a classloader_install() function, which is not taken into account by the above snippets.
Existing code has direct calls to classloader_install() in order to activate the class loader and register all namespaces of enabled modules. Now that we're going to set the weight in there, we should create a helper function and call that. (Or replace every call with calls to drupal_classloader() and classloader_init().)
The documentation block preceding this function is stripped of newlines and used as the description for the update on the pending updates task list. Core uses a different style for this:
Comment #10
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commentedI'm ok with this, thanks for making a patch :)