<?php // prepare fields $dbgjson = $csp_debugger->getJsonOutput(); $dbgstored = $csp_debugger->getStoredVariables(); $dbglog = \caspar\core\Logging::getEntries(); $dbgpartials = $csp_debugger->getPartials(); if (\b2db\Core::isConnected()) { $dbgqueries = \b2db\Core::getSQLHits(); $dbgquerytime = \b2db\Core::getSQLTiming(); $dbgquerycount = \b2db\Core::getSQLCount(); } ?> <div class="csp-dbg-entry-row" id="csp-dbg-row-<?php echo $cspdbgrow; ?> "> <?php if ($csp_debugger->isAjaxRequest()) { ?> AJAX Request<?php } else { ?> This page<?php } ?> - <?php echo $csp_debugger->getRouting()->getCurrentRouteName(); ?> <span class="csp-dbg-entry-timestamp">
protected static function generateDebugInfo() { $tbg_summary = array(); $load_time = self::getLoadtime(); if (\b2db\Core::isInitialized()) { $tbg_summary['db']['queries'] = \b2db\Core::getSQLHits(); $tbg_summary['db']['timing'] = \b2db\Core::getSQLTiming(); } $tbg_summary['load_time'] = $load_time >= 1 ? round($load_time, 2) . 's' : round($load_time * 1000, 1) . 'ms'; $tbg_summary['scope'] = array(); $scope = self::getScope(); $tbg_summary['scope']['id'] = $scope instanceof TBGScope ? $scope->getID() : 'unknown'; $tbg_summary['scope']['hostnames'] = $scope instanceof TBGScope && \b2db\Core::isConnected() ? implode(', ', $scope->getHostnames()) : 'unknown'; $tbg_summary['settings'] = TBGSettings::getAll(); $tbg_summary['memory'] = memory_get_usage(); $tbg_summary['partials'] = self::getVisitedPartials(); if (self::$_i18n instanceof TBGI18n) { foreach (self::getI18n()->getMissingStrings() as $text => $value) { TBGLogging::log('The text "' . $text . '" does not exist in list of translated strings, and was added automatically', 'i18n', TBGLogging::LEVEL_NOTICE); } } $tbg_summary['log'] = TBGLogging::getEntries(); $tbg_summary['routing'] = array('name' => self::getRouting()->getCurrentRouteName(), 'module' => self::getRouting()->getCurrentRouteModule(), 'action' => self::getRouting()->getCurrentRouteAction()); if (isset($_SESSION)) { if (!array_key_exists('___DEBUGINFO___', $_SESSION)) { $_SESSION['___DEBUGINFO___'] = array(); } $_SESSION['___DEBUGINFO___'][self::$debug_id] = $tbg_summary; while (count($_SESSION['___DEBUGINFO___']) > 10) { array_shift($_SESSION['___DEBUGINFO___']); } } }
protected static function generateDebugInfo() { $tbg_summary = array(); $load_time = self::getLoadtime(); if (\b2db\Core::isInitialized()) { $tbg_summary['db']['queries'] = \b2db\Core::getSQLHits(); $tbg_summary['db']['timing'] = \b2db\Core::getSQLTiming(); $tbg_summary['db']['objectpopulation'] = \b2db\Core::getObjectPopulationHits(); $tbg_summary['db']['objecttiming'] = \b2db\Core::getObjectPopulationTiming(); $tbg_summary['db']['objectcount'] = \b2db\Core::getObjectPopulationCount(); } $tbg_summary['load_time'] = $load_time >= 1 ? round($load_time, 2) . 's' : round($load_time * 1000, 1) . 'ms'; $tbg_summary['scope'] = array(); $scope = self::getScope(); $tbg_summary['scope']['id'] = $scope instanceof Scope ? $scope->getID() : 'unknown'; $tbg_summary['scope']['hostnames'] = $scope instanceof Scope && \b2db\Core::isConnected() ? implode(', ', $scope->getHostnames()) : 'unknown'; $tbg_summary['settings'] = Settings::getAll(); $tbg_summary['memory'] = memory_get_usage(); $tbg_summary['partials'] = self::getVisitedPartials(); $tbg_summary['log'] = Logging::getEntries(); $tbg_summary['routing'] = array('name' => self::getRouting()->getCurrentRouteName(), 'module' => self::getRouting()->getCurrentRouteModule(), 'action' => self::getRouting()->getCurrentRouteAction()); if (isset($_SESSION)) { if (!array_key_exists('___DEBUGINFO___', $_SESSION)) { $_SESSION['___DEBUGINFO___'] = array(); } $_SESSION['___DEBUGINFO___'][self::$debug_id] = $tbg_summary; while (count($_SESSION['___DEBUGINFO___']) > 25) { array_shift($_SESSION['___DEBUGINFO___']); } } }
public static function calculateTimings(&$csp_summary) { $load_time = self::getLoadtime(); if (self::getB2DBInstance() instanceof \b2db\Connection) { $csp_summary['db_queries'] = \b2db\Core::getSQLHits(); $csp_summary['db_timing'] = \b2db\Core::getSQLTiming(); } $csp_summary['load_time'] = $load_time >= 1 ? round($load_time, 2) . ' seconds' : round($load_time * 1000, 1) . 'ms'; self::ping(); }