/** * Collects data for the given Request and Response. * * @param Request $request A Request instance * @param Response $response A Response instance * @param \Exception $exception An Exception instance * * @api */ public function collect(Request $request, Response $response, \Exception $exception = null) { if ($this->matcher->matches($request)) { $this->data = array('bootstrap' => function_exists('drupal_get_bootstrap_phase') ? drupal_get_bootstrap_phase() : -1, 'base_url' => $GLOBALS['base_url'], 'base_path' => $GLOBALS['base_path'], 'base_root' => $GLOBALS['base_root'], 'conf_path' => conf_path(), 'queries' => array()); // Load .install files include_once DRUPAL_ROOT . '/includes/install.inc'; drupal_load_updates(); // Check run-time requirements and status information. $requirements = module_invoke_all('requirements', 'runtime'); usort($requirements, '_system_sort_requirements'); $this->data['requirements'] = $requirements; $this->data['severity'] = drupal_requirements_severity($requirements); $this->data['status_report'] = theme('status_report', array('requirements' => $requirements)); if (isset($GLOBALS['databases']) && is_array($GLOBALS['databases'])) { foreach (array_keys($GLOBALS['databases']) as $key) { $this->data['queries'][$key] = \Database::getLog('devel', $key); } } } else { $this->data = false; } }
<?php /** * @file * Template overrides and (pre-)process hooks for the Omega base theme. */ require_once dirname(__FILE__) . '/includes/omega.inc'; require_once dirname(__FILE__) . '/includes/scripts.inc'; if (drupal_get_bootstrap_phase() >= DRUPAL_BOOTSTRAP_DATABASE && $GLOBALS['theme'] === $GLOBALS['theme_key'] && ($GLOBALS['theme'] == 'omega' || !empty($GLOBALS['base_theme_info']) && $GLOBALS['base_theme_info'][0]->name == 'omega')) { // Managing debugging (flood) messages and a few development tasks. This also // lives outside of any function declaration to make sure that the code is // executed before any theme hooks. if (omega_extension_enabled('development') && user_access('administer site configuration')) { if (variable_get('theme_' . $GLOBALS['theme'] . '_settings') && flood_is_allowed('omega_' . $GLOBALS['theme'] . '_theme_settings_warning', 3)) { // Alert the user that the theme settings are served from a variable. flood_register_event('omega_' . $GLOBALS['theme'] . '_theme_settings_warning'); drupal_set_message(t('The settings for this theme are currently served from a variable. You might want to export them to your .info file.'), 'warning'); } // Rebuild the theme registry / aggregates on every page load if the // development extension is enabled and configured to do so. if (omega_theme_get_setting('omega_rebuild_theme_registry', FALSE)) { // Rebuild the theme data. system_rebuild_theme_data(); // Rebuild the theme registry. drupal_theme_rebuild(); if (flood_is_allowed('omega_' . $GLOBALS['theme'] . '_rebuild_registry_warning', 3)) { // Alert the user that the theme registry is being rebuilt on every // request. flood_register_event('omega_' . $GLOBALS['theme'] . '_rebuild_registry_warning'); drupal_set_message(t('The theme registry is being rebuilt on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => url('admin/appearance/settings/' . $GLOBALS['theme']))), 'warning'); }
/** * Log a PHP error or exception, display an error page in fatal cases. * * @param $error * An array with the following keys: %type, %message, %function, %file, %line. * @param $fatal * TRUE if the error is fatal. */ function _error_log($error, $fatal = FALSE) { print_r($error); return; // Initialize a maintenance theme if the boostrap was not complete. // Do it early because drupal_set_message() triggers a drupal_theme_initialize(). if ($fatal && drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL) { unset($GLOBALS['theme']); if (!defined('MAINTENANCE_MODE')) { define('MAINTENANCE_MODE', 'error'); } drupal_maintenance_theme(); } // When running inside the testing framework, we relay the errors // to the tested site by the way of HTTP headers. if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^simpletest\\d+;/", $_SERVER['HTTP_USER_AGENT']) && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS)) { // $number does not use drupal_static as it should not be reset // as it uniquely identifies each PHP error. static $number = 0; $assertion = array($error['%message'], $error['%type'], array('function' => $error['%function'], 'file' => $error['%file'], 'line' => $error['%line'])); header('X-Drupal-Assertion-' . $number . ': ' . rawurlencode(serialize($assertion))); $number++; } try { watchdog('php', '%type: %message in %function (line %line of %file).', $error, $error['severity_level']); } catch (Exception $e) { // Ignore any additional watchdog exception, as that probably means // that the database was not initialized correctly. } if ($fatal) { drupal_add_http_header('500 Service unavailable (with message)'); } if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { if ($fatal) { // When called from JavaScript, simply output the error message. print t('%type: %message in %function (line %line of %file).', $error); exit; } } else { // Display the message if the current error reporting level allows this type // of message to be displayed, and unconditionnaly in update.php. $error_level = variable_get('error_level', ERROR_REPORTING_DISPLAY_ALL); $display_error = $error_level == ERROR_REPORTING_DISPLAY_ALL || $error_level == ERROR_REPORTING_DISPLAY_SOME && $error['%type'] != 'Notice'; if ($display_error || defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') { $class = 'error'; // If error type is 'User notice' then treat it as debug information // instead of an error message, see dd(). if ($error['%type'] == 'User notice') { $error['%type'] = 'Debug'; $class = 'status'; } drupal_set_message(t('%type: %message in %function (line %line of %file).', $error), $class); } if ($fatal) { drupal_set_title(t('Error')); // We fallback to a maintenance page at this point, because the page generation // itself can generate errors. print theme('maintenance_page', array('content' => t('The website encountered an unexpected error. Please try again later.'))); exit; } } }