diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-07-07 08:57:48 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-07-07 08:57:48 +0000 |
commit | d6ce954260c32a1ac21f006159178cfb67afef8d (patch) | |
tree | 8ce56bbc8c653fbf6266339e7b6bb75ceb6e795a /includes/database/database.inc | |
parent | b7f34acb6cd14f90358d92095538631fbd740cee (diff) | |
download | brdo-d6ce954260c32a1ac21f006159178cfb67afef8d.tar.gz brdo-d6ce954260c32a1ac21f006159178cfb67afef8d.tar.bz2 |
- Patch #314358 by wonder95: only set ignore_slave_server if there are slave servers being used, which is assumed if there are more than one.
Diffstat (limited to 'includes/database/database.inc')
-rw-r--r-- | includes/database/database.inc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/includes/database/database.inc b/includes/database/database.inc index c66bb79af..b45711f15 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -2431,6 +2431,24 @@ function _db_error_page($error = '') { drupal_set_title('Site offline'); } + /** + * Helper function to get duration lag from variable + * and set the session variable that contains the lag. + */ +function db_ignore_slave() { + $connection_info = Database::getConnectionInfo(); + // Only set ignore_slave_server if there are slave servers + // being used, which is assumed if there are more than one. + if (count($connection_info) > 1) { + // Five minutes is long enough to allow the slave to break and resume + // interrupted replication without causing problems on the Drupal site + // from the old data. + $duration = variable_get('maximum_replication_lag', 300); + // Set session variable with amount of time to delay before using slave. + $_SESSION['ignore_slave_server'] = REQUEST_TIME + $duration; + } +} + /** * @ingroup database-legacy * @@ -2645,19 +2663,5 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $ } /** - * Helper function to get duration lag from variable - * and set the session variable that contains the lag. - */ -function db_ignore_slave() { - // Five minutes is long enough to allow the slave to break and resume - // interrupted replication without causing problems on the Drupal site - // from the old data. - $duration = variable_get('maximum_replication_lag', 300); - - // Set session variable with amount of time to delay before using slave. - $_SESSION['ignore_slave_server'] = REQUEST_TIME + $duration; -} - -/** * @} End of "ingroup database-legacy". */ |