We currently set it like so in hosting.module:
define('HOSTING_DEFAULT_DB_SERVER', variable_get('hosting_default_db_server', 2));

But in recent Aegir installs, server_localhost is actually node/4.

Furthermore, while this can be set by changing the variable manually, it should really be exposed as a radio button on the settings page, IMO.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lavamind’s picture

This can especially be a problem when running migrate and clone tasks. If these tasks are failing for no obvious reason, and the following error appears in the task log, then hosting_default_db_server might contain an invalid value.

Drush was not able to start (bootstrap) the Drupal database

ergonlogic’s picture

We already set the hosting_default_db_server with the appropriate NID in hostmaster.install. So this is only for older installs, where this might not be set, or if the variable gets deleted. I think we should update this default value to 4.

In terms of the feature request, i.e. being able to configure this from the front-end, it should be pretty simple. Just build a radio form element from hosting_get_servers('db'), and set the variable accordingly.

ergonlogic’s picture

Status: Active » Needs review
FileSize
1.36 KB

This patch does both the suggestions above.

helmo’s picture

Status: Needs review » Fixed

The patch from #3 was committed in #2280081: Allow setting default database server

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.