本文整理汇总了PHP中TYPO3\CMS\Core\Utility\DebugUtility类的典型用法代码示例。如果您正苦于以下问题:PHP DebugUtility类的具体用法?PHP DebugUtility怎么用?PHP DebugUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DebugUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toString
/**
* Returns the internal debug messages as a string.
*
* @return string
*/
public function toString()
{
$messagesAsString = '';
if (!empty($this->debugMessages)) {
$messagesAsString = \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->debugMessages);
}
return $messagesAsString;
}
示例2: 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();
}
}
示例3: writeDebugMessage
/**
* @param $parameters
*/
protected function writeDebugMessage($parameters)
{
$message = isset($parameters['msg']) ? $parameters['msg'] : '';
if (TYPO3_MODE == 'BE') {
DebugUtility::debug($parameters, $parameters['extKey'], 'DevLog ext:solr: ' . $message);
} else {
echo $message . ':<br/>';
DebuggerUtility::var_dump($parameters);
}
}
示例4: getParams
public function getParams($PA, $fobj)
{
$params = unserialize($PA['itemFormElValue']);
$output = '<input
readonly="readonly" style="display:none"
name="' . $PA['itemFormElName'] . '"
value="' . htmlspecialchars($PA['itemFormElValue']) . '"
onchange="' . htmlspecialchars(implode('', $PA['fieldChangeFunc'])) . '"
' . $PA['onFocus'] . '/>
';
$output .= \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($params);
return $output;
}
示例5: outputDebugLog
/**
* Prints the messages to the screen
*
* @return void
*/
public function outputDebugLog()
{
$out = '';
foreach ($this->debugLog as $section => $logData) {
$out .= $this->globals->getCObj()->wrap($section, $this->utilityFuncs->getSingle($this->settings, 'sectionHeaderWrap'));
$sectionContent = '';
foreach ($logData as $messageData) {
$message = str_replace("\n", '<br />', $messageData['message']);
$message = $this->globals->getCObj()->wrap($message, $this->utilityFuncs->getSingle($this->settings['severityWrap.'], $messageData['severity']));
$sectionContent .= $this->globals->getCObj()->wrap($message, $this->settings['messageWrap']);
if ($messageData['data']) {
$sectionContent .= \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($messageData['data']);
$sectionContent .= '<br />';
}
}
$out .= $this->globals->getCObj()->wrap($sectionContent, $this->utilityFuncs->getSingle($this->settings, 'sectionWrap'));
}
print $out;
}
示例6: 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);
}
示例7: printLogMgm
/**
* Printing the debug-log from the DBAL extension
*
* To enabled debugging, you will have to enabled it in the configuration!
*
* @return string HTML content
*/
protected function printLogMgm()
{
// Disable debugging in any case...
$GLOBALS['TYPO3_DB']->debug = false;
// Get cmd:
$cmd = (string) GeneralUtility::_GP('cmd');
switch ($cmd) {
case 'flush':
$res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog');
$res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog_where');
$outStr = 'Log FLUSHED!';
break;
case 'joins':
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('table_join,exec_time,query,script', 'tx_dbal_debuglog', 'table_join!=\'\'', 'table_join,script,exec_time,query');
// Init vars in which to pick up the query result:
$tableIndex = array();
$tRows = array();
$tRows[] = '
<tr>
<td>Execution time</td>
<td>Table joins</td>
<td>Script</td>
<td>Query</td>
</tr>';
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$tableArray = $GLOBALS['TYPO3_DB']->SQLparser->parseFromTables($row['table_join']);
// Create table name index:
foreach ($tableArray as $a) {
foreach ($tableArray as $b) {
if ($b['table'] != $a['table']) {
$tableIndex[$a['table']][$b['table']] = 1;
}
}
}
// Create output row
$tRows[] = '
<tr>
<td>' . htmlspecialchars($row['exec_time']) . '</td>
<td>' . htmlspecialchars($row['table_join']) . '</td>
<td>' . htmlspecialchars($row['script']) . '</td>
<td>' . htmlspecialchars($row['query']) . '</td>
</tr>';
}
// Printing direct joins:
$outStr .= '<h4>Direct joins:</h4>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($tableIndex);
// Printing total dependencies:
foreach ($tableIndex as $priTable => $a) {
foreach ($tableIndex as $tableN => $v) {
foreach ($v as $tableP => $vv) {
if ($tableP == $priTable) {
$tableIndex[$priTable] = array_merge($v, $a);
}
}
}
}
$outStr .= '<h4>Total dependencies:</h4>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($tableIndex);
// Printing data rows:
$outStr .= '
<table border="1" cellspacing="0">' . implode('', $tRows) . '
</table>';
break;
case 'errors':
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('serdata,exec_time,query,script', 'tx_dbal_debuglog', 'errorFlag>0', '', 'tstamp DESC');
// Init vars in which to pick up the query result:
$tRows = array();
$tRows[] = '
<tr>
<td>Execution time</td>
<td>Error data</td>
<td>Script</td>
<td>Query</td>
</tr>';
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// Create output row
$tRows[] = '
<tr>
<td>' . htmlspecialchars($row['exec_time']) . '</td>
<td>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray(unserialize($row['serdata'])) . '</td>
<td>' . htmlspecialchars($row['script']) . '</td>
<td>' . htmlspecialchars($row['query']) . '</td>
</tr>';
}
// Printing data rows:
$outStr .= '
<table border="1" cellspacing="0">' . implode('', $tRows) . '
</table>';
break;
case 'parsing':
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('query,serdata', 'tx_dbal_debuglog', 'errorFlag&2=2');
$tRows = array();
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// Create output row
$tRows[] = '
//.........这里部分代码省略.........
示例8: replaceFile
/**
* Replaces a file with file in local file system.
*
* @param string $fileIdentifier
* @param string $localFilePath
* @return bool TRUE if the operation succeeded
*/
public function replaceFile($fileIdentifier, $localFilePath)
{
DebugUtility::debug(__FUNCTION__, 'Method');
$this->cache->flush();
}
示例9: printErrorLog
/**
* Returns a table with the error-messages.
*
* @return string HTML print of error log
*/
public function printErrorLog()
{
return !empty($this->errorLog) ? DebugUtility::viewArray($this->errorLog) : '';
}
示例10: debug
/**
* Debugging var with header and group.
*
* @param mixed $var Var
* @param string $header Header
* @param string $group Group
*
* @return void
*/
protected function debug($var, $header, $group)
{
if ($this->debug) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($var, $header, $group);
}
}
示例11: getData
//.........这里部分代码省略.........
}
break;
case 'date':
if (!$key) {
$key = 'd/m Y';
}
$retVal = date($key, $GLOBALS['EXEC_TIME']);
break;
case 'page':
$retVal = $tsfe->page[$key];
break;
case 'pagelayout':
// Check if the current page has a value in the DB field "backend_layout"
// if empty, check the root line for "backend_layout_next_level"
// same as
// field = backend_layout
// ifEmpty.data = levelfield:-2, backend_layout_next_level, slide
// ifEmpty.ifEmpty = default
$retVal = $GLOBALS['TSFE']->page['backend_layout'];
// If it is set to "none" - don't use any
if ($retVal === '-1') {
$retVal = 'none';
} elseif ($retVal === '' || $retVal === '0') {
// If it not set check the root-line for a layout on next level and use this
// Remove first element, which is the current page
// See also \TYPO3\CMS\Backend\View\BackendLayoutView::getSelectedCombinedIdentifier()
$rootLine = $tsfe->rootLine;
array_shift($rootLine);
foreach ($rootLine as $rootLinePage) {
$retVal = (string) $rootLinePage['backend_layout_next_level'];
// If layout for "next level" is set to "none" - don't use any and stop searching
if ($retVal === '-1') {
$retVal = 'none';
break;
} elseif ($retVal !== '' && $retVal !== '0') {
// Stop searching if a layout for "next level" is set
break;
}
}
}
if ($retVal === '0' || $retVal === '') {
$retVal = 'default';
}
break;
case 'current':
$retVal = $this->data[$this->currentValKey];
break;
case 'db':
$selectParts = GeneralUtility::trimExplode(':', $key);
$db_rec = $tsfe->sys_page->getRawRecord($selectParts[0], $selectParts[1]);
if (is_array($db_rec) && $selectParts[2]) {
$retVal = $db_rec[$selectParts[2]];
}
break;
case 'lll':
$retVal = $tsfe->sL('LLL:' . $key);
break;
case 'path':
$retVal = $tsfe->tmpl->getFileName($key);
break;
case 'cobj':
switch ($key) {
case 'parentRecordNumber':
$retVal = $this->parentRecordNumber;
break;
}
break;
case 'debug':
switch ($key) {
case 'rootLine':
$retVal = DebugUtility::viewArray($tsfe->tmpl->rootLine);
break;
case 'fullRootLine':
$retVal = DebugUtility::viewArray($tsfe->rootLine);
break;
case 'data':
$retVal = DebugUtility::viewArray($this->data);
break;
case 'register':
$retVal = DebugUtility::viewArray($tsfe->register);
break;
case 'page':
$retVal = DebugUtility::viewArray($tsfe->page);
break;
}
break;
}
}
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
if (!$hookObject instanceof ContentObjectGetDataHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface ' . ContentObjectGetDataHookInterface::class, 1195044480);
}
$retVal = $hookObject->getDataExtension($string, $fieldArray, $secVal, $retVal, $this);
}
}
}
return $retVal;
}
示例12: 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;
}
示例13: saveMail
/**
* Save mail on submit
*
* @param Mail $mail
* @return void
*/
protected function saveMail(Mail &$mail = null)
{
$marketingInfos = SessionUtility::getMarketingInfos();
$mail->setPid(FrontendUtility::getStoragePage($this->settings['main']['pid']))->setSenderMail($this->mailRepository->getSenderMailFromArguments($mail))->setSenderName($this->mailRepository->getSenderNameFromArguments($mail))->setSubject($this->settings['receiver']['subject'])->setReceiverMail($this->settings['receiver']['email'])->setBody(DebugUtility::viewArray($this->mailRepository->getVariablesWithMarkersFromMail($mail)))->setSpamFactor(SessionUtility::getSpamFactorFromSession())->setTime(time() - SessionUtility::getFormStartFromSession($mail->getForm()->getUid(), $this->settings))->setUserAgent(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'))->setMarketingRefererDomain($marketingInfos['refererDomain'])->setMarketingReferer($marketingInfos['referer'])->setMarketingCountry($marketingInfos['country'])->setMarketingMobileDevice($marketingInfos['mobileDevice'])->setMarketingFrontendLanguage($marketingInfos['frontendLanguage'])->setMarketingBrowserLanguage($marketingInfos['browserLanguage'])->setMarketingPageFunnel($marketingInfos['pageFunnel']);
if (FrontendUtility::isLoggedInFrontendUser()) {
$mail->setFeuser($this->userRepository->findByUid(FrontendUtility::getPropertyFromLoggedInFrontendUser('uid')));
}
if (!ConfigurationUtility::isDisableIpLogActive()) {
$mail->setSenderIp(GeneralUtility::getIndpEnv('REMOTE_ADDR'));
}
if ($this->settings['main']['optin'] || $this->settings['db']['hidden']) {
$mail->setHidden(true);
}
foreach ($mail->getAnswers() as $answer) {
$answer->setPid(FrontendUtility::getStoragePage($this->settings['main']['pid']));
}
$this->mailRepository->add($mail);
$this->persistenceManager->persistAll();
}
示例14: storeInIndex
/**
* store collected data of defined indexers to db
* @param integer $storagePid
* @param string $title
* @param string $type
* @param integer $targetPid
* @param string $content
* @param string $tags
* @param string $params
* @param string $abstract
* @param integer $language
* @param integer $starttime
* @param integer $endtime
* @param string $fe_group
* @param boolean $debugOnly
* @param array $additionalFields
* @return boolean|integer
*/
public function storeInIndex($storagePid, $title, $type, $targetPid, $content, $tags = '', $params = '', $abstract = '', $language = 0, $starttime = 0, $endtime = 0, $fe_group = '', $debugOnly = false, $additionalFields = array())
{
// if there are errors found in current record return false and break processing
if (!$this->checkIfRecordHasErrorsBeforeIndexing($storagePid, $title, $type, $targetPid)) {
return false;
}
// optionally add tag set in the indexer configuration
if (!empty($this->indexerConfig['filteroption']) && (substr($type, 0, 4) != 'file' || substr($type, 0, 4) == 'file' && $this->indexerConfig['index_use_page_tags_for_files'] || $this->indexerConfig['type'] == 'file')) {
$indexerTag = $this->getTag($this->indexerConfig['filteroption']);
$tagChar = $this->extConf['prePostTagChar'];
if ($tags) {
$tags .= ',' . $tagChar . $indexerTag . $tagChar;
} else {
$tags = $tagChar . $indexerTag . $tagChar;
}
$tags = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($tags);
}
$table = 'tx_kesearch_index';
$fieldValues = $this->createFieldValuesForIndexing($storagePid, $title, $type, $targetPid, $content, $tags, $params, $abstract, $language, $starttime, $endtime, $fe_group, $additionalFields);
// check if record already exists
if (substr($type, 0, 4) == 'file') {
$recordExists = $this->checkIfFileWasIndexed($fieldValues['type'], $fieldValues['hash']);
} else {
$recordExists = $this->checkIfRecordWasIndexed($fieldValues['orig_uid'], $fieldValues['pid'], $fieldValues['type'], $fieldValues['language']);
}
if ($recordExists) {
// update existing record
$where = 'uid=' . intval($this->currentRow['uid']);
unset($fieldValues['crdate']);
if ($debugOnly) {
// do not process - just debug query
\TYPO3\CMS\Core\Utility\DebugUtility::debug($GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fieldValues), 1);
} else {
// process storing of index record and return uid
$this->updateRecordInIndex($fieldValues);
return true;
}
} else {
// insert new record
if ($debugOnly) {
// do not process - just debug query
\TYPO3\CMS\Core\Utility\DebugUtility::debug($GLOBALS['TYPO3_DB']->INSERTquery($table, $fieldValues, false));
} else {
// process storing of index record and return uid
$this->insertRecordIntoIndex($fieldValues);
return $GLOBALS['TYPO3_DB']->sql_insert_id();
}
}
}
示例15: renderAllTemplate
/**
* Template rendering for subdatas and principal datas
*
* @param array $templateMarkers
* @param string $templateSection
* @param boolean $debug
* @return string HTML code
*/
public function renderAllTemplate($templateMarkers, $templateSection, $debug = false)
{
// Check if the template is loaded
if (!$this->templateContent) {
return false;
}
// Check argument
if (!is_array($templateMarkers)) {
return false;
}
if ($debug === true) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($templateMarkers, 'Markers for ' . $templateSection);
}
$content = '';
if (is_array($templateMarkers[0])) {
foreach ($templateMarkers as $markers) {
$content .= $this->renderAllTemplate($markers, $templateSection, $debug);
}
} else {
$content = $this->renderSingle($templateMarkers, $templateSection);
}
return $this->cleanTemplate($content);
}