本文整理汇总了PHP中eZDebug::accumulatorStop方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebug::accumulatorStop方法的具体用法?PHP eZDebug::accumulatorStop怎么用?PHP eZDebug::accumulatorStop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebug
的用法示例。
在下文中一共展示了eZDebug::accumulatorStop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTimeline
public function getTimeline($pageID = false, $limit = 20, $type = 'feed')
{
$result = array('result' => array());
$accumulator = $this->debugAccumulatorGroup . '_facebook_timeline';
eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'timeline');
$cacheFileHandler = $this->getCacheFileHandler('_timeline', array($pageID, $limit, $type));
try {
if ($this->isCacheExpired($cacheFileHandler)) {
eZDebug::writeDebug(array('page_id' => $pageID, 'limit' => $limit), self::$debugMessagesGroup);
$response = $this->API->api(($pageID === false ? 'me/home' : '/' . $pageID) . '/' . $type, array('access_token' => $this->acessToken, 'limit' => $limit));
$messages = array();
$currentTime = time();
foreach ($response['data'] as $message) {
$createdAt = strtotime($message['created_time']);
$message['created_ago'] = self::getCreatedAgoString($createdAt, $currentTime);
$message['created_timestamp'] = $createdAt;
if (isset($message['message'])) {
$message['message'] = self::fixMessageLinks($message['message']);
}
$messages[] = $message;
}
$cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($messages));
} else {
$messages = unserialize($cacheFileHandler->fetchContents());
}
eZDebug::accumulatorStop($accumulator);
$result['result'] = $messages;
return $result;
} catch (Exception $e) {
eZDebug::accumulatorStop($accumulator);
eZDebug::writeError($e->getMessage(), self::$debugMessagesGroup);
return $result;
}
}
示例2: parse
function parse( $tpl, $sourceText, &$rootElement, $rootNamespace, &$resourceData )
{
$relatedResource = $resourceData['resource'];
$relatedTemplateName = $resourceData['template-filename'];
$currentRoot =& $rootElement;
$leftDelimiter = $tpl->LDelim;
$rightDelimiter = $tpl->RDelim;
$sourceLength = strlen( $sourceText );
$sourcePosition = 0;
eZDebug::accumulatorStart( 'template_multi_parser_1', 'template_total', 'Template parser: create text elements' );
$textElements = $this->parseIntoTextElements( $tpl, $sourceText, $sourcePosition,
$leftDelimiter, $rightDelimiter, $sourceLength,
$relatedTemplateName );
eZDebug::accumulatorStop( 'template_multi_parser_1' );
eZDebug::accumulatorStart( 'template_multi_parser_2', 'template_total', 'Template parser: remove whitespace' );
$textElements = $this->parseWhitespaceRemoval( $tpl, $textElements );
eZDebug::accumulatorStop( 'template_multi_parser_2' );
eZDebug::accumulatorStart( 'template_multi_parser_3', 'template_total', 'Template parser: construct tree' );
$this->parseIntoTree( $tpl, $textElements, $currentRoot,
$rootNamespace, $relatedResource, $relatedTemplateName );
eZDebug::accumulatorStop( 'template_multi_parser_3' );
}
示例3: rawSearch
/**
* Helper for solr raw searches.
* Deals with the language, meta_installation, section and visibility filters + solr sharding if any
* @param array $params
* @param string $requestType
* @param bool $useDefaultFilters
* @return array
*/
public static function rawSearch( $params, $requestType = 'php', $useDefaultFilters = true, $includeIsInvisible = true )
{
eZDebug::accumulatorStart( __CLASS__ . '::' . __FUNCTION__, 'Merck' );
$findINI = eZINI::instance( 'ezfind.ini' );
$solrINI = eZINI::instance( 'solr.ini' );
$siteINI = eZINI::instance();
$currentLanguage = $siteINI->variable( 'RegionalSettings', 'ContentObjectLocale' );
// always use extended Dismax query handler when available
if( isset($params['qt']) && $params['qt'] == 'ezpublish' )
$params['defType'] = 'edismax';
if ( $useDefaultFilters )
{
if ( !isset( $params['fq'] ) )
$params['fq'] = '';
else
$params['fq'] .= ' AND ';
$params['fq'] .= implode( ' AND ', array(
'meta_installation_id_ms:' . eZSolr::installationID(),
'(attr_offline_date_dt:"1970-01-01T01:00:00Z" OR attr_offline_date_dt:[NOW TO *])',
'( meta_section_id_si:1 OR meta_section_id_si:3 )',
) );
if ($includeIsInvisible) {
$params['fq'] .= ' AND ' . 'attr_is_invisible_' . ClusterTool::clusterIdentifier() . '_b:false';
}
}
if ( $findINI->variable( 'LanguageSearch', 'MultiCore' ) == 'enabled' )
{
$languageMapping = $findINI->variable( 'LanguageSearch', 'LanguagesCoresMap' );
$shardMapping = $solrINI->variable( 'SolrBase', 'Shards' );
$fullSolrURI = $shardMapping[$languageMapping[$currentLanguage]];
}
else
{
$fullSolrURI = $solrINI->variable( 'SolrBase', 'SearchServerURI' );
// Autocomplete search should be done in current language and fallback languages
$validLanguages = array_unique(
array_merge(
LocaleTool::languageList(),
array( $currentLanguage )
)
);
if( $useDefaultFilters )
$params['fq'] .= ' AND meta_language_code_ms:(' . implode( ' OR ', $validLanguages ) . ')';
}
solrTool::solrStopWordsFilter( $params ); //excluding stopwords
self::parseBooleanOperators( $params ); // translations for bookean operators
$solrBase = new eZSolrBase( $fullSolrURI );
$result = $solrBase->rawSolrRequest( '/select', $params, $requestType );
if ( !$result )
self::addNoCacheHeaders();
eZDebug::accumulatorStop( __CLASS__ . '::' . __FUNCTION__ );
return $result;
}
示例4: searchActivities
public function searchActivities($query, $limit = 20, $sorting = 'best')
{
$result = array('result' => array());
$accumulator = $this->debugAccumulatorGroup . '_google_activities_search';
eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'activities/search');
$cacheFileHandler = $this->getCacheFileHandler('_activities_search', array($query, $limit, $sorting));
try {
if ($this->isCacheExpired($cacheFileHandler)) {
eZDebug::writeDebug(array('query' => $query, 'limit' => $limit, 'sorting' => $sorting), self::$debugMessagesGroup);
$response = $this->API->activities->search($query, array('maxResults' => $limit, 'orderBy' => $sorting));
$activities = array();
$currentTime = time();
foreach ($response['items'] as $activity) {
$createdAt = strtotime($activity['published']);
$activity['created_ago'] = self::getCreatedAgoString($createdAt, $currentTime);
$activity['created_timestamp'] = $createdAt;
$activities[] = $activity;
}
$cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($activities));
} else {
$activities = unserialize($cacheFileHandler->fetchContents());
}
eZDebug::accumulatorStop($accumulator);
$result['result'] = $activities;
return $result;
} catch (Exception $e) {
eZDebug::accumulatorStop($accumulator);
eZDebug::writeError($e, self::$debugMessagesGroup);
return $result;
}
}
示例5: get_html
function get_html($url, $args = '', $asArray = false)
{
eZDebug::createAccumulator('get_html ' . $url, 'OCoembed', $url);
eZDebug::accumulatorStart('get_html ' . $url, 'OCoembed', $url, false);
$provider = false;
if (!isset($args['discover'])) {
$args['discover'] = false;
}
foreach ($this->providers as $matchmask => $data) {
list($providerurl, $regex) = $data;
// Turn the asterisk-type provider URLs into regex
if (!$regex) {
$matchmask = '#' . str_replace('___wildcard___', '(.+)', preg_quote(str_replace('*', '___wildcard___', $matchmask), '#')) . '#i';
}
if (preg_match($matchmask, $url)) {
$provider = str_replace('{format}', 'json', $providerurl);
// JSON is easier to deal with than XML
break;
}
}
if (!$provider && $args['discover']) {
$provider = $this->discover($url);
}
if (!$provider || false === ($data = $this->fetch($provider, $url, $args))) {
eZDebug::accumulatorStop('get_html ' . $url, false);
return false;
}
if ($asArray) {
eZDebug::accumulatorStop('get_html ' . $url, false);
return get_object_vars($data);
}
eZDebug::accumulatorStop('get_html ' . $url, false);
return $this->data2html($data, $url);
}
示例6: search
function search($searchText, $params = array(), $searchTypes = array())
{
eZDebug::createAccumulator('Search', 'eZ Find');
eZDebug::accumulatorStart('Search');
$error = 'Server not running';
$asObjects = isset($params['AsObjects']) ? $params['AsObjects'] : true;
//distributed search: fields to return can be specified in 2 parameters
$params['FieldsToReturn'] = isset($params['FieldsToReturn']) ? $params['FieldsToReturn'] : array();
if (isset($params['DistributedSearch']['returnfields'])) {
$params['FieldsToReturn'] = array_merge($params['FieldsToReturn'], $params['DistributedSearch']['returnfields']);
}
$coreToUse = null;
$shardQueryPart = null;
if ($this->UseMultiLanguageCores === true) {
$languages = $this->SiteINI->variable('RegionalSettings', 'SiteLanguageList');
if (array_key_exists($languages[0], $this->SolrLanguageShards)) {
$coreToUse = $this->SolrLanguageShards[$languages[0]];
if ($this->FindINI->variable('LanguageSearch', 'SearchMainLanguageOnly') != 'enabled') {
$shardQueryPart = array('shards' => implode(',', $this->SolrLanguageShardURIs));
}
}
//eZDebug::writeNotice( $languages, __METHOD__ . ' languages' );
eZDebug::writeNotice($shardQueryPart, __METHOD__ . ' shards');
//eZDebug::writeNotice( $this->SolrLanguageShardURIs, __METHOD__ . ' this languagesharduris' );
} else {
$coreToUse = $this->Solr;
}
if ($this->SiteINI->variable('SearchSettings', 'AllowEmptySearch') == 'disabled' && trim($searchText) == '') {
$error = 'Empty search is not allowed.';
eZDebug::writeNotice($error, __METHOD__);
$resultArray = null;
} else {
eZDebug::createAccumulator('Query build', 'eZ Find');
eZDebug::accumulatorStart('Query build');
$queryBuilder = new ezfeZPSolrQueryBuilder($this);
$queryParams = $queryBuilder->buildSearch($searchText, $params, $searchTypes);
if (!$shardQueryPart == null) {
$queryParams = array_merge($shardQueryPart, $queryParams);
}
eZDebug::accumulatorStop('Query build');
eZDebugSetting::writeDebug('extension-ezfind-query', $queryParams, 'Final query parameters sent to Solr backend');
eZDebug::createAccumulator('Engine time', 'eZ Find');
eZDebug::accumulatorStart('Engine time');
$resultArray = $coreToUse->rawSearch($queryParams);
eZDebug::accumulatorStop('Engine time');
}
if ($resultArray) {
$searchCount = $resultArray['response']['numFound'];
$objectRes = $this->buildResultObjects($resultArray, $searchCount, $asObjects, $params);
$stopWordArray = array();
eZDebug::accumulatorStop('Search');
return array('SearchResult' => $objectRes, 'SearchCount' => $searchCount, 'StopWordArray' => $stopWordArray, 'SearchExtras' => new ezfSearchResultInfo($resultArray));
} else {
eZDebug::accumulatorStop('Search');
return array('SearchResult' => false, 'SearchCount' => 0, 'StopWordArray' => array(), 'SearchExtras' => new ezfSearchResultInfo(array('error' => ezpI18n::tr('ezfind', $error))));
}
}
示例7: testAccumulatorStartMultipleResursiveCounter
/**
* Test scenario for issue #13956: eZDebug::accumulatorStop( $key, true ) does not remove the recursive counter
*
* @link http://issues.ez.no/13956
* @group issue_13956
*/
function testAccumulatorStartMultipleResursiveCounter()
{
self::markTestSkipped("Pending bugfix");
eZDebug::accumulatorStart(__METHOD__, false, false, true);
eZDebug::accumulatorStart(__METHOD__, false, false, true);
eZDebug::accumulatorStop(__METHOD__, true);
eZDebug::accumulatorStop(__METHOD__, true);
eZDebug::accumulatorStart(__METHOD__, false, false, true);
$debug = eZDebug::instance();
$this->assertEquals(0, $debug->TimeAccumulatorList[__METHOD__]['recursive_counter']);
}
示例8: parse
/**
* Parses CSV File
* @throws SQLICSVException
* @return SQLICSVDoc
*/
public function parse()
{
eZDebug::accumulatorStart('sqlicsvdoc_loading', 'sqlicsvdoc', 'Loading CSV file in memory');
$this->csvFile = @fopen($this->options['csv_path'], 'r');
if (!$this->csvFile) {
throw new SQLICSVException("Cannot open CSV file '{$this->options['csv_path']}' for reading");
}
$this->rows = SQLICSVRowSet::fromCSVFile($this->csvFile, $this->options);
eZDebug::accumulatorStop('sqlicsvdoc_loading');
return $this;
}
示例9: execute
public function execute($process, $event)
{
eZDebug::createAccumulatorGroup('nxc_social_networks_publish', 'NXC Social Networks Publish');
$processParams = $process->attribute('parameter_list');
$classIDs = unserialize($event->attribute('data_text1'));
$object = eZContentObject::fetch($processParams['object_id']);
if (in_array($object->attribute('contentclass_id'), $classIDs) === false) {
return eZWorkflowType::STATUS_ACCEPTED;
}
$dataMap = $object->attribute('data_map');
$handlers = $event->attribute('handlers');
foreach ($handlers as $handler) {
$options = $handler->getOptions();
if (isset($options['publish_only_on_create']) && (bool) $options['publish_only_on_create'] === true && $object->attribute('current_version') != 1) {
continue;
}
$classAttributeIDs = $handler->attribute('classattribute_ids');
foreach ($classAttributeIDs as $classAttributeID) {
$classAttribute = eZContentClassAttribute::fetch($classAttributeID, false);
if ($classAttribute['contentclass_id'] != $object->attribute('contentclass_id')) {
continue;
}
$attributeContent = false;
foreach ($dataMap as $objectAttribute) {
if ($objectAttribute->attribute('contentclassattribute_id') == $classAttributeID) {
$attributeContent = $objectAttribute->attribute('content');
break;
}
}
if ($attributeContent === false) {
continue;
}
$accumulator = 'nxc_social_networks_publish_to_' . $handler->attribute('type');
eZDebug::accumulatorStart($accumulator, 'nxc_social_networks_publish', 'Publishing message to ' . $handler->attribute('name'));
try {
$handler->publish($object, $attributeContent);
} catch (Exception $e) {
eZDebug::writeError($e->getMessage(), 'NXC Social Networks Publish');
}
eZDebug::accumulatorStop($accumulator);
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
示例10: generateNodeListCache
public function generateNodeListCache($nodeList)
{
eZDebug::accumulatorStart('StaticCacheMugo', '', 'StaticCacheMugo');
if (!empty($nodeList)) {
foreach ($nodeList as $nodeId) {
$urls = $this->nodeId2Urls($nodeId);
foreach ($urls as $url) {
if ($this->pathPrefixModifier) {
$this->applyPreFixModifier($url);
}
$key = md5($url);
if (!isset(self::$urlsToPurge[$key])) {
if ($this->uriTransformation) {
eZURI::transformURI($url);
}
if ($this->urlModifierMatch) {
$url = preg_replace($this->urlModifierMatch, $this->urlModifierReplace, $url);
}
// exclude URLs based on configured patterns
if (!empty($this->omitUrlPatterns)) {
$matched = false;
foreach ($this->omitUrlPatterns as $pattern) {
$matched = preg_match($pattern, $purgeUrl);
}
// skip it and process next URL
if ($matched) {
continue;
}
}
// add final version of URL to list
self::$urlsToPurge[$key] = $url;
}
}
}
}
eZDebug::accumulatorStop('StaticCacheMugo', '', 'StaticCacheMugo');
}
示例11: handleResource
function handleResource($tpl, &$resourceData, $method, &$extraParameters)
{
$path = $resourceData['template-name'];
$matchKeys = $this->Keys;
if (isset($GLOBALS['eZDesignKeys'])) {
$matchKeys = array_merge($matchKeys, $GLOBALS['eZDesignKeys']);
unset($GLOBALS['eZDesignKeys']);
$this->Keys = $matchKeys;
}
if (is_array($extraParameters) and isset($extraParameters['ezdesign:keys'])) {
$this->mergeKeys($matchKeys, $extraParameters['ezdesign:keys']);
}
$this->KeyStack[] = $this->Keys;
$this->Keys = $matchKeys;
eZDebug::accumulatorStart('override_cache', 'Override', 'Cache load');
if (!isset($GLOBALS['eZOverrideTemplateCacheMap'])) {
$overrideCacheFile = $this->createOverrideCache();
if ($overrideCacheFile) {
include_once $overrideCacheFile;
}
}
if (isset($GLOBALS['eZOverrideTemplateCacheMap'])) {
if (isset($GLOBALS['eZOverrideTemplateCacheMap'][md5('/' . $path)])) {
$cacheMap = $GLOBALS['eZOverrideTemplateCacheMap'][md5('/' . $path)];
if (!is_string($cacheMap) and trim($cacheMap['code'])) {
eval("\$matchFile = " . $cacheMap['code'] . ";");
} else {
$matchFile = $cacheMap;
}
$match['file'] = $matchFile;
}
} else {
$template = "/" . $path;
$matchFileArray = eZTemplateDesignResource::overrideArray($this->OverrideSiteAccess);
$matchFile = $matchFileArray[$template];
if (isset($matchFile['custom_match'])) {
$matchFound = false;
foreach ($matchFile['custom_match'] as $customMatch) {
$matchOverride = true;
if (count($customMatch['conditions']) > 0) {
foreach (array_keys($customMatch['conditions']) as $conditionKey) {
// Create special substring match for subtree override
if ($conditionKey == 'url_alias') {
if (strpos($matchKeys['url_alias'], $customMatch['conditions'][$conditionKey]) === 0) {
} else {
$matchOverride = false;
}
} else {
if (isset($matchKeys[$conditionKey]) and isset($customMatch['conditions'][$conditionKey])) {
if (is_array($matchKeys[$conditionKey])) {
if (!in_array($customMatch['conditions'][$conditionKey], $matchKeys[$conditionKey])) {
$matchOverride = false;
}
} else {
if ($matchKeys[$conditionKey] != $customMatch['conditions'][$conditionKey]) {
$matchOverride = false;
}
}
} else {
$matchOverride = false;
}
}
}
if ($matchOverride == true) {
$match['file'] = $customMatch['match_file'];
$matchFound = true;
break;
} else {
}
} else {
// Default match without conditions
$match['file'] = $customMatch['match_file'];
$matchFound = true;
}
}
if (!$matchFound) {
$match['file'] = $matchFile['base_dir'] . $matchFile['template'];
}
} else {
$match['file'] = $matchFile['base_dir'] . $matchFile['template'];
}
}
eZDebug::accumulatorStop('override_cache');
if (isset($match)) {
$file = $match["file"];
$matchedKeys = array();
$usedKeys = array();
foreach ($matchKeys as $matchKeyName => $matchKeyValue) {
$usedKeys[$matchKeyName] = $matchKeyValue;
}
$extraParameters['ezdesign:used_keys'] = $usedKeys;
$extraParameters['ezdesign:matched_keys'] = $matchedKeys;
$tpl->setVariable('used', $usedKeys, 'DesignKeys');
$tpl->setVariable('matched', $matchedKeys, 'DesignKeys');
$resourceData['template-filename'] = $file;
$result = eZTemplateFileResource::handleResourceData($tpl, $this, $resourceData, $method, $extraParameters);
} else {
$result = false;
}
$this->Keys = array_pop($this->KeyStack);
//.........这里部分代码省略.........
示例12: checkContentActions
//.........这里部分代码省略.........
{
$conflictingVersions = $version->hasConflicts( $EditLanguage );
if ( $conflictingVersions )
{
$tpl = eZTemplate::factory();
$res = eZTemplateDesignResource::instance();
$res->setKeys( array( array( 'object', $object->attribute( 'id' ) ),
array( 'remote_id', $object->attribute( 'remote_id' ) ),
array( 'class', $class->attribute( 'id' ) ),
array( 'class_identifier', $class->attribute( 'identifier' ) ),
array( 'class_group', $class->attribute( 'match_ingroup_id_list' ) ) ) );
$tpl->setVariable( 'edit_language', $EditLanguage );
$tpl->setVariable( 'current_version', $version->attribute( 'version' ) );
$tpl->setVariable( 'object', $object );
$tpl->setVariable( 'draft_versions', $conflictingVersions );
$Result = array();
$Result['content'] = $tpl->fetch( 'design:content/edit_conflict.tpl' );
return eZModule::HOOK_STATUS_CANCEL_RUN;
}
}
eZDebug::accumulatorStart( 'publish', '', 'publish' );
$oldObjectName = $object->name();
$behaviour = new ezpContentPublishingBehaviour();
$behaviour->isTemporary = true;
$behaviour->disableAsynchronousPublishing = false;
ezpContentPublishingBehaviour::setBehaviour( $behaviour );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $object->attribute( 'id' ),
'version' => $version->attribute( 'version' ) ) );
eZDebug::accumulatorStop( 'publish' );
if ( ( array_key_exists( 'status', $operationResult ) && $operationResult['status'] != eZModuleOperationInfo::STATUS_CONTINUE ) )
{
eZDebug::writeDebug( $operationResult, __FILE__ );
switch( $operationResult['status'] )
{
case eZModuleOperationInfo::STATUS_REPEAT:
{
eZContentOperationCollection::setVersionStatus( $object->attribute( 'id' ),
$version->attribute( 'version' ), eZContentObjectVersion::STATUS_REPEAT );
}
case eZModuleOperationInfo::STATUS_HALTED:
{
if ( isset( $operationResult['redirect_url'] ) )
{
$module->redirectTo( $operationResult['redirect_url'] );
return;
}
else if ( isset( $operationResult['result'] ) )
{
$result = $operationResult['result'];
$resultContent = false;
if ( is_array( $result ) )
{
if ( isset( $result['content'] ) )
{
$resultContent = $result['content'];
}
if ( isset( $result['path'] ) )
{
$Result['path'] = $result['path'];
}
示例13: 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;
}
}
示例14: accumulatorStop
protected function accumulatorStop()
{
eZDebug::accumulatorStop('mysql_cluster_dfs_operations');
}
示例15: suggestedTerms
public function suggestedTerms()
{
if ( mb_strlen($this->searchQuery, 'UTF-8') < 3 )
{
return array();
}
eZDebug::accumulatorStart(__CLASS__.'::'.__FUNCTION__, 'Merck' );
$solrHighlightParams = $this->solrHighlightParams();
$suggestions = array();
$filters = array();
$solrFilter = $this->solrFilter();
$solrFacetsFiler = $this->solrFacetsFilter();
if( $solrFilter )
$filters[] = $solrFilter;
if( $solrFacetsFiler )
$filters[] = $solrFacetsFiler;
$queries = array();
$terms = MMGlobalSearchDictionaryTerm::fetchSolrTerms( $this->searchQuery, null, $this->suggestedTermsLimit() * 3 );
foreach( $terms as $term )
{
$query = array();
foreach( explode( ' ', $solrHighlightParams['hl.fl'] ) as $field )
$query[] = $field.':"'.addslashes( $term ).'"';
$queries[] = implode( ' OR ', $query );
}
$params = array(
'start' => 0,
'rows' => 0,
'q' => '*:*',
'fq' => implode(' AND ' , $filters),
'facet' => 'true',
'facet.query' => $queries,
);
$solrResults = SolrTool::rawSearch( $params );
$i = 0;
foreach( $solrResults['facet_counts']['facet_queries'] as $solrTerm => $solrTermCount )
{
if( $solrTermCount )
{
$term = $terms[$i];
if( strtolower( trim( $term ) ) != strtolower( trim( $this->searchQuery, ' "' ) ) )
{
$suggestions[] = array(
't' => $term,
'c' => $solrTermCount);
if( count( $suggestions ) >= $this->suggestedTermsLimit() )
break;
}
}
$i++;
}
// sort
usort( $suggestions, function($a, $b){
return ($a['c'] < $b['c']);
} );
eZDebug::accumulatorStop( __CLASS__.'::'.__FUNCTION__ );
return $suggestions;
}