$GLOBALS[LANGUAGE_TYPE_INTERFACE] = language_default(); // Only allow the requirements check to proceed if the current user has access // to run updates (since it may expose sensitive information about the site's // configuration). $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; if (empty($op) && update_access_allowed()) { require_once BACKDROP_ROOT . '/core/includes/install.inc'; require_once BACKDROP_ROOT . '/core/modules/system/system.install'; // Load module basics. include_once BACKDROP_ROOT . '/core/includes/module.inc'; $module_list['system']['filename'] = 'core/modules/system/system.module'; module_list(TRUE, FALSE, FALSE, $module_list); backdrop_load('module', 'system'); // Reset the module_implements() cache so that any new hook implementations // in updated code are picked up. module_implements_reset(); // Set up $language, since the installer components require it. backdrop_language_initialize(); // Set up theme system for the maintenance page. backdrop_maintenance_theme(); // Check the update requirements for Backdrop. Only report on errors at this // stage, since the real requirements check happens further down. update_check_requirements(TRUE); // Redirect to the update information page if all requirements were met. install_goto('core/update.php?op=info'); } // update_fix_requirements() needs to run before bootstrapping beyond path. // So bootstrap to BACKDROP_BOOTSTRAP_LANGUAGE then include unicode.inc. backdrop_bootstrap(BACKDROP_BOOTSTRAP_LANGUAGE); include_once BACKDROP_ROOT . '/core/includes/unicode.inc'; update_fix_requirements();
/** * Delete created files and temporary files directory, delete the tables created by setUp(), * and reset the database prefix. */ protected function tearDown() { global $user, $language, $settings, $config_directories; // In case a fatal error occurred that was not in the test process read the // log to pick up any fatal errors. simpletest_log_read($this->testId, $this->databasePrefix, get_class($this), TRUE); $emailCount = count(state_get('test_email_collector', array())); if ($emailCount) { $message = format_plural($emailCount, '1 e-mail was sent during this test.', '@count e-mails were sent during this test.'); $this->pass($message, t('E-mail')); } // Delete temporary files directory. file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10)); // Remove all prefixed tables. $connection_info = Database::getConnectionInfo('default'); $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%'); if (empty($tables)) { $this->fail('Failed to find test tables to drop.'); } $prefix_length = strlen($connection_info['default']['prefix']['default']); foreach ($tables as $table) { if (db_drop_table(substr($table, $prefix_length))) { unset($tables[$table]); } } if (!empty($tables)) { $this->fail('Failed to drop all prefixed tables.'); } // Get back to the original connection. Database::removeConnection('default'); Database::renameConnection('simpletest_original_default', 'default'); // Delete the database table prefix record. db_delete('simpletest_prefix')->condition('test_id', $this->testId)->condition('prefix', $this->databasePrefix)->execute(); // Set the configuration direcotires back to the originals. $config_directories = $this->originalConfigDirectories; // Restore the original settings. $settings = $this->originalSettings; // Restore original shutdown callbacks array to prevent original // environment of calling handlers from test run. $callbacks =& backdrop_register_shutdown_function(); $callbacks = $this->originalShutdownCallbacks; // Return the user to the original one. $user = $this->originalUser; backdrop_save_session(TRUE); // Ensure that internal logged in variable and cURL options are reset. $this->loggedInUser = FALSE; $this->additionalCurlOptions = array(); // Reload module list and implementations to ensure that test module hooks // aren't called after tests. module_list(TRUE); module_implements_reset(); // Reset the Field API. field_cache_clear(); // Rebuild caches. $this->refreshVariables(); // Reset public files directory. $GLOBALS['conf']['file_public_path'] = $this->originalFileDirectory; // Reset language. $language = $this->originalLanguage; if ($this->originalLanguageDefault) { $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault; } // Close the CURL handler. $this->curlClose(); }
/** * Reset the database prefix and global config. */ protected function tearDown() { global $user, $language, $settings, $config_directories; // Get back to the original connection. Database::removeConnection('default'); Database::renameConnection('simpletest_original_default', 'default'); // Set the configuration directories back to the originals. $config_directories = $this->originalConfigDirectories; // Restore the original settings. $settings = $this->originalSettings; // Restore original shutdown callbacks array to prevent original // environment of calling handlers from test run. $callbacks =& backdrop_register_shutdown_function(); $callbacks = $this->originalShutdownCallbacks; // Return the user to the original one. $user = $this->originalUser; backdrop_save_session(TRUE); // Ensure that internal logged in variable and cURL options are reset. $this->loggedInUser = FALSE; $this->additionalCurlOptions = array(); // Reload module list and implementations to ensure that test module hooks // aren't called after tests. module_list(TRUE); module_implements_reset(); // Reset the Field API. field_cache_clear(); // Rebuild caches. $this->refreshVariables(); // Reset public files directory. $GLOBALS['conf']['file_public_path'] = $this->originalFileDirectory; // Reset language. $language = $this->originalLanguage; if ($this->originalLanguageDefault) { $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault; } // Close the CURL handler. $this->curlClose(); }