本文整理汇总了PHP中eZUser::cleanupCache方法的典型用法代码示例。如果您正苦于以下问题:PHP eZUser::cleanupCache方法的具体用法?PHP eZUser::cleanupCache怎么用?PHP eZUser::cleanupCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZUser
的用法示例。
在下文中一共展示了eZUser::cleanupCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
if ($http->hasPostVariable('BrowseActionName') and $http->postVariable('BrowseActionName') == 'AssignRole') {
$selectedObjectIDArray = $http->postVariable('SelectedObjectIDArray');
$role = eZRole::fetch($roleID);
$db = eZDB::instance();
$db->begin();
foreach ($selectedObjectIDArray as $objectID) {
$role->assignToUser($objectID, $limitIdent, $limitValue);
}
// Clear role caches.
eZRole::expireCache();
$db->commit();
if (count($selectedObjectIDArray) > 0) {
eZContentCacheManager::clearAllContentCache();
}
/* Clean up policy cache */
eZUser::cleanupCache();
$Module->redirectTo('/role/view/' . $roleID);
} else {
if (is_string($limitIdent) && !isset($limitValue)) {
switch ($limitIdent) {
case 'subtree':
eZContentBrowse::browse(array('action_name' => 'SelectObjectRelationNode', 'from_page' => '/role/assign/' . $roleID . '/' . $limitIdent, 'cancel_page' => '/role/view/' . $roleID), $Module);
return;
break;
case 'section':
$sectionArray = eZSection::fetchList();
$tpl = eZTemplate::factory();
$tpl->setVariable('section_array', $sectionArray);
$tpl->setVariable('role_id', $roleID);
$tpl->setVariable('limit_ident', $limitIdent);
$Result = array();
示例2: execute
function execute( $xmlNode )
{
$xmlObjectID = $xmlNode->getAttribute( 'contentObject' );
$xmlParentNodeID = $xmlNode->getAttribute( 'addToNode' );
$setReferenceID = $xmlNode->getAttribute( 'setReference' );
$priority = $xmlNode->getAttribute( 'priority' );
$objectID = $this->getReferenceID( $xmlObjectID );
$parentNodeID = $this->getReferenceID( $xmlParentNodeID );
if ( !$objectID )
{
$this->writeMessage( "\tNo object defined.", 'error' );
return false;
}
if ( !$parentNodeID )
{
$this->writeMessage( "\tNo location defined.", 'error' );
return false;
}
$object = eZContentObject::fetch( $objectID );
if ( !$object )
{
$this->writeMessage( "\tObject not found.", 'error' );
return false;
}
$parentNode = eZContentObjectTreeNode::fetch( $parentNodeID );
if ( !$parentNode )
{
$this->writeMessage( "\tparent node not found.", 'error' );
return false;
}
$node = $object->attribute( 'main_node' );
$nodeAssignmentList = eZNodeAssignment::fetchForObject( $objectID, $object->attribute( 'current_version' ), 0, false );
$assignedNodes = $object->assignedNodes();
$parentNodeIDArray = array();
$setMainNode = false;
$hasMainNode = false;
foreach ( $assignedNodes as $assignedNode )
{
if ( $assignedNode->attribute( 'is_main' ) )
$hasMainNode = true;
$append = false;
foreach ( $nodeAssignmentList as $nodeAssignment )
{
if ( $nodeAssignment['parent_node'] == $assignedNode->attribute( 'parent_node_id' ) )
{
$append = true;
break;
}
}
if ( $append )
{
$parentNodeIDArray[] = $assignedNode->attribute( 'parent_node_id' );
}
}
if ( !$hasMainNode )
$setMainNode = true;
$mainNodeID = $parentNode->attribute( 'main_node_id' );
$objectName = $object->attribute( 'name' );
$db = eZDB::instance();
$db->begin();
$locationAdded = false;
$destNode = null;
if ( !in_array( $parentNodeID, $parentNodeIDArray ) )
{
$parentNodeObject = $parentNode->attribute( 'object' );
$insertedNode = $object->addLocation( $parentNodeID, true );
// Now set is as published and fix main_node_id
$insertedNode->setAttribute( 'contentobject_is_published', 1 );
$insertedNode->setAttribute( 'main_node_id', $node->attribute( 'main_node_id' ) );
$insertedNode->setAttribute( 'contentobject_version', $node->attribute( 'contentobject_version' ) );
// Make sure the url alias is set updated.
$insertedNode->updateSubTreePath();
$insertedNode->sync();
$locationAdded = true;
}
if ( $locationAdded )
{
$ini = eZINI::instance();
$userClassID = $ini->variable( "UserSettings", "UserClassID" );
if ( $object->attribute( 'contentclass_id' ) == $userClassID )
{
eZUser::cleanupCache();
}
$this->writeMessage( "\tAdded location of " . $object->attribute( 'name' ) . " to Node $parentNodeID", 'notice' );
$destNode = $insertedNode;
}
else
{
//.........这里部分代码省略.........
示例3: execute
//.........这里部分代码省略.........
self::writeDebug('writeNotice', "Content Class is: " . $objectContentClass);
$objectContentClassID = $object->attribute('contentclass_id');
self::writeDebug('writeNotice', "Default user class id is: " . $defaultUserClassID . ". This object class id is: " . $objectContentClassID);
/**
* Test if content object class ID matches ini settings default user content object class ID
* Only perform workflow event operations on content objects of the correct content class
*/
if ($objectContentClassID == $defaultUserClassID) {
// Fetch content object attributes needed
$assignedNodes = $object->attribute('assigned_nodes');
$objectDataMap = $object->attribute('data_map');
$objectNodeAssignments = eZNodeAssignment::fetchForObject($objectID, $object->attribute('current_version'), 0, false);
//$objectNodeAssignments = $object->attribute( 'assigned_nodes' );
// Get the selection content
$objectSelectionAttributeContent = $objectDataMap[$objectSelectionAttributeIdentifier]->attribute('content');
$objectSelectionAttributeContentString = implode(',', $objectSelectionAttributeContent);
self::writeDebug('writeNotice', "User object attribute " . $objectSelectionAttributeIdentifier . " content is set to: " . $objectSelectionAttributeContentString);
/**
* Test to ensure that object selection attribute content is greater than 0 (no selection) or
* that object selection attribute count is less than the count of userGroups (defined in ini settings)
*/
if ($objectSelectionAttributeContent > 0 || $objectSelectionAttributeContent < count($userGroups)) {
// Set userGroupID from ini defined user groups based on content object selection attribute content
$userGroupID = $userGroups[$objectSelectionAttributeContentString];
$selectedNodeID = $userGroupID;
}
$parentNodeIDs = array();
$ourNode = false;
/**
* Iterate over object assigned nodes and object node assignements
* test for parent node id matches and build array of parent_node_ids
* test for user content object selection attribute content selected node id
* and set node to move based on match
*/
foreach ($assignedNodes as $assignedNode) {
$append = false;
foreach ($objectNodeAssignments as $nodeAssignment) {
if ($nodeAssignment['parent_node'] == $assignedNode->attribute('parent_node_id')) {
$append = true;
break;
}
}
if ($append) {
$parentNodeIDs[] = $assignedNode->attribute('parent_node_id');
}
if ($assignedNode->attribute('parent_node_id') == $selectedNodeID) {
$ourNode = $assignedNode;
}
}
/**
* Test if we are to move the current main node to the selected location
*/
if ($move) {
self::writeDebug('writeDebug', 'Moving tactic');
if (!is_object($ourNode)) {
self::writeDebug('writeDebug', 'Node not found, so moving existing main node...');
eZContentObjectTreeNodeOperations::move($object->attribute('main_node_id'), $selectedNodeID);
}
} else {
/**
* Create a new node location assignment
*/
self::writeDebug('writeDebug', 'New node tactic');
if (!is_object($ourNode)) {
self::writeDebug('writeDebug', 'Node not found, so creating a new one ...');
$parentNode = eZContentObjectTreeNode::fetch($selectedNodeID);
$parentNodeObject = $parentNode->attribute('object');
// Add user content object location
$ourNode = $object->addLocation($selectedNodeID, true);
// Now set node as published and fix main_node_id
$ourNode->setAttribute('contentobject_is_published', 1);
$ourNode->setAttribute('main_node_id', $object->attribute('main_node_id'));
$ourNode->setAttribute('contentobject_version', $object->attribute('current_version'));
// Make sure the node's path_identification_string is set correctly
$ourNode->updateSubTreePath();
$ourNode->sync();
eZUser::cleanupCache();
}
if ($setMainNode) {
self::writeDebug('writeDebug', "'Setting as main node is enabled'", "", true);
if ($object->attribute('main_node_id') != $ourNode->attribute('node_id')) {
self::writeDebug('writeDebug', 'Existing main node is not our node, so updating main node', "", true);
eZContentObjectTreeNode::updateMainNodeID($ourNode->attribute('node_id'), $objectID, false, $selectedNodeID);
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
}
}
}
} else {
self::writeDebug('writeNotice', $objectName . ' is not a user class object');
}
if (self::WORKFLOW_TYPE_DEBUG_STOP_EXECUTION === true) {
die("<hr />\n\nWorkflow: " . self::WORKFLOW_TYPE_STRING . " execution has been ended before normal completion for debugging");
}
/**
* Return default succesful workflow event status code, by default, regardless of results of execution, always.
* Image alias image variation image files may not always need to be created. Also returning any other status
* will result in problems with the succesfull and normal completion of the workflow event process
*/
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:brookinsconsulting,项目名称:bcuserregisteruserplacement,代码行数:101,代码来源:bcuserregisteruserplacementtype.php
示例4: 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);
}
}
// Give other search engines that the default one a chance to reindex
// when removing locations.
if (!eZSearch::getEngine() instanceof eZSearchEngine) {
foreach ($objectIdList as $objectId => $object) {
eZContentOperationCollection::registerSearchObject($objectId, $object->attribute('current_version'));
}
}
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'));
}
$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::cleanupCache();
}
}
// we don't clear template block cache here since it's cleared in eZContentObjectTreeNode::removeNode()
return array('status' => true);
}