本文整理汇总了PHP中TYPO3\CMS\Core\Utility\DebugUtility::debugTrail方法的典型用法代码示例。如果您正苦于以下问题:PHP DebugUtility::debugTrail方法的具体用法?PHP DebugUtility::debugTrail怎么用?PHP DebugUtility::debugTrail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\DebugUtility
的用法示例。
在下文中一共展示了DebugUtility::debugTrail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDebugTrail
/**
* @return string
*/
public static function getDebugTrail()
{
tx_rnbase::load('tx_rnbase_util_TYPO3');
if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) {
return \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
} else {
return t3lib_utility_Debug::debugTrail();
}
}
示例2: logDeprecatedFunction
/**
* Logs a call to a deprecated function.
* The log message will be taken from the annotation.
*
* @return void
*/
public static function logDeprecatedFunction()
{
if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) {
return;
}
// This require_once is needed for deprecation calls
// thrown early during bootstrap, if the autoloader is
// not instantiated yet. This can happen for example if
// ext_localconf triggers a deprecation.
require_once 'DebugUtility.php';
$trail = debug_backtrace();
if ($trail[1]['type']) {
$function = new \ReflectionMethod($trail[1]['class'], $trail[1]['function']);
} else {
$function = new \ReflectionFunction($trail[1]['function']);
}
$msg = '';
if (preg_match('/@deprecated\\s+(.*)/', $function->getDocComment(), $match)) {
$msg = $match[1];
}
// Write a longer message to the deprecation log: <function> <annotion> - <trace> (<source>)
$logMsg = $trail[1]['class'] . $trail[1]['type'] . $trail[1]['function'];
$logMsg .= '() - ' . $msg . ' - ' . \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
$logMsg .= ' (' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($function->getFileName()) . '#' . $function->getStartLine() . ')';
self::deprecationLog($logMsg);
}
示例3: explain
/**
* Explain select queries
* If $this->explainOutput is set, SELECT queries will be explained here. Only queries with more than one possible result row will be displayed.
* The output is either printed as raw HTML output or embedded into the TS admin panel (checkbox must be enabled!)
*
* @todo Feature is not DBAL-compliant
*
* @param string $query SQL query
* @param string $from_table Table(s) from which to select. This is what comes right after "FROM ...". Required value.
* @param int $row_count Number of resulting rows
* @return bool TRUE if explain was run, FALSE otherwise
*/
protected function explain($query, $from_table, $row_count)
{
$debugAllowedForIp = GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']);
if ((int) $this->explainOutput == 1 || (int) $this->explainOutput == 2 && $debugAllowedForIp) {
// Raw HTML output
$explainMode = 1;
} elseif ((int) $this->explainOutput == 3 && is_object($GLOBALS['TT'])) {
// Embed the output into the TS admin panel
$explainMode = 2;
} else {
return false;
}
$error = $this->sql_error();
$trail = \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
$explain_tables = array();
$explain_output = array();
$res = $this->sql_query('EXPLAIN ' . $query, $this->link);
if (is_a($res, '\\mysqli_result')) {
while ($tempRow = $this->sql_fetch_assoc($res)) {
$explain_output[] = $tempRow;
$explain_tables[] = $tempRow['table'];
}
$this->sql_free_result($res);
}
$indices_output = array();
// Notice: Rows are skipped if there is only one result, or if no conditions are set
if ($explain_output[0]['rows'] > 1 || GeneralUtility::inList('ALL', $explain_output[0]['type'])) {
// Only enable output if it's really useful
$debug = true;
foreach ($explain_tables as $table) {
$tableRes = $this->sql_query('SHOW TABLE STATUS LIKE \'' . $table . '\'');
$isTable = $this->sql_num_rows($tableRes);
if ($isTable) {
$res = $this->sql_query('SHOW INDEX FROM ' . $table, $this->link);
if (is_a($res, '\\mysqli_result')) {
while ($tempRow = $this->sql_fetch_assoc($res)) {
$indices_output[] = $tempRow;
}
$this->sql_free_result($res);
}
}
$this->sql_free_result($tableRes);
}
} else {
$debug = false;
}
if ($debug) {
if ($explainMode) {
$data = array();
$data['query'] = $query;
$data['trail'] = $trail;
$data['row_count'] = $row_count;
if ($error) {
$data['error'] = $error;
}
if (!empty($explain_output)) {
$data['explain'] = $explain_output;
}
if (!empty($indices_output)) {
$data['indices'] = $indices_output;
}
if ($explainMode == 1) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($data, 'Tables: ' . $from_table, 'DB SQL EXPLAIN');
} elseif ($explainMode == 2) {
$GLOBALS['TT']->setTSselectQuery($data);
}
}
return true;
}
return false;
}
示例4: logDeprecatedFunction
/**
* Logs a call to a deprecated function.
* The log message will be taken from the annotation.
*
* @return void
*/
public static function logDeprecatedFunction()
{
if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) {
return;
}
$trail = debug_backtrace();
if ($trail[1]['type']) {
$function = new \ReflectionMethod($trail[1]['class'], $trail[1]['function']);
} else {
$function = new \ReflectionFunction($trail[1]['function']);
}
$msg = '';
if (preg_match('/@deprecated\\s+(.*)/', $function->getDocComment(), $match)) {
$msg = $match[1];
}
// Trigger PHP error with a short message: <function> is deprecated (called from <source>, defined in <source>)
$errorMsg = 'Function ' . $trail[1]['function'];
if ($trail[1]['class']) {
$errorMsg .= ' of class ' . $trail[1]['class'];
}
$errorMsg .= ' is deprecated (called from ' . $trail[1]['file'] . '#' . $trail[1]['line'] . ', defined in ' . $function->getFileName() . '#' . $function->getStartLine() . ')';
// Write a longer message to the deprecation log: <function> <annotion> - <trace> (<source>)
$logMsg = $trail[1]['class'] . $trail[1]['type'] . $trail[1]['function'];
$logMsg .= '() - ' . $msg . ' - ' . \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
$logMsg .= ' (' . substr($function->getFileName(), strlen(PATH_site)) . '#' . $function->getStartLine() . ')';
self::deprecationLog($logMsg);
}