本文整理汇总了PHP中eZDebug::addTimingPoint方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebug::addTimingPoint方法的具体用法?PHP eZDebug::addTimingPoint怎么用?PHP eZDebug::addTimingPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebug
的用法示例。
在下文中一共展示了eZDebug::addTimingPoint方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: operator
/**
Executes the needed operator(s).
Checks operator names, and calls the appropriate functions.
*/
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
case 'eZDebug':
$operatorValue = $this->eZdebug($operatorValue, $namedParameters['debuglvl'], $namedParameters['label']);
break;
case 'objDebug':
$operatorValue = $this->objdebug($operatorValue, $namedParameters['show_values'] == 'show', $namedParameters['level']);
break;
case 'objInspect':
require_once 'kernel/common/template.php';
$tpl = templateInit();
$tpl->setVariable('counter', self::$inspectcounter);
$exts = eZExtension::activeExtensions();
$wstransport = '';
if (in_array('ezjscore', $exts)) {
$wstransport = 'ezjscore';
} else {
if (in_array('ggwebservices', $exts)) {
$wstransport = 'ggwebservices';
}
}
$tpl->setVariable('transport', $wstransport);
if (class_exists('ezPOInspector')) {
$tpl->setVariable('value', json_encode(ezPOInspector::objInspect($operatorValue)));
$tpl->setVariable('error', false);
} else {
$tpl->setVariable('value', null);
$tpl->setVariable('error', "Cannot inspect value: extension ezpersistentobject_inspector most likely missing");
}
$tpl->setVariable('sort_attributes', $namedParameters['sort_attributes']);
$tpl->setVariable('send_to_debug', $namedParameters['send_to_debug']);
$operatorValue = $tpl->fetch('design:ezdebug/objinspect.tpl');
if ($namedParameters['send_to_debug']) {
// send div to debug output via a debug msg
$tpl = templateInit();
$tpl->setVariable('counter', self::$inspectcounter);
eZDebug::writeDebug($tpl->fetch('design:ezdebug/objinspectdebugoutput.tpl'), 'objInspect ' . self::$inspectcounter);
}
self::$inspectcounter++;
break;
case 'addTimingPoint':
eZDebug::addTimingPoint($namedParameters['label']);
$operatorValue = '';
break;
case 'numQueries':
$operatorValue = $this->numqueries($namedParameters['cluster']);
break;
case 'getDefinedVars':
$operatorValue = $this->getDefinedVars($tpl, $namedParameters['namespace'], $rootNamespace, $currentNamespace);
break;
}
}
示例2: parseIntoTree
function parseIntoTree($tpl, &$textElements, &$treeRoot, $rootNamespace, $relatedResource, $relatedTemplateName)
{
$outerElseTags = array('else' => array('if', 'elseif'), 'section-else' => array('section'));
$currentRoot =& $treeRoot;
if ($tpl->ShowDetails) {
eZDebug::addTimingPoint("Parse pass 3 (build tree)");
}
$tagStack = array();
foreach ($textElements as $elementKey => $element) {
$elementPlacement = $element['placement'];
$startLine = $elementPlacement['start']['line'];
$startColumn = $elementPlacement['start']['column'];
$startPosition = $elementPlacement['start']['position'];
$stopLine = $elementPlacement['stop']['line'];
$stopColumn = $elementPlacement['stop']['column'];
$stopPosition = $elementPlacement['stop']['position'];
$templateFile = $elementPlacement['templatefile'];
$placement = array(array($startLine, $startColumn, $startPosition), array($stopLine, $stopColumn, $stopPosition), $templateFile);
switch ($element["type"]) {
case eZTemplate::ELEMENT_TEXT:
unset($node);
$node = array(eZTemplate::NODE_TEXT, false, $element['text'], $placement);
$this->appendChild($currentRoot, $node);
break;
case eZTemplate::ELEMENT_VARIABLE:
$text = $element["text"];
$text_len = strlen($text);
$var_data = $this->ElementParser->parseVariableTag($tpl, $relatedTemplateName, $text, 0, $var_end, $text_len, $rootNamespace);
unset($node);
$node = array(eZTemplate::NODE_VARIABLE, false, $var_data, $placement);
$this->appendChild($currentRoot, $node);
if ($var_end < $text_len) {
$placement = $element['placement'];
$startLine = $placement['start']['line'];
$startColumn = $placement['start']['column'];
$subText = substr($text, 0, $var_end);
$this->gotoEndPosition($subText, $startLine, $startColumn, $currentLine, $currentColumn);
$tpl->error("", "parser error @ {$relatedTemplateName}:{$currentLine}" . "[{$currentColumn}]" . "\n" . "Extra characters found in expression, they will be ignored.\n" . substr($text, $var_end, $text_len - $var_end) . "' (" . substr($text, 0, $var_end) . ")", $placement);
}
break;
case eZTemplate::ELEMENT_SINGLE_TAG:
case eZTemplate::ELEMENT_NORMAL_TAG:
case eZTemplate::ELEMENT_END_TAG:
$text = $element["text"];
$text_len = strlen($text);
$type = $element["type"];
$ident_pos = $this->ElementParser->identifierEndPosition($tpl, $text, 0, $text_len);
$tag = substr($text, 0, $ident_pos - 0);
$attr_pos = $ident_pos;
unset($args);
$args = array();
// special handling for some functions having complex syntax
if ($type == eZTemplate::ELEMENT_NORMAL_TAG && in_array($tag, array('if', 'elseif', 'while', 'for', 'foreach', 'def', 'undef', 'set', 'let', 'default', 'set-block', 'append-block', 'section'))) {
$attr_pos = $this->ElementParser->whitespaceEndPos($tpl, $text, $attr_pos, $text_len);
if ($tag == 'if' || $tag == 'elseif') {
$this->parseUnnamedCondition($tag, $args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
} elseif ($tag == 'while') {
$this->parseWhileFunction($args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
} elseif ($tag == 'for') {
$this->parseForFunction($args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
} elseif ($tag == 'foreach') {
$this->parseForeachFunction($args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
} elseif ($tag == 'def' || $tag == 'undef') {
$this->parseDefFunction($tag, $args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
} elseif ($tag == 'set' || $tag == 'let' || $tag == 'default') {
$this->parseSetFunction($tag, $args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
} elseif ($tag == 'set-block' || $tag == 'append-block') {
$this->parseBlockFunction($tag, $args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
} elseif ($tag == 'section') {
$this->parseSectionFunction($tag, $args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
}
} elseif ($type == eZTemplate::ELEMENT_END_TAG && $tag == 'do') {
$this->parseDoFunction($args, $tpl, $text, $text_len, $attr_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace);
}
// other functions having simplier syntax are parsed below
$lastPosition = false;
while ($attr_pos < $text_len) {
if ($lastPosition !== false and $lastPosition == $attr_pos) {
break;
}
$lastPosition = $attr_pos;
$attr_pos_start = $this->ElementParser->whitespaceEndPos($tpl, $text, $attr_pos, $text_len);
if ($attr_pos_start == $attr_pos and $attr_pos_start < $text_len) {
$placement = $element['placement'];
$startLine = $placement['start']['line'];
$startColumn = $placement['start']['column'];
$subText = substr($text, 0, $attr_pos);
$this->gotoEndPosition($subText, $startLine, $startColumn, $currentLine, $currentColumn);
$tpl->error("", "parser error @ {$relatedTemplateName}:{$currentLine}" . "[{$currentColumn}]" . "\n" . "Extra characters found, should have been a whitespace or the end of the expression\n" . "Characters: '" . substr($text, $attr_pos) . "'");
break;
}
$attr_pos = $attr_pos_start;
$attr_name_pos = $this->ElementParser->identifierEndPosition($tpl, $text, $attr_pos, $text_len);
$attr_name = substr($text, $attr_pos, $attr_name_pos - $attr_pos);
/* Skip whitespace between here and the next one */
$equal_sign_pos = $this->ElementParser->whitespaceEndPos($tpl, $text, $attr_name_pos, $text_len);
if ($equal_sign_pos < $text_len && $text[$equal_sign_pos] == '=') {
$attr_name_pos = $equal_sign_pos;
}
if ($attr_name_pos >= $text_len or $text[$attr_name_pos] != '=' and preg_match("/[ \t\r\n]/", $text[$attr_name_pos])) {
//.........这里部分代码省略.........
示例3: ini_set
* @package ezmbpaex
*/
$mbpaexIni = eZINI::instance('mbpaex.ini');
// Fetch the user to use in the process
$updateChildrenUser = $mbpaexIni->variable('mbpaexSettings', 'UpdateChildrenUser');
// Default to admin if user is not found in the ini
if (!trim($updateChildrenUser)) {
$updateChildrenUser = 'admin';
}
$user = eZUser::fetchByName($updateChildrenUser);
eZUser::setCurrentlyLoggedInUser($user, $user->attribute('contentobject_id'));
if ($user->isLoggedIn()) {
$cli->output("eZPaEx: Update children process start");
ini_set('max_execution_time', 0);
ini_set('memory_limit', '-1');
eZDebug::addTimingPoint('Fetch update pending list');
// Get list of paex objects marked to updatechildren
$pendingList = eZPaEx::fetchUpdateChildrenPendingList();
$pendingListCount = count($pendingList);
if (!$pendingListCount) {
$cli->output("No pending update subtrees found");
} else {
$cli->output("Found " . $pendingListCount . " ezpaex objects with pending updatechildren");
$pendingIdList = array();
foreach ($pendingList as $pendingObject) {
$pendingIdList[] = $pendingObject->attribute('contentobject_id');
}
// Fetch array of nodes corresponding to objects in the pendingIDList to sort them by depth
$nodeArray = eZContentObjectTreeNode::findMainNodeArray($pendingIdList, false);
// Make an array of objects ids with its deph based on the corresponding node
$objectDepthList = array();
示例4: ini_set
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @package ezmbpaex
*/
$cli->output("eZPaEx: Send expiry notifications process start");
ini_set('max_execution_time', 0);
ini_set('memory_limit', '-1');
eZDebug::addTimingPoint('Fetch notification pending list');
$paexPendingList = eZPaEx::fetchExpiryNotificationPendingList();
$paexPendingListCount = count($paexPendingList);
if (!$paexPendingListCount) {
$cli->output("No pending update notifications found");
} else {
$cli->output("Found " . $paexPendingListCount . " objects pending notification, send notifications:");
$totalNotificationsSent = 0;
eZDebug::addTimingPoint('Send notifications');
foreach ($paexPendingList as $paexObject) {
$userID = $paexObject->attribute('contentobject_id');
$userObject = eZUser::fetch($userID);
if ($userObject instanceof eZUser && $userObject->isEnabled()) {
if (!$paexObject->sendExpiryNotification($userObject)) {
$cli->output("Error sending notification. UserID: " . $userID);
} else {
$cli->output("Notification sent ok. UserID: " . $userID);
$paexObject->setExpiryNotificationSent();
$totalNotificationsSent++;
}
} else {
$cli->output("Error user_object disabled or not found. UserID: " . $userID);
}
}
示例5: process
function process($tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
{
switch ($functionName) {
case $this->TimingPointName:
$children = $functionChildren;
$parameters = $functionParameters;
$id = false;
if (isset($parameters["id"])) {
$id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
}
$startDescription = "debug-timing-point START: {$id}";
eZDebug::addTimingPoint($startDescription);
if (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
$endDescription = "debug-timing-point END: {$id}";
eZDebug::addTimingPoint($endDescription);
break;
case $this->AccumulatorName:
$children = $functionChildren;
$parameters = $functionParameters;
$id = false;
if (isset($parameters["id"])) {
$id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
}
$name = false;
if (isset($parameters["name"])) {
$name = $tpl->elementValue($parameters["name"], $rootNamespace, $currentNamespace, $functionPlacement);
}
// Assign a name (as $functionName) which will be used in the debug output.
$name = ($name === false and $id === false) ? $functionName : $name;
// To uniquely identify this accumulator.
$id = $id === false ? uniqID($functionName . '_') : $id;
eZDebug::accumulatorStart($id, 'Debug-Accumulator', $name);
if (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
eZDebug::accumulatorStop($id);
break;
case $this->LogName:
$parameters = $functionParameters;
if (isset($parameters['var'])) {
$var = $tpl->elementValue($parameters['var'], $rootNamespace, $currentNamespace, $functionPlacement);
}
if (isset($parameters['msg'])) {
$msg = $tpl->elementValue($parameters['msg'], $rootNamespace, $currentNamespace, $functionPlacement);
}
if (isset($var) && isset($msg)) {
eZDebug::writeDebug($var, $msg);
} elseif (isset($msg)) {
eZDebug::writeDebug($msg);
} elseif (isset($var)) {
eZDebug::writeDebug($var);
}
break;
case $this->TraceName:
$children = $functionChildren;
$id = false;
// If we have XDebug we start the trace, execute children and stop it
// if not we just execute the children as normal
if (extension_loaded('xdebug')) {
$parameters = $functionParameters;
if (isset($parameters["id"])) {
$id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
}
if (!$id) {
$id = 'template-debug';
}
// If we already have a file, make sure it is truncated
if (file_exists($id . '.xt')) {
$fd = fopen($id, '.xt', 'w');
fclose($fd);
}
xdebug_start_trace($id);
if (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
xdebug_stop_trace();
} elseif (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
break;
}
}
示例6: eZDateTime
$scriptFile = $scriptDirectory . '/' . $cronScript;
if (file_exists($scriptFile)) {
break;
}
}
if (file_exists($scriptFile)) {
if ($index > 0) {
$cli->output();
}
if (!$isQuiet) {
$startTime = new eZDateTime();
$cli->output('Running ' . $cli->stylize('emphasize', $scriptFile) . ' at: ' . $startTime->toString(true));
}
eZDebug::addTimingPoint("Script {$scriptFile} starting");
eZRunCronjobs::runScript($cli, $scriptFile);
eZDebug::addTimingPoint("Script {$scriptFile} done");
++$index;
// The transaction check
$transactionCounterCheck = eZDB::checkTransactionCounter();
if (isset($transactionCounterCheck['error'])) {
$cli->error($transactionCounterCheck['error']);
}
if (!$isQuiet) {
$endTime = new eZDateTime();
$cli->output('Completing ' . $cli->stylize('emphasize', $scriptFile) . ' at: ' . $endTime->toString(true));
$elapsedTime = new eZTime($endTime->timeStamp() - $startTime->timeStamp());
$cli->output('Elapsed time: ' . sprintf('%02d:%02d:%02d', $elapsedTime->hour(), $elapsedTime->minute(), $elapsedTime->second()));
}
}
}
$script->shutdown();
示例7: addTimingPoint
/**
* Adds the timing point if the condition $conditionName is enabled.
*
* @param string $conditionName Name of the condition
* @param string $label Optional label
*/
static function addTimingPoint( $conditionName, $label = "" )
{
if ( !eZDebugSetting::isConditionTrue( $conditionName, eZDebug::LEVEL_TIMING_POINT ) )
return false;
eZDebug::addTimingPoint( eZDebugSetting::changeLabel( $conditionName, $label ) );
}
示例8: requestInit
protected function requestInit()
{
if ($this->isInitialized) {
return;
}
eZExecution::setCleanExit(false);
$scriptStartTime = microtime(true);
$GLOBALS['eZRedirection'] = false;
$this->access = eZSiteAccess::current();
eZDebug::setScriptStart($scriptStartTime);
eZDebug::addTimingPoint("Script start");
$this->uri = eZURI::instance(eZSys::requestURI());
$GLOBALS['eZRequestedURI'] = $this->uri;
// Be able to do general events early in process
ezpEvent::getInstance()->notify('request/preinput', array($this->uri));
// Initialize module loading
$this->siteBasics['module-repositories'] = eZModule::activeModuleRepositories();
eZModule::setGlobalPathList($this->siteBasics['module-repositories']);
// make sure we get a new $ini instance now that it has been reset
$ini = eZINI::instance();
// start: eZCheckValidity
// pre check, setup wizard related so needs to be before session/db init
// TODO: Move validity check in the constructor? Setup is not meant to be launched at each (sub)request is it?
if ($ini->variable('SiteAccessSettings', 'CheckValidity') === 'true') {
$this->check = array('module' => 'setup', 'function' => 'init');
// Turn off some features that won't bee needed yet
$this->siteBasics['policy-check-omit-list'][] = 'setup';
$this->siteBasics['show-page-layout'] = $ini->variable('SetupSettings', 'PageLayout');
$this->siteBasics['validity-check-required'] = true;
$this->siteBasics['session-required'] = $this->siteBasics['user-object-required'] = false;
$this->siteBasics['db-required'] = $this->siteBasics['no-cache-adviced'] = $this->siteBasics['url-translator-allowed'] = false;
$this->siteBasics['site-design-override'] = $ini->variable('SetupSettings', 'OverrideSiteDesign');
$this->access = eZSiteAccess::change(array('name' => 'setup', 'type' => eZSiteAccess::TYPE_URI));
eZTranslatorManager::enableDynamicTranslations();
}
// stop: eZCheckValidity
if ($this->siteBasics['session-required']) {
// Check if this should be run in a cronjob
if ($ini->variable('Session', 'BasketCleanup') !== 'cronjob') {
eZSession::addCallback('destroy_pre', function (eZDBInterface $db, $key, $escapedKey) {
$basket = eZBasket::fetch($key);
if ($basket instanceof eZBasket) {
$basket->remove();
}
});
eZSession::addCallback('gc_pre', function (eZDBInterface $db, $time) {
eZBasket::cleanupExpired($time);
});
eZSession::addCallback('cleanup_pre', function (eZDBInterface $db) {
eZBasket::cleanup();
});
}
// addCallBack to update session id for shop basket on session regenerate
eZSession::addCallback('regenerate_post', function (eZDBInterface $db, $escNewKey, $escOldKey) {
$db->query("UPDATE ezbasket SET session_id='{$escNewKey}' WHERE session_id='{$escOldKey}'");
});
// TODO: Session starting should be made only once in the constructor
$this->sessionInit();
}
// if $this->siteBasics['db-required'], open a db connection and check that db is connected
if ($this->siteBasics['db-required'] && !eZDB::instance()->isConnected()) {
$this->warningList[] = array('error' => array('type' => 'kernel', 'number' => eZError::KERNEL_NO_DB_CONNECTION), 'text' => 'No database connection could be made, the system might not behave properly.');
}
// eZCheckUser: pre check, RequireUserLogin & FORCE_LOGIN related so needs to be after session init
if (!isset($this->check)) {
$this->check = eZUserLoginHandler::preCheck($this->siteBasics, $this->uri);
}
ezpEvent::getInstance()->notify('request/input', array($this->uri));
// Initialize with locale settings
// TODO: Move to constructor? Is it relevant to init the locale/charset for each (sub)requests?
$this->languageCode = eZLocale::instance()->httpLocaleCode();
$phpLocale = trim($ini->variable('RegionalSettings', 'SystemLocale'));
if ($phpLocale != '') {
setlocale(LC_ALL, explode(',', $phpLocale));
}
$this->httpCharset = eZTextCodec::httpCharset();
// TODO: are these parameters supposed to vary across potential sub-requests?
$this->site = array('title' => $ini->variable('SiteSettings', 'SiteName'), 'design' => $ini->variable('DesignSettings', 'SiteDesign'), 'http_equiv' => array('Content-Type' => 'text/html; charset=' . $this->httpCharset, 'Content-language' => $this->languageCode));
// Read role settings
$this->siteBasics['policy-check-omit-list'] = array_merge($this->siteBasics['policy-check-omit-list'], $ini->variable('RoleSettings', 'PolicyOmitList'));
$this->isInitialized = true;
}
示例9: trim
$show_page_layout = "pagelayout.tpl";
}
// Set the navigation part
// Check for navigation part settings
$navigationPartString = 'ezcontentnavigationpart';
if (isset($moduleResult['navigation_part'])) {
$navigationPartString = $moduleResult['navigation_part'];
// Fetch the navigation part
}
$navigationPart = eZNavigationPart::fetchPartByIdentifier($navigationPartString);
$tpl->setVariable('navigation_part', $navigationPart);
$tpl->setVariable('uri_string', $uri->uriString());
if (isset($moduleResult['requested_uri_string'])) {
$tpl->setVariable('requested_uri_string', $moduleResult['requested_uri_string']);
} else {
$tpl->setVariable('requested_uri_string', $actualRequestedURI);
}
// Set UI context and component
$tpl->setVariable('ui_context', $moduleResult['ui_context']);
$tpl->setVariable('ui_component', $moduleResult['ui_component']);
$templateResult = $tpl->fetch($resource . $show_page_layout);
} else {
$templateResult = $moduleResult['content'];
}
eZDebug::addTimingPoint("Script end");
$out = ob_get_clean();
echo trim($out);
eZDB::checkTransactionCounter();
eZDisplayResult($templateResult);
eZExecution::cleanup();
eZExecution::setCleanExit();
示例10: trim
}
// Set the navigation part
// Check for navigation part settings
$navigationPartString = 'ezcontentnavigationpart';
if (isset($moduleResult['navigation_part'])) {
$navigationPartString = $moduleResult['navigation_part'];
// Fetch the navigation part
}
$navigationPart = eZNavigationPart::fetchPartByIdentifier($navigationPartString);
$tpl->setVariable('navigation_part', $navigationPart);
$tpl->setVariable('uri_string', $uri->uriString());
if (isset($moduleResult['requested_uri_string'])) {
$tpl->setVariable('requested_uri_string', $moduleResult['requested_uri_string']);
} else {
$tpl->setVariable('requested_uri_string', $actualRequestedURI);
}
// Set UI context and component
$tpl->setVariable('ui_context', $moduleResult['ui_context']);
$tpl->setVariable('ui_component', $moduleResult['ui_component']);
$templateResult = $tpl->fetch($resource . $show_page_layout);
}
} else {
$templateResult = $moduleResult['content'];
}
eZDebug::addTimingPoint("End");
$out = ob_get_clean();
echo trim($out);
eZDB::checkTransactionCounter();
eZDisplayResult($templateResult);
eZExecution::cleanup();
eZExecution::setCleanExit();