Skip to content
Snippets Groups Projects
Commit d6ce9542 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #314358 by wonder95: only set ignore_slave_server if there are slave...

- 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.
parent b7f34acb
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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
*
......@@ -2644,20 +2662,6 @@ 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".
*/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment