Closed (fixed)
Project:
Drupal core
Version:
7.7
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Jun 2009 at 19:51 UTC
Updated:
17 Aug 2011 at 19:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berdirsubscribe ;)
Comment #2
webchicksubscribe
Comment #4
yched commentedIs this related to #472684: Install non-default modules one at a time to ensure proper module list is maintained during installation hooks ?
Comment #5
berdirI haven't looked at the other issue, but yes, probably. If we move module_list(TRUE) before hook_modules_installed is executed, all modules should be listed as installed even if they are installed at once.
Note that I haven't yet tested if it works, I will soon.
Comment #6
berdirOk, attached is a first working patch.
It is quite ugly, but it seems work, comments are welcome ;) It is quite complicated, there are several things that do *not* work:
- It does not help to rebuild the module list and registry in drupal_install_modules() because the new modules haven't been enabled yet, but it needs to be done before the installed hook is invoked
- the information about the new installed modules needs to be available when calling the installed hook
- the node type static cache needs to be cleared after new modules have been installed, but it can't be done in module.inc as node_type_clear might not yet be available.
What I had to do to get it working:
- move the install stuff to module_enable
- move the invoking of hook_modules_installed to module_enable
- add a node_type_clear() to user_modules_installed().
- pass through $disable_modules_installed_hook to module_enable()
With all those changes and chx idea in #472684-25: Install non-default modules one at a time to ensure proper module list is maintained during installation hooks, it would imho make sense to combine drupal_install_modules() and module_enable() to a single function, maybe module_install() or something like that.
Comment #7
berdirAdded comments to the changes in module_enable, as chx requested.
Comment #8
Anonymous (not verified) commentedtagging.
Comment #11
berdirTestbot, I don't believe you :)
Comment #12
damien tournoud commentedThis needs to move to node_modules_installed().
Comment #13
berdirIt needs to be run before user_modules_installed(). If we move it, we have to give node.module a lower weight.
Comment #14
damien tournoud commentedn < u, right?
Comment #15
berdirSounds about right ;)
Comment #16
catchMarked #502290: Node type related module install error. We did not empty the cache somewhere. as duplicate.
Patch is looking much cleaner, let's get it in.
Comment #17
pp commentedcvs up -dPC
patch -p0 < admin_role_fix_3.patch
droped all table, and used install.php
turned on the poll module (resolve the #502290: Node type related module install error. We did not empty the cache somewhere. first problem)
turned off the poll module
uninstalled the poll module
turned on the poll module
i saw following:
Is it a different problem?
Comment #18
berdirHm, interesting.
However, as you can see, the permission name is correct ("create poll content"), without the patch, the name of the node type would be missing ("create content"). So I assume something was messed up. Does that happen with other modules, like book, forum etc. too?
Also, were there any other error messages?
We need imho a proper permission api, to add/update/delete permissions for roles and that should try/catch that exception and display a "nice", meaningful error message, but not in this issue.
Comment #19
pp commentedForum and book also has this bug, but blog hasn't install/uninstall functions. (I can't uninstall blog module. :))
pp
Comment #20
berdir> administer book outlines
> administer forums
These names are fine and are even module specific.
Hm, uninstall.... Now, I see the problem :) This is another problem. The current hook does unconditionally add all permissions, and does not check if they already exist. This is not related to the node_type/registry cache. Can you please open a new bug report about changing that query from db_insert() to db_merge()?
Then we can commit this....
Comment #21
pp commentedI do it. #503554: user_modules_uninstalled() is missing
Comment #23
catcho rly.
Comment #25
catchComment #26
webchickCommitted to HEAD! Thanks.
Comment #27
yched commentedFollowup: node_modules_installed() should let us get rid of the additional node_type_clear() in DrupalWebTestCase::setUp(), that was added as a hotfix to let 'Body as field' get in.
Requires bot confirmation, of course.
Comment #29
yched commentedHah, doesn't work because DrupalWebTestCase::setUp() uses drupal_install_modules($disable_modules_installed_hook = TRUE), so node_modules_installed() is precisely not invoked there.
Nevermind.
Comment #30
sunWhen manually invoking module_enable() from within another module (see admin_menu's "Enable/Disable developer modules" link below the icon), I get the following warning now:
Seems like a drupal_function_exists() is in order to ensure that function is available.
Comment #31
berdirPlease try the attached patch.
Note that this is just patchwork.. we really need to clean up that mess and probably merge drupal_install_modules() and module_enable() somehow, including dependency handling and stuff like that.
Comment #33
catchDuplicate of registry rollback.
Comment #34
sunThis code still lives in node.admin.inc. I do not think it's executed there.
8 days to code freeze. Better review yourself.
Comment #35
sun.core commented...which also means it can simply be removed. ;)
Comment #36
sun.core commentedNot critical. Please read and understand Priority levels of Issues, thanks.
+ new title + WTF?! ;)
Comment #37
catch1. The registry isn't in core any more, surprised this is still broken :(
2. Is this a duplicate of #399642: Replace drupal_install_modules() with an improved module_enable()?
Comment #38
sun.core commentedSorry, I hope this revised title makes it clear... node_modules_installed() does not live in node.module, and since the registry is gone, it doesn't look like it will be found/invoked.
We probably want to just delete that code, because it's not executed currently anyway.
Doesn't look to have an overlap with the other issue.
Comment #39
catchLet's delete the dead code.
Comment #40
sun.core commentedComment #41
webchickCommitted to HEAD. Thanks!
Comment #43
Joenet-dupe commentedI have the same problem with Drupal 7. How can I install this patch?
Comment #44
LynnS commentedI'm having the same problem. Can't install any new modules; the site is throwing this registry error, and now is throwing it when I try to clear the caches. Am I misunderstanding that this was considered fixed, or was this patch not applied?
Comment #45
LynnS commentedWhoops. I think I broke it. *headdesk* Well, if anyone can help I'd be grateful.