本文整理汇总了PHP中eZDebugSetting::writeDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebugSetting::writeDebug方法的具体用法?PHP eZDebugSetting::writeDebug怎么用?PHP eZDebugSetting::writeDebug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebugSetting
的用法示例。
在下文中一共展示了eZDebugSetting::writeDebug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanupEmptyDirectories
/**
* Goes trough the directory path and removes empty directories, starting at
* the leaf and deleting down until a non empty directory is reached.
* If the path is not a directory, nothing will happen.
*
* @param string $path
*/
public static function cleanupEmptyDirectories($path)
{
$dirpath = eZDir::dirpath($path);
eZDebugSetting::writeDebug('kernel-clustering', "eZClusterFileHandler::cleanupEmptyDirectories( '{$dirpath}' )");
if (is_dir($dirpath)) {
eZDir::cleanupEmptyDirectories($dirpath);
}
}
示例2: 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))));
}
}
示例3: initializeEvent
function initializeEvent($event, $params)
{
eZDebugSetting::writeDebug('kernel-notification', $params, 'params for type');
$time = 0;
if (array_key_exists('time', $params)) {
$time = $params['time'];
} else {
$time = time();
}
$event->setAttribute('data_int1', $time);
}
示例4: passwordHasExpired
/**
* Writes audit information and redirects the user to the password change form.
*
* @param eZUser $user
*/
protected static function passwordHasExpired($user)
{
$userID = $user->attribute('contentobject_id');
// Password expired
eZDebugSetting::writeDebug('kernel-user', $user, 'user password expired');
// Failed login attempts should be logged
$userIDAudit = isset($userID) ? $userID : 'null';
$loginEscaped = eZDB::instance()->escapeString($user->attribute('login'));
eZAudit::writeAudit('user-failed-login', array('User id' => $userIDAudit, 'User login' => $loginEscaped, 'Comment' => 'Failed login attempt: Password Expired. eZPaExUser::loginUser()'));
// Redirect user to password change form
self::redirectToChangePasswordForm($userID);
}
示例5: cachedTree
static function cachedTree($key, $uri, $res, $templatePath, &$extraParameters)
{
$templateCache =& eZTemplateTreeCache::cacheTable();
$key = eZTemplateTreeCache::internalKey($key);
$root = null;
if (isset($templateCache[$key])) {
$root =& $templateCache[$key]['root'];
eZDebugSetting::writeDebug('eztemplate-tree-cache', "Cache hit for uri '{$uri}' with key '{$key}'", 'eZTemplateTreeCache::cachedTree');
} else {
eZDebugSetting::writeDebug('eztemplate-tree-cache', "Cache miss for uri '{$uri}' with key '{$key}'", 'eZTemplateTreeCache::cachedTree');
}
return $root;
}
示例6: handle
function handle($event)
{
eZDebugSetting::writeDebug('kernel-notification', $event, "trying to handle event");
if ($event->attribute('event_type_string') == 'ezcollaboration') {
$parameters = array();
$status = $this->handleCollaborationEvent($event, $parameters);
if ($status == eZNotificationEventHandler::EVENT_HANDLED) {
$this->sendMessage($event, $parameters);
} else {
return false;
}
}
return true;
}
示例7: validateInput
function validateInput($http, $base, $contentObjectAttribute)
{
$contentObjectID = $contentObjectAttribute->attribute('contentobject_id');
$contentObjectAttributeID = $contentObjectAttribute->attribute('id');
$contentObjectAttributeVersion = $contentObjectAttribute->attribute('version');
if ($http->hasPostVariable($base . '_data_text_' . $contentObjectAttributeID)) {
$data = $http->postVariable($base . '_data_text_' . $contentObjectAttributeID);
// Set original input to a global variable
$originalInput = 'originalInput_' . $contentObjectAttributeID;
$GLOBALS[$originalInput] = $data;
// Set input valid true to a global variable
$isInputValid = 'isInputValid_' . $contentObjectAttributeID;
$GLOBALS[$isInputValid] = true;
$text = $data;
$text = preg_replace('/\\r/', '', $text);
$text = preg_replace('/\\t/', ' ', $text);
// first empty paragraph
$text = preg_replace('/^\\n/', '<p></p>', $text);
eZDebugSetting::writeDebug('kernel-datatype-ezxmltext', $text, 'eZSimplifiedXMLInput::validateInput text');
$parser = new eZSimplifiedXMLInputParser($contentObjectID, true, eZXMLInputParser::ERROR_ALL, true);
$document = $parser->process($text);
if (!is_object($document)) {
$GLOBALS[$isInputValid] = false;
$errorMessage = implode(' ', $parser->getMessages());
$contentObjectAttribute->setValidationError($errorMessage);
return eZInputValidator::STATE_INVALID;
}
if ($contentObjectAttribute->validateIsRequired()) {
$root = $document->documentElement;
if (!$root->hasChildNodes()) {
$contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'Content required'));
return eZInputValidator::STATE_INVALID;
}
}
$contentObjectAttribute->setValidationLog($parser->getMessages());
$xmlString = eZXMLTextType::domString($document);
$urlIDArray = $parser->getUrlIDArray();
if (count($urlIDArray) > 0) {
$this->updateUrlObjectLinks($contentObjectAttribute, $urlIDArray);
}
$contentObject = $contentObjectAttribute->attribute('object');
$contentObject->appendInputRelationList($parser->getRelatedObjectIDArray(), eZContentObject::RELATION_EMBED);
$contentObject->appendInputRelationList($parser->getLinkedObjectIDArray(), eZContentObject::RELATION_LINK);
$contentObjectAttribute->setAttribute('data_text', $xmlString);
return eZInputValidator::STATE_ACCEPTED;
}
return eZInputValidator::STATE_ACCEPTED;
}
示例8: create
static function create($notificationEventTypeString)
{
$types =& $GLOBALS["eZNotificationEventTypes"];
if (!isset($types[$notificationEventTypeString])) {
eZDebugSetting::writeDebug('kernel-notification', $types, 'notification types');
eZNotificationEventType::loadAndRegisterType($notificationEventTypeString);
eZDebugSetting::writeDebug('kernel-notification', $types, 'notification types 2');
}
$def = null;
if (isset($types[$notificationEventTypeString])) {
$className = $types[$notificationEventTypeString];
$def =& $GLOBALS["eZNotificationEventTypeObjects"][$notificationEventTypeString];
if (!is_object($def) || strtolower(get_class($def)) != $className) {
$def = new $className();
}
}
return $def;
}
示例9: setDateForItem
static function setDateForItem($item, $settings)
{
if (!is_array($settings)) {
return false;
}
$dayNum = isset($settings['day']) ? $settings['day'] : false;
$hour = $settings['hour'];
$currentDate = getdate();
$hoursDiff = $hour - $currentDate['hours'];
switch ($settings['frequency']) {
case 'day':
if ($hoursDiff <= 0) {
$hoursDiff += 24;
}
$secondsDiff = 3600 * $hoursDiff - $currentDate['seconds'] - 60 * $currentDate['minutes'];
break;
case 'week':
$daysDiff = $dayNum - $currentDate['wday'];
if ($daysDiff < 0 or $daysDiff == 0 and $hoursDiff <= 0) {
$daysDiff += 7;
}
$secondsDiff = 3600 * ($daysDiff * 24 + $hoursDiff) - $currentDate['seconds'] - 60 * $currentDate['minutes'];
break;
case 'month':
// If the daynum the user has chosen is larger than the number of days in this month,
// then reduce it to the number of days in this month.
$daysInMonth = intval(date('t', mktime(0, 0, 0, $currentDate['mon'], 1, $currentDate['year'])));
if ($dayNum > $daysInMonth) {
$dayNum = $daysInMonth;
}
$daysDiff = $dayNum - $currentDate['mday'];
if ($daysDiff < 0 or $daysDiff == 0 and $hoursDiff <= 0) {
$daysDiff += $daysInMonth;
}
$secondsDiff = 3600 * ($daysDiff * 24 + $hoursDiff) - $currentDate['seconds'] - 60 * $currentDate['minutes'];
break;
}
$sendDate = time() + $secondsDiff;
eZDebugSetting::writeDebug('kernel-notification', getdate($sendDate), "item date");
$item->setAttribute('send_date', $sendDate);
return $sendDate;
}
示例10: foreach
function &inputParagraphXML( &$paragraph,
$currentSectionLevel,
$tdSectionLevel = null,
$noRender = false )
{
$output = '';
$children = $paragraph->childNodes;
if ( $noRender )
{
foreach ( $children as $child )
{
$output .= $this->inputTagXML( $child, $currentSectionLevel, $tdSectionLevel );
}
return $output;
}
$paragraphClassName = $paragraph->getAttribute( 'class' );
$paragraphAlign = $paragraph->getAttribute( 'align' );
$customAttributePart = self::getCustomAttrPart( $paragraph, $styleString );
if ( $paragraphAlign )
{
$customAttributePart .= ' align="' . $paragraphAlign . '"';
}
if ( $paragraphClassName )
{
$customAttributePart .= ' class="' . $paragraphClassName . '"';
}
$openPara = "<p$customAttributePart$styleString>";
$closePara = '</p>';
if ( $children->length == 0 )
{
$output = $openPara . $closePara;
return $output;
}
$lastChildInline = null;
$innerContent = '';
foreach ( $children as $child )
{
$childOutput = $this->inputTagXML( $child, $currentSectionLevel, $tdSectionLevel );
// Some tags in xhtml aren't allowed as child of paragraph
$inline = !( $child->nodeName === 'ul'
|| $child->nodeName === 'ol'
|| $child->nodeName === 'literal'
|| ( $child->nodeName === 'custom'
&& !self::customTagIsInline( $child->getAttribute( 'name' ) ) )
|| ( $child->nodeName === 'embed'
&& !self::embedTagIsCompatibilityMode()
&& !self::embedTagIsImageByNode( $child ) )
);
if ( $inline )
{
$innerContent .= $childOutput;
}
if ( ( !$inline && $lastChildInline ) ||
( $inline && !$child->nextSibling ) )
{
$output .= $openPara . $innerContent . $closePara;
$innerContent = '';
}
if ( !$inline )
{
$output .= $childOutput;
}
$lastChildInline = $inline;
}
eZDebugSetting::writeDebug( 'kernel-datatype-ezxmltext', $output, __METHOD__ . ' output' );
return $output;
}
示例11: eZPostgreSQLDB
function eZPostgreSQLDB($parameters)
{
$this->eZDBInterface($parameters);
if (!extension_loaded('pgsql')) {
if (function_exists('eZAppendWarningItem')) {
eZAppendWarningItem(array('error' => array('type' => 'ezdb', 'number' => eZDBInterface::ERROR_MISSING_EXTENSION), 'text' => 'PostgreSQL extension was not found, the DB handler will not be initialized.'));
$this->IsConnected = false;
}
eZDebug::writeWarning('PostgreSQL extension was not found, the DB handler will not be initialized.', 'eZPostgreSQLDB');
return;
}
eZDebug::createAccumulatorGroup('postgresql_total', 'Postgresql Total');
$ini = eZINI::instance();
$server = $this->Server;
$port = $this->Port;
$db = $this->DB;
$user = $this->User;
$password = $this->Password;
$connectString = self::connectString($this->Server, $this->Port, $this->DB, $this->User, $this->Password);
if ($ini->variable("DatabaseSettings", "UsePersistentConnection") == "enabled" && function_exists("pg_pconnect")) {
eZDebugSetting::writeDebug('kernel-db-postgresql', $ini->variable("DatabaseSettings", "UsePersistentConnection"), "using persistent connection");
// avoid automatic SQL errors
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_pconnect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$maxAttempts = $this->connectRetryCount();
$waitTime = $this->connectRetryWaitTime();
$numAttempts = 1;
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_pconnect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$numAttempts++;
}
if ($this->DBConnection) {
$this->IsConnected = true;
} else {
throw new eZDBNoConnectionException($server, $this->ErrorMessage, $this->ErrorNumber);
}
} else {
if (function_exists("pg_connect")) {
eZDebugSetting::writeDebug('kernel-db-postgresql', "using real connection", "using real connection");
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_connect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$maxAttempts = $this->connectRetryCount();
$waitTime = $this->connectRetryWaitTime();
$numAttempts = 1;
while ($this->DBConnection == false and $numAttempts <= $maxAttempts) {
sleep($waitTime);
$oldHandling = eZDebug::setHandleType(eZDebug::HANDLE_EXCEPTION);
eZDebug::accumulatorStart('postgresql_connection', 'postgresql_total', 'Database connection');
try {
$this->DBConnection = pg_connect($connectString);
} catch (ErrorException $e) {
}
eZDebug::accumulatorStop('postgresql_connection');
eZDebug::setHandleType($oldHandling);
$numAttempts++;
}
if ($this->DBConnection) {
$this->IsConnected = true;
} else {
$this->setError();
throw new eZDBNoConnectionException($server, $this->ErrorMessage, $this->ErrorNumber);
}
} else {
$this->IsConnected = false;
eZDebug::writeError("PostgreSQL support not compiled into PHP, contact your system administrator", "eZPostgreSQLDB");
}
}
}
示例12: canInstantiateClassList
//.........这里部分代码省略.........
}
}
$languageCodeList = eZContentLanguage::fetchLocaleList();
$allowedLanguages = array('*' => array());
$user = eZUser::currentUser();
$accessResult = $user->hasAccessTo('content', 'create');
$accessWord = $accessResult['accessWord'];
$classIDArray = array();
$classList = array();
$fetchAll = false;
if ($accessWord == 'yes') {
$fetchAll = true;
$allowedLanguages['*'] = $languageCodeList;
} else {
if ($accessWord == 'no') {
// Cannot create any objects, return empty list.
return $classList;
} else {
$policies = $accessResult['policies'];
foreach ($policies as $policyKey => $policy) {
$classIDArrayPart = '*';
if (isset($policy['Class'])) {
$classIDArrayPart = $policy['Class'];
}
$languageCodeArrayPart = $languageCodeList;
if (isset($policy['Language'])) {
$languageCodeArrayPart = array_intersect($policy['Language'], $languageCodeList);
}
// No class limitation for this policy AND no previous limitation(s)
if ($classIDArrayPart == '*' && empty($classIDArray)) {
$fetchAll = true;
$allowedLanguages['*'] = array_unique(array_merge($allowedLanguages['*'], $languageCodeArrayPart));
} else {
if (is_array($classIDArrayPart)) {
$fetchAll = false;
foreach ($classIDArrayPart as $class) {
if (isset($allowedLanguages[$class])) {
$allowedLanguages[$class] = array_unique(array_merge($allowedLanguages[$class], $languageCodeArrayPart));
} else {
$allowedLanguages[$class] = $languageCodeArrayPart;
}
}
$classIDArray = array_merge($classIDArray, array_diff($classIDArrayPart, $classIDArray));
}
}
}
}
}
$db = eZDB::instance();
$filterTableSQL = '';
$filterSQL = '';
// Create extra SQL statements for the class group filters.
if (is_array($groupList)) {
if (count($groupList) == 0) {
return $classList;
}
$filterTableSQL = ', ezcontentclass_classgroup ccg';
$filterSQL = " AND" . " cc.id = ccg.contentclass_id AND" . " ";
$filterSQL .= $db->generateSQLINStatement($groupList, 'ccg.group_id', !$includeFilter, true, 'int');
}
$classNameFilter = eZContentClassName::sqlFilter('cc');
$filterSQL .= " AND cc.id=" . $classNameFilter['from'] . ".contentclass_id";
if ($fetchAll) {
// If $asObject is true we fetch all fields in class
$fields = $asObject ? "cc.*, {$classNameFilter['nameField']}" : "cc.id, {$classNameFilter['nameField']}";
$rows = $db->arrayQuery("SELECT DISTINCT {$fields} " . "FROM ezcontentclass cc{$filterTableSQL}, {$classNameFilter['from']} " . "WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " {$filterSQL} " . "ORDER BY {$classNameFilter['nameField']} ASC");
$classList = eZPersistentObject::handleRows($rows, 'eZContentClass', $asObject);
} else {
// If the constrained class list is empty we are not allowed to create any class
if (count($classIDArray) == 0) {
return $classList;
}
$classIDCondition = $db->generateSQLINStatement($classIDArray, 'cc.id');
// If $asObject is true we fetch all fields in class
$fields = $asObject ? "cc.*, {$classNameFilter['nameField']}" : "cc.id, {$classNameFilter['nameField']}";
$rows = $db->arrayQuery("SELECT DISTINCT {$fields} " . "FROM ezcontentclass cc{$filterTableSQL}, {$classNameFilter['from']} " . "WHERE {$classIDCondition} AND" . " cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " {$filterSQL} " . "ORDER BY {$classNameFilter['nameField']} ASC");
$classList = eZPersistentObject::handleRows($rows, 'eZContentClass', $asObject);
}
if ($asObject) {
foreach ($classList as $key => $class) {
$id = $class->attribute('id');
if (isset($allowedLanguages[$id])) {
$languageCodes = array_unique(array_merge($allowedLanguages['*'], $allowedLanguages[$id]));
} else {
$languageCodes = $allowedLanguages['*'];
}
$classList[$key]->setCanInstantiateLanguages($languageCodes);
}
}
eZDebugSetting::writeDebug('kernel-content-class', $classList, "class list fetched from db");
if ($enableCaching) {
if ($fetchID !== false) {
$groupArray[$fetchID] = $classList;
$http->setSessionVariable($cacheVar, $groupArray);
} else {
$http->setSessionVariable($cacheVar, $classList);
}
}
return $classList;
}
示例13: handleNodeTemplate
function handleNodeTemplate( $module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $tpl )
{
// When the object has been published we will use the nodes as
// node-assignments by faking the list, this is required since new
// version of the object does not have node-assignments/
// When the object is a draft we use the normal node-assignment list
$assignedNodeArray = array();
$versionedAssignedNodeArray = $version->attribute( 'parent_nodes' );
$parentNodeIDMap = array();
$nodes = $object->assignedNodes();
$i = 0;
foreach ( $nodes as $node )
{
$data = array( 'id' => null,
'contentobject_id' => $object->attribute( 'id' ),
'contentobject_version' => $version->attribute( 'version' ),
'parent_node' => $node->attribute( 'parent_node_id' ),
'sort_field' => $node->attribute( 'sort_field' ),
'sort_order' => $node->attribute( 'sort_order' ),
'is_main' => ( $node->attribute( 'main_node_id' ) == $node->attribute( 'node_id' ) ? 1 : 0 ),
'parent_remote_id' => $node->attribute( 'remote_id' ),
'op_code' => eZNodeAssignment::OP_CODE_NOP );
$assignment = eZNodeAssignment::create( $data );
$assignedNodeArray[$i] = $assignment;
$parentNodeIDMap[$node->attribute( 'parent_node_id' )] = $i;
++$i;
}
foreach ( $versionedAssignedNodeArray as $nodeAssignment )
{
$opCode = $nodeAssignment->attribute( 'op_code' );
if ( ( $opCode & 1 ) == eZNodeAssignment::OP_CODE_NOP ) // If the execute bit is not set it will be ignored.
{
continue;
}
// Only add assignments whose parent is not present in the published nodes.
if ( isset( $parentNodeIDMap[$nodeAssignment->attribute( 'parent_node' )] ) )
{
if ( $opCode == eZNodeAssignment::OP_CODE_CREATE ) // CREATE entries are just skipped
{
continue;
}
// Or if they have an op_code (move,remove) set, in which case they overwrite the entry
$index = $parentNodeIDMap[$nodeAssignment->attribute( 'parent_node' )];
$assignedNodeArray[$index]->setAttribute( 'id', $nodeAssignment->attribute( 'id' ) );
$assignedNodeArray[$index]->setAttribute( 'from_node_id', $nodeAssignment->attribute( 'from_node_id' ) );
$assignedNodeArray[$index]->setAttribute( 'remote_id', $nodeAssignment->attribute( 'remote_id' ) );
$assignedNodeArray[$index]->setAttribute( 'op_code', $nodeAssignment->attribute( 'op_code' ) );
continue;
}
if ( $opCode == eZNodeAssignment::OP_CODE_REMOVE ||
$opCode == eZNodeAssignment::OP_CODE_MOVE )
{
// The node-assignment has a remove/move operation but the node does not exist.
// We will not show it in this case.
continue;
}
$assignedNodeArray[$i] = $nodeAssignment;
++$i;
}
eZDebugSetting::writeDebug( 'kernel-content-edit', $assignedNodeArray, "assigned nodes array" );
$remoteMap = array();
$db = eZDB::instance();
$db->begin();
foreach ( $assignedNodeArray as $assignedNodeKey => $assignedNode )
{
$node = $assignedNode->getParentNode();
if ( $node !== null )
{
$remoteID = $assignedNode->attribute( 'remote_id' );
if ( $remoteID > 0 )
{
if ( isset( $remoteMap[$remoteID] ) )
{
if ( is_array( $remoteMap[$remoteID] ) )
{
$remoteMap[$remoteID][] = $assignedNode;
}
else
{
$currentRemote = $remoteMap[$remoteID];
unset( $remoteMap[$remoteID] );
$remoteMap[$remoteID] = array();
$remoteMap[$remoteID][] = $currentRemote;
$remoteMap[$remoteID][] = $assignedNode;
}
}
else
{
$remoteMap[$remoteID] = $assignedNode;
}
}
}
else
{
$assignedNode->purge();
if( isset( $assignedNodeArray[$assignedNodeKey] ) )
unset( $assignedNodeArray[$assignedNodeKey] );
}
}
//.........这里部分代码省略.........
示例14: hasCompiledTemplate
static function hasCompiledTemplate($key, $timestamp, &$resourceData)
{
if (!eZTemplateCompiler::isCompilationEnabled()) {
return false;
}
if (eZTemplateCompiler::alwaysGenerate()) {
return false;
}
$cacheFileName = eZTemplateCompiler::compilationFilename($key, $resourceData);
$php = new eZPHPCreator(eZTemplateCompiler::compilationDirectory(), $cacheFileName, eZTemplateCompiler::TemplatePrefix());
$canRestore = $php->canRestore($timestamp);
$uri = false;
if ($canRestore) {
eZDebugSetting::writeDebug('eztemplate-compile', "Cache hit for uri '{$uri}' with key '{$key}'", 'eZTemplateCompiler::hasCompiledTemplate');
} else {
eZDebugSetting::writeDebug('eztemplate-compile', "Cache miss for uri '{$uri}' with key '{$key}'", 'eZTemplateCompiler::hasCompiledTemplate');
}
return $canRestore;
}
示例15: sendToPublishingQueue
/**
* Sends the published object/version for publishing to the queue
* Used by the content/publish operation
* @param int $objectId
* @param int $version
*
* @return array( status => int )
* @since 4.5
*/
public static function sendToPublishingQueue($objectId, $version)
{
$behaviour = ezpContentPublishingBehaviour::getBehaviour();
if ($behaviour->disableAsynchronousPublishing) {
$asyncEnabled = false;
} else {
$asyncEnabled = eZINI::instance('content.ini')->variable('PublishingSettings', 'AsynchronousPublishing') == 'enabled';
}
$accepted = true;
if ($asyncEnabled === true) {
// Filter handlers
$ini = eZINI::instance('content.ini');
$filterHandlerClasses = $ini->variable('PublishingSettings', 'AsynchronousPublishingFilters');
if (count($filterHandlerClasses)) {
$versionObject = eZContentObjectVersion::fetchVersion($version, $objectId);
foreach ($filterHandlerClasses as $filterHandlerClass) {
if (!class_exists($filterHandlerClass)) {
eZDebug::writeError("Unknown asynchronous publishing filter handler class '{$filterHandlerClass}'", __METHOD__);
continue;
}
$handler = new $filterHandlerClass($versionObject);
if (!$handler instanceof ezpAsynchronousPublishingFilterInterface) {
eZDebug::writeError("Asynchronous publishing filter handler class '{$filterHandlerClass}' does not implement ezpAsynchronousPublishingFilterInterface", __METHOD__);
continue;
}
$accepted = $handler->accept();
if (!$accepted) {
eZDebugSetting::writeDebug("Object #{$objectId}/{$version} was excluded from asynchronous publishing by {$filterHandlerClass}", __METHOD__);
break;
}
}
}
unset($filterHandlerClasses, $handler);
}
if ($asyncEnabled && $accepted) {
// if the object is already in the process queue, we move ahead
// this test should NOT be necessary since http://issues.ez.no/17840 was fixed
if (ezpContentPublishingQueue::isQueued($objectId, $version)) {
return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
} else {
ezpContentPublishingQueue::add($objectId, $version);
return array('status' => eZModuleOperationInfo::STATUS_HALTED, 'redirect_url' => "content/queued/{$objectId}/{$version}");
}
} else {
return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
}
}