/** * {@inheritdoc} */ public function collect(Request $request, Response $response, \Exception $exception = null) { $this->data = array('queries' => array()); foreach (array_keys($GLOBALS['databases']) as $key) { $this->data['queries'][$key] = \Database::getLog('devel', $key); } }
/** * Collects data from a single TraceablePDO instance * * @return array */ protected function collectPDO($name) { $stmts = array(); foreach (Database::getLog('debugbar', $name) as $stmt) { $conn = Database::getConnection('default', $name); $quoted = array(); foreach ((array) $stmt['args'] as $key => $val) { $quoted[$key] = $conn->quote($val); } $output = strtr($stmt['query'], $quoted); $stmts[] = array('sql' => $this->renderSqlWithParams ? $output : $stmt['query'], 'prepared_stmt' => $stmt['query'], 'params' => $stmt['args'], 'duration' => $stmt['time'], 'duration_str' => $this->getDataFormatter()->formatDuration($stmt['time'])); } return array('nb_statements' => count($stmts), 'statements' => $stmts); }
/** * 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; } }