A function which can alter or override the conf_path directory. Of course this couldn't go into any modules.

Comments

gaelicWizard’s picture

Version: 6.x-dev » 7.x-dev

Yes, please!
This would be _particularly_ useful for running out of a read-only drupal installation on, for example, a shared host.

Example hypothetical:
Shared Server 'shserv92'.
Drupal installed in /usr/web/cms/drupal/7.
Shared Hosting Subscriber 'shuser4231234'.
Per-user web root ~shuser4231234/public_html.
~shuser4231234/public_html/index.php specifies:
…

    define('DRUPAL_ROOT', '/usr/web/cms/drupal/7');                                                                                  
    require(DRUPAL_ROOT . '/index.php');

BUT, then Drupal would try to read it's configuration from DRUPAL_ROOT/sites!

Add to ~shuser4231234/public_html/index.php:

    define('DRUPAL_CONFDIR', $_SERVER["DOCUMENT_ROOT"] . '/sites'); // ...or define conf_path_alter()…

Then, Problem solved. This is more than multi-site, this is multi-conf.

For now, conf_path() needs to be hacked.

:-/

gaelicWizard’s picture

Upon further investigation, it appears that drupal_system_listing() would also need modification, since it hard-codes 'sites/all' and 'profiles'.

gaelicWizard’s picture

Title: conf_path_alter » define DRUPAL_CONFDIR for use in conf_path() and drupal_system_listing().
Status: Active » Needs review

Here's my attempt at a patch.

Summary: (1) Change 'sites/all' to DRUPAL_CONFDIR . '/all', (2) change "profiles" to DRUPAL_ROOT . "/profiles".

There are two things which are missing/incomplete: (1) comments, (2) the location of the define() call.

Right now, I've placed the same new call to define() once _each_ in common.inc and bootstrap.inc, _inside_ conf_path() and drupal_system_listing(). This is certainly the wrong place. I think it should just go near the top of bootstrap.inc somewhere.

JP

gaelicWizard’s picture

StatusFileSize
new2.88 KB
gaelicWizard’s picture

StatusFileSize
new3.68 KB

Slightly updated patch, now including install.core.inc. No other changes.

Status: Needs review » Needs work

The last submitted patch, drupal-confdir-208679-5.patch, failed testing.

gaelicWizard’s picture

I'm not sure what that MySQL failure means…
¿install.core.inc -> install_check_requirements() -> $default_settings_file needs to be a relative path?

gaelicWizard’s picture

¿Or, drupal_system_listing()'s $searchdir needs to be a relative path?

gaelicWizard’s picture

StatusFileSize
new2.88 KB

So, I've figured out that file_scan_directory() returns paths which are expected to be relative to the web-server's DOCROOT. I'm not sure what to do about that. Perhaps strip the first several path components off (so that DRUPAL_CONFDIR is reduced to a single path component) _after_ the search completes (i.e. drupal_system_listing(), after file_scan_directory() returns), on the assumption that DRUPAL_CONFDIR is DOCROOT/something. That seems like a lot of work. Considering this is a search function, maybe the additional path-munging won't be significant.

Remember, I'm not just trying to rename 'sites'. I'm trying to move it to a different location on disk.

Also, updated patch removing changes to install.core.inc: default.settings.php _should_ be pulled from inside DRUPAL_ROOT, not from DRUPAL_CONFDIR.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.