1.20.x database.inc db_ignore_slave()

Sets a session variable specifying the lag time for ignoring a slave server.

File

includes/database/database.inc, line 3283
Core systems for the database layer.

Code

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 Backdrop site
    // from the old data.
    $duration = settings_get('maximum_replication_lag', 300);
    // Set session variable with amount of time to delay before using slave.
    $_SESSION['ignore_slave_server'] = REQUEST_TIME + $duration;
  }
}