webchick noted problems installing cck with an install profile, and I encountered similar problems with the views module.
Investigation revealed that the installer chokes when asked to install any module in the sites/all/modules, /profiles/$pofile/modules, and sites/$current_site/modules directories. Only the system module properly locates modules and themes.
The attached patch moves the logic for finding the correct directories to bootstrap.inc, where the initial install system can use it. Some further improvements will be necessary to complete the process (it still only triggers .install files in the root modules directory, but as of right now it properly *finds* modules in any location).
Comment | File | Size | Author |
---|---|---|---|
#15 | install_19.patch | 9.48 KB | asimmonds |
#14 | install_18.patch | 8.81 KB | eaton |
#9 | install_17.patch | 8.37 KB | eaton |
#7 | install_16.patch | 8.22 KB | eaton |
#3 | install_15.patch | 7.89 KB | eaton |
Comments
Comment #1
chx CreditAttribution: chx commentedThis belongs to common.inc not bootstrap.inc. Note that file.inc is only loaded from common.inc . Consider moving the code to file.inc , even as it's file related...
Comment #2
eaton CreditAttribution: eaton commentedGood point, this is purely reltaed to directory traversal and file discover. Will move it, thanks.
Comment #3
eaton CreditAttribution: eaton commentedHere's a slightly updated version of the code, with the helper function moved to file.inc.
Comment #4
chx CreditAttribution: chx commentedComment #5
Dries CreditAttribution: Dries commentedCan we add some code comments to the changes in install.inc? Thanks!
Comment #6
eaton CreditAttribution: eaton commentedDefinitely. I still need to hammer out a remaining issue -- the initial installation process doesn't properly install modules in the /profiles/$profile/modules directory. It works fine once the installation is done and the user visits admin/modules.
Comment #7
eaton CreditAttribution: eaton commentedInstalling modules from the profile directory now works, and some commenting has been added to install.inc to make the various steps easier to understand. Yay!
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentednot a big deal, but i don't really agree that the listing function should be in file.inc. file_scan_directory is good there, but file_system_listing is about the drupal module/theme API, not file maangement. i vote for common.inc
more substantive review later, i hope.
Comment #9
eaton CreditAttribution: eaton commentedChatted with chx, and he agreed that since this deals specifically with theme/module/etc traversal it would make sense in common.inc. This version of the patch renames the function to drupal_system_listing() and locates it in common.inc.
Comment #10
Dries CreditAttribution: Dries commentedI don't like the global $profile.
Comment #11
eaton CreditAttribution: eaton commentedDries, after doing some further investigation, I don't think there's really any way around the need for the global in this scenerio. After the installation process is complete, we can just variable_get() to find out what profile is active - that's how system.module did it until now.
But *before* the install, when htis code runs, we don't even have database access to call variable_set(). The name of the current profile (and thus the directory name we should be scanning) is stored in the global. In an earlier version of the patch I tried passing $profile_name into the function directly, but it's called from many locations in core, most of which need to work properly in the pre-install state. Passing it around instead of using the global would require 'punching' through several layers of includes and function calls, tacking an optional param onto the end of each one, for this single special case.
Long-term, this kind of situation is what chx's http://drupal.org/node/71113 patch would help solve. We may want to look into that to avoid sprinkling 'check for a global, then check the variables' logic throughout core.
Comment #12
eaton CreditAttribution: eaton commentedDries commented on IRC that he'd greenlight it if there were no clean solution for the global at this point. The bulk of this patch is moving the function to common.inc; the other two changes are pretty minor.
In that light, I'm RTBC'ing.
Comment #13
Dries CreditAttribution: Dries commentedBut the first thing we do is ask the user his database information? So in theory, we should be able to setup a database connection ... not?
(If not, please add some additional code comments to the function. Much of the knowledge you shared in the issue tracker is not documented in the code. Don't overdo it, but just explain why we do it the Ugly Way.)
Comment #14
eaton CreditAttribution: eaton commentedNope. We're in DRUPAL_BOOTSTRAP_CONFIGURATION mode when we hit this code. Absolutely nothing is installed, we're just *ensuring that the things the profile requires* are there *to* be installed.
Comment #15
asimmonds CreditAttribution: asimmonds commentedMissed a system_listing() in themes/engines/phptemplate/phptemplate.engine
Patch updated with this change.
Comment #16
asimmonds CreditAttribution: asimmonds commentedI've tested the functionality of this patch with some contrib modules spread across:
/modules
/profiles/$profile/modules
/sites/all/modules
/sites/$site/modules
With them listed in the .profile, have found no problems during the installation process.
Also duplicated some modules across the modules directories to test module prioritisation, which appears
to be working correctly.
Comment #17
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!
Comment #18
(not verified) CreditAttribution: commented