Skip to content
Snippets Groups Projects
Commit 4b2d321f authored by git's avatar git Committed by Liam Morland
Browse files

Issue #2816519 by dbiscalchin: Fix PDOException after the database tables are deleted.

parent ece28068
Branches
Tags
No related merge requests found
......@@ -67,3 +67,34 @@ function _drupal_reset_is_supported_database_configuration() {
global $databases;
return isset($databases['default']['default']) && count($databases['default']) === 1 && isset($databases['default']['default']['prefix']) && is_string($databases['default']['default']['prefix']);
}
/**
* Sends the user to a different page without database access.
*
* This function should be used instead of drupal_goto() after the database
* tables have been deleted. Unlike drupal_goto() a destination in $_GET is
* ignored.
*
* @param string $path
* A Drupal path or a full URL, which will be passed to url() to compute the
* redirect for the URL.
* @param array $options
* An associative array of additional URL options to pass to url().
* @param int $http_response_code
* The HTTP status code to use for the redirection, defaults to 302.
*
* @see drupal_goto()
*/
function _drupal_reset_goto($path = '', array $options = array(), $http_response_code = 302) {
// The 'Location' HTTP header must be absolute.
$options['absolute'] = TRUE;
$url = url($path, $options);
header('Location: ' . $url, TRUE, $http_response_code);
// We do not call drupal_exit() to avoid errors raised by hook_exit()
// implementations that use the database.
drupal_session_commit();
exit;
}
......@@ -98,6 +98,6 @@ function drupal_reset_admin_settings_submit($form, &$form_state) {
_drupal_reset_drop_database();
// Redirect to install page.
drupal_goto('install.php');
_drupal_reset_goto('install.php');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment