From 8eb8dcc8425295d1a4278613031812bff7d98c15 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 1 Jul 2009 08:11:27 +0000 Subject: - Patch #314358 by wonder95, Crell, killes, et al: add option to ignore slave servers. Finally. --- includes/database/database.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'includes/database/database.inc') diff --git a/includes/database/database.inc b/includes/database/database.inc index 44a90c1ee..45f4d748c 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -2687,6 +2687,19 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $ return $query; } +/** + * 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". -- cgit v1.2.3