The recent changes to the installer to support 'default.settings.php' broke the ability to recognize multisite directories during installation. conf_path() searches for an actual settings.php file, but now there are no such files. Alas, alack!

This patch adds a flag to the conf_path() function, allowing it to recognize matching directories during the install process even if they don't yet have settings files. It then creates the settings file, and all is well.

In the future, it's been suggested that we should prompt the user for all possible locations. That would be cool, but this works now. :)

Comments

moshe weitzman’s picture

Much needed patch. After applying this, I could start the multisite install but not complete. I got

"Warning: fopen(./sites/mm.dr6a/settings.php)"

Somehow a period is there instead of a slash. should be

mm/dr6a

Maybe do some testing when installing into a subdir?

moshe weitzman’s picture

the whole error, including line number, is

Warning: fopen(./sites/mm.dr6a/settings.php) [function.fopen]: failed to open stream: No such file or directory in /Users/mw/htd/dr6a/includes/install.inc on line 228

zarko’s picture

moshe weitzman,

The behavior is consistent with the documentation at http://drupal.org/node/53705.

moshe weitzman’s picture

Status: Needs review » Needs work

i worked on this for a bit and is definately busted. i know the behavior that zarko describes, but this something different.

eaton’s picture

StatusFileSize
new2.31 KB

Tested and fixed. If no settings.php file is found during the initial installation, AND there is a directory that matches the current URL, THEN it will use that directory to create the new settings.php file.

eaton’s picture

Status: Needs work » Needs review
dries’s picture

The PHPdoc comments are a bit techno-speak and are mildly confusing:

+ * @param $require_settings
+ *   Allow matching directory names even if no settings.php file is
+ *   found. This should only be used at install-time.

So if $require_settings is TRUE we allow matching directory names ... ?

Also, I think we need to explain this flag better; explain _why_ this is useful so the _when_ makes sense. :)

For example, your summary in the issue (i.e. if no settings.php file is found during the initial installation, AND there is a directory that matches the current URL, THEN it will use that directory to create the new settings.php file) is an order of magnitude more valuable than the current code/PHPdoc comments. :)

eaton’s picture

StatusFileSize
new2.49 KB

Here's the improved code comment:

 * @param $require_settings
 *   Only configuration directories with an existing settings.php file
 *   will be recognized. Defaults to TRUE. During initial installation,
 *   this is set to FALSE so that Drupal can detect a matching directory,
 *   then create a new settings.php file in it.
 * @param reset
 *   Force a full search for matching direcotires even if one had been
 *   found previously.
eaton’s picture

StatusFileSize
new2.49 KB

And here it is without the embarassing typo!

dries’s picture

The PHPdoc makes sense now. Thanks for updating it.

For me, this patch looks ready but it would be nice to get a review from the "conf_path architects" ...

eaton’s picture

StatusFileSize
new2.47 KB

Earl correctly noticed that the patch I attached was a borked version with a bad conditional check. This version includes the correct (working) version of the check. Thanks!

merlinofchaos’s picture

Status: Needs review » Reviewed & tested by the community

After review, this patch does what Eaton suggests and I believe is the correct short term (i.e, D6) solution.

eaton’s picture

StatusFileSize
new2.32 KB

Re-rolled. The previous version collided with the ip_address() patch due to a line ending. No code changes.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)