diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-11-03 05:55:57 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-11-03 05:55:57 +0000 |
commit | d0f8f90a364fb1ab6253e9e2cfa42ecd57cc6c3b (patch) | |
tree | ff72a2b6b625de24c862c63aaab7c143e9a4120d /update.php | |
parent | 0f956d42022bf6fd1e830b9bcb3fad6fa493a426 (diff) | |
download | brdo-d0f8f90a364fb1ab6253e9e2cfa42ecd57cc6c3b.tar.gz brdo-d0f8f90a364fb1ab6253e9e2cfa42ecd57cc6c3b.tar.bz2 |
#303889 by David_Rothstein, kbahey, and chx: Make it possible to update D6 -> D7.
Diffstat (limited to 'update.php')
-rw-r--r-- | update.php | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/update.php b/update.php index 0a0dc2f35..d5917d3b3 100644 --- a/update.php +++ b/update.php @@ -330,7 +330,7 @@ function update_finished($success, $results, $operations) { $_SESSION['update_results'] = $results; $_SESSION['update_success'] = $success; $_SESSION['updates_remaining'] = $operations; - + // Now that the update is done, we can disable site maintenance if it was // previously turned off. if (isset($_SESSION['site_offline']) && $_SESSION['site_offline'] == FALSE) { @@ -574,6 +574,37 @@ function update_fix_d6_requirements() { } /** + * Users who still have a Drupal 6 database (and are in the process of + * updating to Drupal 7) need extra help before a full bootstrap can be + * achieved. This function does the necessary preliminary work that allows + * the bootstrap to be successful. + * + * No access check has been performed when this function is called, so no + * changes to the database should be made here. + */ +function update_prepare_d7_bootstrap() { + // Allow the database system to work even though the registry has not + // been created yet. + drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE); + include_once DRUPAL_ROOT . '/includes/install.inc'; + drupal_install_init_database(); + spl_autoload_unregister('drupal_autoload_class'); + spl_autoload_unregister('drupal_autoload_interface'); + // The new {blocked_ips} table is used in Drupal 7 to store a list of + // banned IP addresses. If this table doesn't exist then we are still + // running on a Drupal 6 database, so suppress the unavoidable errors + // that occur. + try { + drupal_bootstrap(DRUPAL_BOOTSTRAP_ACCESS); + } + catch (Exception $e) { + if (db_table_exists('blocked_ips')) { + throw $e; + } + } +} + +/** * Add the update task list to the current page. */ function update_task_list($active = NULL) { @@ -655,13 +686,10 @@ if (empty($op)) { install_goto('update.php?op=info'); } +update_prepare_d7_bootstrap(); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_maintenance_theme(); -// This must happen *after* drupal_bootstrap(), since it calls -// variable_(get|set), which only works after a full bootstrap. -update_create_batch_table(); - // Turn error reporting back on. From now on, only fatal errors (which are // not passed through the error handler) will cause a message to be printed. ini_set('display_errors', TRUE); |