The attached patch comes about from the hacking that I have to do with every new release to allow site-specific themes that are not available system-wide, and from a conversation this morning with Adrian R. regarding configuration updates (that he has discussed with Dries). The basic idea is to allow multiple sites running from a single Drupal installation to share some themes and modules while also having site-specific versions. For example, say I have site1.com and site2.com running from the same Drupal installation. site1 has a custom theme or module that it does not want site2 to be able to use. Or, say site2 wants to use a cvs version of a module whereas site1 wants to use the released version. Currently this is not possible.
The attached patch makes this possible by moving site configuration (including the default 'conf.php' config) into a new conf directory structure, making the includes directory more off-limits to end users (as it should be). The structure looks like this:
The site configurations require the config.php file, but the modules and themes directories are optional. If they exist, they will be searched. This allows different sites to use different modules and themes, different versions of modules and themes, modified versions of modules or themes, and/or custom modules or themes that are unavailable to other sites. The master directories (modules/ and themes/) will still be used, and their files will be available to all sites. Items installed in the site's configuration directories will shadow the master versions if installed both places.
* Changed conf_init() to return the configuration directory for the current site with 'conf/default' as the default. It uses a static variable so that the search only needs to happen once. Note that I also cleaned up the matching code a bit so that it will search for a file as follows: www.site.com.subdir, site.com.subdir, www.site.com, site.com, --default--. Previously the search order would be: www.site.com.subdir, site.com.subdir, com.subdir, subdir, ubdir, --default--. The new way seems to be closer to what we want.
* Changed include_once to include the new, correct configuration file.
* Changed file_scan_directory() to use $name (the basename) as the array key rather than the filename. This prevents problems when a "master" version of an item was installed/enabled and a new site-specific version is now installed/enabled. Questions: Will this cause problems elsewhere? Are contribs using this? What if a file with a specific name exists in two subdirectories? One will overwrite the other now...
* Changed system_listing() to scan the master modules and themes directories followed by the site-specific directories (if they exist).
* Changed system_listing() to handle basename-keyed array now returned from file_scan_directory (including within the required and throttle_required arrays).
* Changed system_listing() DELETE db_query to use name and type as key rather than filename and type.