本文整理汇总了PHP中eZContentCacheManager::clearObjectViewCacheIfNeeded方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentCacheManager::clearObjectViewCacheIfNeeded方法的具体用法?PHP eZContentCacheManager::clearObjectViewCacheIfNeeded怎么用?PHP eZContentCacheManager::clearObjectViewCacheIfNeeded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentCacheManager
的用法示例。
在下文中一共展示了eZContentCacheManager::clearObjectViewCacheIfNeeded方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeNodes
/**
* Removes nodes
*
* This function does not check about permissions, this is the responsibility of the caller!
*
* @param array $removeNodeIdList Array of Node ID to remove
*
* @return array An array with operation status, always true
*/
public static function removeNodes(array $removeNodeIdList)
{
$mainNodeChanged = array();
$nodeAssignmentIdList = array();
$objectIdList = array();
$db = eZDB::instance();
$db->begin();
foreach ($removeNodeIdList as $nodeId) {
$node = eZContentObjectTreeNode::fetch($nodeId);
$objectId = $node->attribute('contentobject_id');
foreach (eZNodeAssignment::fetchForObject($objectId, eZContentObject::fetch($objectId)->attribute('current_version'), 0, false) as $nodeAssignmentKey => $nodeAssignment) {
if ($nodeAssignment['parent_node'] == $node->attribute('parent_node_id')) {
$nodeAssignmentIdList[$nodeAssignment['id']] = 1;
}
}
if ($nodeId == $node->attribute('main_node_id')) {
$mainNodeChanged[$objectId] = 1;
}
$node->removeThis();
if (!isset($objectIdList[$objectId])) {
$objectIdList[$objectId] = eZContentObject::fetch($objectId);
}
}
eZNodeAssignment::purgeByID(array_keys($nodeAssignmentIdList));
foreach (array_keys($mainNodeChanged) as $objectId) {
$allNodes = $objectIdList[$objectId]->assignedNodes();
// Registering node that will be promoted as 'main'
$mainNodeChanged[$objectId] = $allNodes[0];
eZContentObjectTreeNode::updateMainNodeID($allNodes[0]->attribute('node_id'), $objectId, false, $allNodes[0]->attribute('parent_node_id'));
}
// Give other search engines that the default one a chance to reindex
// when removing locations.
if (!eZSearch::getEngine() instanceof eZSearchEngine) {
foreach (array_keys($objectIdList) as $objectId) {
eZContentOperationCollection::registerSearchObject($objectId);
}
}
$db->commit();
//call appropriate method from search engine
eZSearch::removeNodes($removeNodeIdList);
$userClassIdList = eZUser::contentClassIDs();
foreach ($objectIdList as $objectId => $object) {
eZContentCacheManager::clearObjectViewCacheIfNeeded($objectId);
// clear user policy cache if this was a user object
if (in_array($object->attribute('contentclass_id'), $userClassIdList)) {
eZUser::purgeUserCacheByUserId($object->attribute('id'));
}
}
// we don't clear template block cache here since it's cleared in eZContentObjectTreeNode::removeNode()
return array('status' => true);
}
示例2: array
if ($newValue != $currentValue) {
if ($createNewVersion) {
$params = array('attributes' => array($attributeIdentifier => $newValue));
$result = eZContentFunctions::updateAndPublishObject($object, $params);
if (!$result) {
$data['status'] = 'error';
$data['message'] = "Error creating new object version";
$data['header'] = "HTTP/1.1 400 Bad Request";
} else {
$data['status'] = 'success';
}
} else {
$attribute->fromString($newValue);
$attribute->store();
eZSearch::addObject($object);
eZContentCacheManager::clearObjectViewCacheIfNeeded($object->attribute('id'));
$data['status'] = 'success';
}
}
} else {
$data['status'] = 'error';
$data['message'] = "Attribute not found";
$data['header'] = "HTTP/1.1 404 Not Found";
}
} else {
$data['status'] = 'error';
$data['message'] = "Attribute not found";
$data['header'] = "HTTP/1.1 404 Not Found";
}
} else {
$data['status'] = 'error';
示例3: eZIEImagePreAction
* File containing the ezie no save & quit menu item handler
*
* @copyright Copyright (C) eZ Systems AS.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
* @package ezie
*/
$prepare_action = new eZIEImagePreAction();
$imageId = $prepare_action->getImageId();
$imageVersion = $prepare_action->getImageVersion();
$imageAttribute = eZContentObjectAttribute::fetch($imageId, $imageVersion);
// Save the class attribute
$imageHandler = $prepare_action->getImageHandler();
$imageHandler->initializeFromFile($prepare_action->getImagePath(), $imageHandler->attribute('alternative_text'), $imageHandler->attribute('original_filename'));
// TODO: what's $contentobjectattribute (ask jerome) ?
$imageHandler->store($imageAttribute);
// remove view cache if needed
eZContentCacheManager::clearObjectViewCacheIfNeeded($imageAttribute->attribute('contentobject_id'));
// delete all the images in working directory
// delete working directory
$working_folder = eZDir::dirpath($prepare_action->getImagePath());
// deletes the working folder recursively
eZDir::recursiveDelete($working_folder);
// new attribute
$imageAttribute = eZContentObjectAttribute::fetch($imageId, $imageVersion);
// @todo Use proper JSON, but this will do for now.
$tpl = eZTemplate::factory();
$tpl->setVariable('ezie_ajax_response', true);
$tpl->setVariable('attribute', $imageAttribute);
echo $tpl->fetch("design:content/datatype/edit/ezimage.tpl");
eZExecution::cleanExit();
示例4: clearContentCacheIfNeeded
static function clearContentCacheIfNeeded($objectID, $versionNum = true, $additionalNodeList = false)
{
eZDebug::accumulatorStart('check_cache', '', 'Check cache');
eZContentCacheManager::clearObjectViewCacheIfNeeded($objectID, $versionNum, $additionalNodeList);
eZContentCacheManager::clearTemplateBlockCacheIfNeeded($objectID);
// Clear cached path strings of content SSL zones.
eZSSLZone::clearCacheIfNeeded();
eZDebug::accumulatorStop('check_cache');
return true;
}
示例5: editContentObject
//.........这里部分代码省略.........
$newRow['name'] = 'Row_' . ( $matrix->NumRows + 1 );
$matrix->NumRows++;
$matrix->Matrix['rows']['sequential'][] = $newRow;
}
$matrix->Cells = $cells;
$attribute->setAttribute( 'data_text', $matrix->xmlString() );
$matrix->decodeXML( $attribute->attribute( 'data_text' ) );
$attribute->setContent( $matrix );
}
} break;
case 'ezauthor':
case 'ezbinaryfile':
case 'ezcountry':
case 'ezdate':
case 'ezdatetime':
case 'ezenum':
case 'ezidentifier':
case 'ezinisetting':
case 'ezisbn':
case 'ezmedia':
case 'ezmultioption':
case 'ezmultiprice':
case 'ezobjectrelationlist':
case 'ezoption':
case 'ezpackage':
case 'ezproductcategory':
case 'ezrangeoption':
case 'ezsubtreesubscription':
case 'eztime':
{
$this->writeMessage( "\tDatatype " . $dataType . " not supported yet.", 'warning' );
} break;
}
$attribute->store();
}
}
if ( isset($objectInformation['sectionID']) && $objectInformation['sectionID'] != '' && $objectInformation['sectionID'] != 0 )
{
$contentObject->setAttribute( 'section_id', $objectInformation['sectionID'] );
}
if ( isset($objectInformation['creatorID']) && $objectInformation['creatorID'] != '' && $objectInformation['creatorID'] != 0 )
{
$contentObjectVersion->setAttribute( 'creator_id', $objectInformation['creatorID'] );
}
if ( isset($objectInformation['ownerID']) && $objectInformation['ownerID'] != '' && $objectInformation['ownerID'] != 0 )
{
$contentObject->setAttribute( 'owner_id', $objectInformation['ownerID'] );
}
$contentObjectVersion->store();
$contentObject->store();
$db->commit();
eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObject->attribute( 'id' ), 'version' => $versionNumber ) );
// set chosen hidden/invisible attributes for object nodes
$http = eZHTTPTool::instance();
$assignedNodes = $contentObject->assignedNodes( true );
foreach ( $assignedNodes as $node )
{
$nodeID = $node->attribute( 'node_id' );
$parentNodeID = $node->attribute( 'parent_node_id' );
$db = eZDB::instance();
$db->begin();
$parentNode = eZContentObjectTreeNode::fetch( $parentNodeID );
eZContentObjectTreeNode::updateNodeVisibility( $node, $parentNode, /* $recursive = */ false );
$db->commit();
unset( $node, $parentNode );
}
unset( $assignedNodes );
eZContentCacheManager::clearObjectViewCacheIfNeeded( $contentObject->attribute( 'id' ) );
$newNodeArray = eZContentObjectTreeNode::fetchByContentObjectID( $contentObject->attribute( 'id' ) );
$refArray = false;
if ( $newNodeArray && count($newNodeArray) >= 1 )
{
$newNode = $newNodeArray[0];
if ( $newNode )
{
$refArray = array( "node_id" => $newNode->attribute( 'node_id' ),
"name" => $contentObject->attribute( 'name' ),
"object_id" => $contentObject->attribute( 'id' ) );
}
}
unset($contentObjectVersion);
unset($contentObject);
return $refArray;
}
return false;
}