public function execAndProfileQuery($query, $type) { if (empty($GLOBALS['TYPO3_DB']->mysqlprofilerConf['excludeTables'])) { $this->init(); } $isProfiling = $this->isProfiling($query, $type); if ($isProfiling) { $begin = microtime(true); } // exec query if (Typo3profiler_Utility_Compatibility::intFromVer(TYPO3_version) > 6000000) { if (!$this->isConnected) { $this->connectDB(); } $res = $this->link->query($query); } else { $res = mysql_query($query, $this->link); } if ($isProfiling) { $deltatime = round((microtime(true) - $begin) * 1000, 8); if ($GLOBALS['TSFE']->id == 0) { $debugFunc = $this->get_caller_method(3); } else { $debugFunc = $this->get_caller_method(2); } if (TYPO3_MODE == 'BE') { $debugFunc = $this->get_caller_method(3); } $debug = array('type' => $type, 'query' => $query, 'time' => $deltatime, 'backtrace' => $debugFunc, 'typo3mode' => TYPO3_MODE, 'page' => $GLOBALS['TSFE']->id !== null ? $GLOBALS['TSFE']->id : ''); if ($GLOBALS['TYPO3_DB']->mysqlprofilerConf['debugbarenabled'] == 1) { if (\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) { $GLOBALS['debugbar']['queries']->info('[' . $deltatime . '] ' . $query . ' --> ' . $debugFunc['file'] . ' @ ' . $debugFunc['line'] . ' : ' . $debugFunc['function']); } } $this->profiledQueries[] = $debug; if (TYPO3_MODE == 'BE') { $this->cleanSqlLog(); $this->insertSqlLog($debug); } } return $res; }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('typo3profiler'); require_once $extensionPath . 'Classes/Utility/Compatibility.php'; require_once $extensionPath . 'Classes/Utility/Debugbar.php'; $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['typo3profiler']); if ($conf['enabled'] == 1) { // For profiling rendering $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_eofe']['typo3profiler'] = 'EXT:typo3profiler/Classes/Hook/class.user_typo3profiler_hooks.php:&user_typo3profiler->contentPostProc'; $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit']['typo3profiler'] = 'EXT:typo3profiler/Classes/Hook/class.user_typo3profiler_hooks.php:&user_typo3profiler'; if (Typo3profiler_Utility_Compatibility::intFromVer(TYPO3_version) > 6000000) { require_once $extensionPath . 'Classes/Xclass/DatabaseConnection.php'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Core\\Database\\DatabaseConnection'] = array('className' => 'Typo3profiler_Xclass_DatabaseConnection'); } } if ($conf['debugbarenabled'] == 1) { Typo3profiler_Utility_Debugbar::init(); }
public static function renderTyposcript() { $typoscript = array(); foreach ($GLOBALS['TSFE']->tmpl->setup as $setupKey => $setup) { $GLOBALS['TSFE']->tmpl->setup[$setupKey] = str_replace(array("\n", "\r", "\r\n"), array('', '', ''), Typo3profiler_Utility_Compatibility::viewArray($setup)); } $GLOBALS['debugbar']['typoscript']->setData(self::mdArrayMap('utf8_encode', $GLOBALS['TSFE']->tmpl->setup)); }