本文整理汇总了PHP中TYPO3\CMS\Core\Utility\DebugUtility::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP DebugUtility::debug方法的具体用法?PHP DebugUtility::debug怎么用?PHP DebugUtility::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\DebugUtility
的用法示例。
在下文中一共展示了DebugUtility::debug方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: debug
/**
* Makes debug output
* Prints $var in bold between two vertical lines
* If not $var the word 'debug' is printed
* If $var is an array, the array is printed by t3lib_div::print_array()
* Wrapper method for TYPO3 debug methods
*
* @param mixed Variable to print
* @param string The header.
* @param string Group for the debug console
* @return void
*/
public static function debug($var = '', $header = '', $group = 'Debug')
{
if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) {
return \TYPO3\CMS\Core\Utility\DebugUtility::debug($var, $header, $group);
} else {
return t3lib_utility_Debug::debug($var, $header, $group);
}
}
示例2: 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);
}
}
示例3: deprecationLog
/**
* Writes a message to the deprecation log.
*
* @param string $msg Message (in English).
* @return void
*/
public static function deprecationLog($msg)
{
if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) {
return;
}
// Legacy values (no strict comparison, $log can be boolean, string or int)
$log = $GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'];
if ($log === TRUE || $log == '1') {
$log = array('file');
} else {
$log = self::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'], TRUE);
}
$date = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] . ': ');
if (in_array('file', $log) !== FALSE) {
// In case lock is acquired before autoloader was defined:
if (class_exists('TYPO3\\CMS\\Core\\Locking\\Locker') === FALSE) {
require_once ExtensionManagementUtility::extPath('core') . 'Classes/Locking/Locker.php';
}
// Write a longer message to the deprecation log
$destination = self::getDeprecationLogFileName();
$file = @fopen($destination, 'a');
if ($file) {
@fwrite($file, $date . $msg . LF);
@fclose($file);
self::fixPermissions($destination);
}
}
if (in_array('devlog', $log) !== FALSE) {
// Copy message also to the developer log
self::devLog($msg, 'Core', self::SYSLOG_SEVERITY_WARNING);
}
// Do not use console in login screen
if (in_array('console', $log) !== FALSE && isset($GLOBALS['BE_USER']->user['uid'])) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($msg, $date, 'Deprecation Log');
}
}
示例4: 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);
}
}
示例5: 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;
}
示例6: deprecationLog
/**
* Writes a message to the deprecation log.
*
* @param string $msg Message (in English).
* @return void
*/
public static function deprecationLog($msg)
{
if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) {
return;
}
$log = $GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'];
$date = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] . ': ');
// Legacy values (no strict comparison, $log can be boolean, string or int)
if ($log === TRUE || $log == '1') {
$log = 'file';
}
if (stripos($log, 'file') !== FALSE) {
// In case lock is acquired before autoloader was defined:
if (class_exists('TYPO3\\CMS\\Core\\Locking\\Locker') === FALSE) {
require_once PATH_t3lib . 'class.t3lib_lock.php';
}
// Write a longer message to the deprecation log
$destination = self::getDeprecationLogFileName();
$lockObject = self::makeInstance('TYPO3\\CMS\\Core\\Locking\\Locker', $destination, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
/** @var \TYPO3\CMS\Core\Locking\Locker $lockObject */
$lockObject->setEnableLogging(FALSE);
$lockObject->acquire();
$file = @fopen($destination, 'a');
if ($file) {
@fwrite($file, $date . $msg . LF);
@fclose($file);
self::fixPermissions($destination);
}
$lockObject->release();
}
if (stripos($log, 'devlog') !== FALSE) {
// Copy message also to the developer log
self::devLog($msg, 'Core', self::SYSLOG_SEVERITY_WARNING);
}
// Do not use console in login screen
if (stripos($log, 'console') !== FALSE && isset($GLOBALS['BE_USER']->user['uid'])) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($msg, $date, 'Deprecation Log');
}
}
示例7: init
/**
* Calling function that checks system, IM, GD, dirs, database
* and lets you alter localconf.php
*
* This method is called from init.php to start the Install Tool.
*
* @return void
* @todo Define visibility
*/
public function init()
{
// Must be called after inclusion of init.php (or from init.php)
if (!defined('PATH_typo3')) {
die;
}
if (!$this->passwordOK) {
die;
}
// Setting stuff...
$this->check_mail();
$this->setupGeneral();
$this->generateConfigForm();
if (count($this->messages)) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($this->messages);
}
if ($this->step) {
$this->output($this->outputWrapper($this->stepOutput()));
} else {
// Menu...
switch ($this->INSTALL['type']) {
case 'images':
$this->checkIM = 1;
$this->checkTheConfig();
$this->silent = 0;
$this->checkTheImageProcessing();
break;
case 'database':
$this->checkTheConfig();
$this->silent = 0;
$this->checkTheDatabase();
break;
case 'update':
$this->checkDatabase();
$this->silent = 0;
$this->updateWizard();
break;
case 'config':
$this->silent = 0;
$this->checkIM = 1;
$this->message('About configuration', 'How to configure TYPO3', $this->generallyAboutConfiguration());
$isPhpCgi = PHP_SAPI == 'fpm-fcgi' || PHP_SAPI == 'cgi' || PHP_SAPI == 'isapi' || PHP_SAPI == 'cgi-fcgi';
$this->message('System Information', 'Your system has the following configuration', '
<dl id="systemInformation">
<dt>OS detected:</dt>
<dd>' . (TYPO3_OS == 'WIN' ? 'WIN' : 'UNIX') . '</dd>
<dt>CGI detected:</dt>
<dd>' . ($isPhpCgi ? 'YES' : 'NO') . '</dd>
<dt>PATH_thisScript:</dt>
<dd>' . PATH_thisScript . '</dd>
</dl>
');
$this->checkTheConfig();
$ext = 'Write configuration';
if ($this->fatalError) {
if ($this->config_array['no_database'] || !$this->config_array['mysqlConnect']) {
$this->message($ext, 'Database not configured yet!', '
<p>
You need to specify database username,
password and host as one of the first things.
<br />
Next you\'ll have to select a database to
use with TYPO3.
</p>
<p>
Use the form below.
</p>
', 2);
} else {
$this->message($ext, 'Fatal error encountered!', '
<p>
Somewhere above a fatal configuration
problem is encountered.
Please make sure that you\'ve fixed this
error before you submit the configuration.
TYPO3 will not run if this problem is not
fixed!
<br />
You should also check all warnings that may
appear.
</p>
', 2);
}
} elseif ($this->mode == '123') {
if (!$this->fatalError) {
$this->message($ext, 'Basic configuration completed', '
<p>
You have no fatal errors in your basic
configuration.
You may have warnings though. Please pay
attention to them!
//.........这里部分代码省略.........
示例8: 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();
}
}
}
示例9: 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);
}
示例10: init
/**
* Init Method for initialising the navigation.
*
* @param string $content Content passed to method
* @param array $conf Typoscript Array
*
* @return array array for the menurendering of TYPO3
*/
public function init($content, array $conf)
{
$this->mConf = $this->processConf($conf);
if ($this->mConf['useRootlineInformationToUrl']) {
$this->useRootlineInformationToUrl = $this->mConf['useRootlineInformationToUrl'];
}
$this->choosenCat = $this->mConf['category'];
$this->nodeArrayAdditionalFields = GeneralUtility::trimExplode(',', $this->mConf['additionalFields'], 0);
$this->pid = $this->mConf['overridePid'] ? $this->mConf['overridePid'] : $this->getFrontendController()->id;
$this->gpVars = GeneralUtility::_GPmerged($this->prefixId);
\CommerceTeam\Commerce\Utility\GeneralUtility::initializeFeUserBasket();
$this->gpVars['basketHashValue'] = $this->getBasket()->getBasketHashValue();
$this->pageRootline = $this->getFrontendController()->rootLine;
$this->menuType = $this->mConf['1'];
$this->entryLevel = (int) $this->mConf['entryLevel'];
if ((int) $this->mConf['noAct'] > 0) {
$this->noAct = true;
}
if ((int) $this->mConf['maxLevel'] > 0) {
$this->maxLevel = (int) $this->mConf['maxLevel'];
}
/*
* Detect if a user is logged in and if he or she has usergroups
* as we have to take in accout, that different usergroups may have different
* rights on the commerce tree, so consider this whe calculation the cache hash.
*/
$usergroups = '';
if (is_array($this->getFrontendUser()->user)) {
$usergroups = $this->getFrontendUser()->user['usergroup'];
}
$this->cat = $this->getRootCategory();
// Define a default
$this->choosenCat = $this->mConf['category'];
$this->showUid = $this->gpVars['showUid'] ? $this->gpVars['showUid'] : 0;
$this->mDepth = $this->gpVars['mDepth'] ? $this->gpVars['mDepth'] : 0;
$this->path = $this->gpVars['path'] ? $this->gpVars['path'] : 0;
$this->expandAll = $this->mConf['expandAll'] ? $this->mConf['expandAll'] : 0;
$menuErrorName = array();
if (!($this->cat > 0)) {
$menuErrorName[] = 'No category defined in TypoScript: lib.tx_commerce.navigation.special.category';
}
if (!($this->pid > 0)) {
$menuErrorName[] = 'No OveridePID defined in TypoScript: lib.tx_commerce.navigation.special.overridePid';
}
if (!empty($menuErrorName)) {
foreach ($menuErrorName as $oneError) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($this->mConf, $oneError);
}
return $this->makeErrorMenu(5);
}
/*
* Unique Hash for this usergroup and page to display the navigation
*/
$hash = md5('tx_commerce_navigation:' . implode('-', $this->mConf) . ':' . $usergroups . ':' . $this->getFrontendController()->linkVars . ':' . GeneralUtility::getIndpEnv('HTTP_HOST'));
/*
* Render Menue Array and store in cache, if possible
*/
if ($this->getFrontendController()->no_cache) {
// Build directly and don't sore, if no_cache=1'
$this->mTree = $this->makeArrayPostRender($this->pid, 'tx_commerce_categories', 'tx_commerce_categories_parent_category_mm', 'tx_commerce_products', 'tx_commerce_products_categories_mm', $this->cat, 1, 0, $this->maxLevel);
/*
* Sorting Options, there is only one type 'alphabetiDesc' :)
* the others must to program
*
* @todo: implement sortType: alphabetiAsc, byUid, bySorting
*/
if ($this->mConf['sortAllitems.']['type'] == 'alphabetiDesc') {
$this->sortAllMenuArray($this->mTree, 'alphabetiDesc');
}
} else {
$cachedMatrix = $this->getHash($hash);
if (!empty($cachedMatrix)) {
// User the cached version
$this->mTree = $cachedMatrix;
} else {
// no cache present buld data and stor it in cache
$this->mTree = $this->makeArrayPostRender($this->pid, 'tx_commerce_categories', 'tx_commerce_categories_parent_category_mm', 'tx_commerce_products', 'tx_commerce_products_categories_mm', $this->cat, 1, 0, $this->maxLevel);
/*
* Sorting Options, there is only one type 'alphabetiDesc' :)
* the others must to program
*
* @todo: implement sortType: alphabetiAsc, byUid, bySorting
*/
if ($this->mConf['sortAllitems.']['type'] == 'alphabetiDesc') {
$this->sortAllMenuArray($this->mTree, 'alphabetiDesc');
}
$this->storeHash($hash, $this->mTree);
}
}
/*
* Finish menue array rendering, now postprocessing
* with current status of menue
//.........这里部分代码省略.........
示例11: hasPeriodChanged
function hasPeriodChanged($old, $new, $reverse = false, $debug = false)
{
if ($debug) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug(array($old, $new, $reverse));
}
if ($reverse) {
return intval($new) < intval($old);
} else {
return intval($new) > intval($old);
}
}
示例12: 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();
}
示例13: render
/**
* @param string $parseFuncTSPath path to TypoScript parseFunc setup.
* @return the parsed string.
* @author Bastian Waidelich <bastian@typo3.org>
* @author Niels Pardon <mail@niels-pardon.de>
*/
public function render($parseFuncTSPath = 'lib.parseFunc_RTE')
{
if (TYPO3_MODE === 'BE') {
$this->simulateFrontendEnvironment();
}
$value = $this->renderChildren();
$value = $this->htmlSubstr($value, 0, 200, true, '...');
\TYPO3\CMS\Core\Utility\DebugUtility::debug($value, 'value');
$content = $this->contentObject->parseFunc($value, array(), '< ' . $parseFuncTSPath);
if (TYPO3_MODE === 'BE') {
$this->resetFrontendEnvironment();
}
return $content;
}