当前位置: 首页>>代码示例>>PHP>>正文


PHP eZUser::purgeUserCacheByUserId方法代码示例

本文整理汇总了PHP中eZUser::purgeUserCacheByUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP eZUser::purgeUserCacheByUserId方法的具体用法?PHP eZUser::purgeUserCacheByUserId怎么用?PHP eZUser::purgeUserCacheByUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZUser的用法示例。


在下文中一共展示了eZUser::purgeUserCacheByUserId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: move

 static function move($nodeID, $newParentNodeID)
 {
     $result = false;
     if (!is_numeric($nodeID) || !is_numeric($newParentNodeID)) {
         return false;
     }
     $node = eZContentObjectTreeNode::fetch($nodeID);
     if (!$node) {
         return false;
     }
     $object = $node->object();
     if (!$object) {
         return false;
     }
     $objectID = $object->attribute('id');
     $oldParentNode = $node->fetchParent();
     $oldParentObject = $oldParentNode->object();
     // clear user policy cache if this is a user object
     if (in_array($object->attribute('contentclass_id'), eZUser::contentClassIDs())) {
         eZUser::purgeUserCacheByUserId($object->attribute('id'));
     }
     // clear cache for old placement.
     eZContentCacheManager::clearContentCacheIfNeeded($objectID);
     $db = eZDB::instance();
     $db->begin();
     $node->move($newParentNodeID);
     $newNode = eZContentObjectTreeNode::fetchNode($objectID, $newParentNodeID);
     if ($newNode) {
         $newNode->updateSubTreePath(true, true);
         if ($newNode->attribute('main_node_id') == $newNode->attribute('node_id')) {
             // If the main node is moved we need to check if the section ID must change
             $newParentNode = $newNode->fetchParent();
             $newParentObject = $newParentNode->object();
             if ($object->attribute('section_id') != $newParentObject->attribute('section_id')) {
                 eZContentObjectTreeNode::assignSectionToSubTree($newNode->attribute('main_node_id'), $newParentObject->attribute('section_id'), $oldParentObject->attribute('section_id'));
             }
         }
         // modify assignment
         $curVersion = $object->attribute('current_version');
         $nodeAssignment = eZNodeAssignment::fetch($objectID, $curVersion, $oldParentNode->attribute('node_id'));
         if ($nodeAssignment) {
             $nodeAssignment->setAttribute('parent_node', $newParentNodeID);
             $nodeAssignment->setAttribute('op_code', eZNodeAssignment::OP_CODE_MOVE);
             $nodeAssignment->store();
             // update search index
             $nodeIDList = array($nodeID);
             eZSearch::removeNodeAssignment($node->attribute('main_node_id'), $newNode->attribute('main_node_id'), $object->attribute('id'), $nodeIDList);
             eZSearch::addNodeAssignment($newNode->attribute('main_node_id'), $object->attribute('id'), $nodeIDList);
         }
         $result = true;
     } else {
         eZDebug::writeError("Node {$nodeID} was moved to {$newParentNodeID} but fetching the new node failed");
     }
     $db->commit();
     // clear cache for new placement.
     eZContentCacheManager::clearContentCacheIfNeeded($objectID);
     return $result;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:58,代码来源:ezcontentobjecttreenodeoperations.php

示例2: setAttribute

 function setAttribute($attr, $val)
 {
     switch ($attr) {
         case 'is_enabled':
             if (!$val) {
                 $user = eZUser::fetch($this->UserID);
                 if ($user) {
                     eZUser::removeSessionData($this->UserID);
                 }
             }
             eZUser::purgeUserCacheByUserId($this->UserID);
             break;
     }
     parent::setAttribute($attr, $val);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:15,代码来源:ezusersetting.php

示例3: swapNode

 /**
  * Swap a node with another one
  *
  * @param int $nodeID
  * @param int $selectedNodeID
  * @param array $nodeIdList
  *
  * @return array An array with operation status, always true
  */
 public static function swapNode($nodeID, $selectedNodeID, $nodeIdList = array())
 {
     $userClassIDArray = eZUser::contentClassIDs();
     $node = eZContentObjectTreeNode::fetch($nodeID);
     $selectedNode = eZContentObjectTreeNode::fetch($selectedNodeID);
     $object = $node->object();
     $nodeParentNodeID = $node->attribute('parent_node_id');
     $nodeParent = $node->attribute('parent');
     $objectID = $object->attribute('id');
     $objectVersion = $object->attribute('current_version');
     $selectedObject = $selectedNode->object();
     $selectedObjectID = $selectedObject->attribute('id');
     $selectedObjectVersion = $selectedObject->attribute('current_version');
     $selectedNodeParentNodeID = $selectedNode->attribute('parent_node_id');
     $selectedNodeParent = $selectedNode->attribute('parent');
     $db = eZDB::instance();
     $db->begin();
     $node->setAttribute('contentobject_id', $selectedObjectID);
     $node->setAttribute('contentobject_version', $selectedObjectVersion);
     $selectedNode->setAttribute('contentobject_id', $objectID);
     $selectedNode->setAttribute('contentobject_version', $objectVersion);
     // fix main node id
     if ($node->isMain() && !$selectedNode->isMain()) {
         $node->setAttribute('main_node_id', $selectedNode->attribute('main_node_id'));
         $selectedNode->setAttribute('main_node_id', $selectedNode->attribute('node_id'));
     } else {
         if ($selectedNode->isMain() && !$node->isMain()) {
             $selectedNode->setAttribute('main_node_id', $node->attribute('main_node_id'));
             $node->setAttribute('main_node_id', $node->attribute('node_id'));
         }
     }
     $node->store();
     $selectedNode->store();
     // clear user policy cache if this was a user object
     if (in_array($object->attribute('contentclass_id'), $userClassIDArray)) {
         eZUser::purgeUserCacheByUserId($object->attribute('id'));
     }
     if (in_array($selectedObject->attribute('contentclass_id'), $userClassIDArray)) {
         eZUser::purgeUserCacheByUserId($selectedObject->attribute('id'));
     }
     // modify path string
     $changedOriginalNode = eZContentObjectTreeNode::fetch($nodeID);
     $changedOriginalNode->updateSubTreePath();
     $changedTargetNode = eZContentObjectTreeNode::fetch($selectedNodeID);
     $changedTargetNode->updateSubTreePath();
     // modify section
     if ($changedOriginalNode->isMain()) {
         $changedOriginalObject = $changedOriginalNode->object();
         $parentObject = $nodeParent->object();
         if ($changedOriginalObject->attribute('section_id') != $parentObject->attribute('section_id')) {
             eZContentObjectTreeNode::assignSectionToSubTree($changedOriginalNode->attribute('main_node_id'), $parentObject->attribute('section_id'), $changedOriginalObject->attribute('section_id'));
         }
     }
     if ($changedTargetNode->isMain()) {
         $changedTargetObject = $changedTargetNode->object();
         $selectedParentObject = $selectedNodeParent->object();
         if ($changedTargetObject->attribute('section_id') != $selectedParentObject->attribute('section_id')) {
             eZContentObjectTreeNode::assignSectionToSubTree($changedTargetNode->attribute('main_node_id'), $selectedParentObject->attribute('section_id'), $changedTargetObject->attribute('section_id'));
         }
     }
     eZContentObject::fixReverseRelations($objectID, 'swap');
     eZContentObject::fixReverseRelations($selectedObjectID, 'swap');
     $db->commit();
     // clear cache for new placement.
     eZContentCacheManager::clearContentCacheIfNeeded($objectID);
     eZSearch::swapNode($nodeID, $selectedNodeID, $nodeIdList = array());
     return array('status' => true);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:77,代码来源:ezcontentoperationcollection.php

示例4: array

    $user = eZUser::currentUser();
    $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $objectID, 'version' => $version->attribute('version')));
    if (array_key_exists('status', $operationResult) && $operationResult['status'] != eZModuleOperationInfo::STATUS_CONTINUE) {
        switch ($operationResult['status']) {
            case eZModuleOperationInfo::STATUS_HALTED:
            case eZModuleOperationInfo::STATUS_CANCELLED:
                $module->redirectToView('trash');
        }
    }
    $objectID = $object->attribute('id');
    $object = eZContentObject::fetch($objectID);
    $mainNodeID = $object->attribute('main_node_id');
    eZContentObjectTrashNode::purgeForObject($objectID);
    if ($locationAdded) {
        if ($object->attribute('contentclass_id') == $userClassID) {
            eZUser::purgeUserCacheByUserId($object->attribute('id'));
        }
    }
    eZContentObject::fixReverseRelations($objectID, 'restore');
    $db->commit();
    $module->redirectToView('view', array('full', $mainNodeID));
    return;
}
$tpl = eZTemplate::factory();
$res = eZTemplateDesignResource::instance();
$designKeys = array(array('object', $object->attribute('id')), array('remote_id', $object->attribute('remote_id')), array('class', $class->attribute('id')), array('class_identifier', $class->attribute('identifier')));
// Class identifier
$res->setKeys($designKeys);
$Result = array();
$tpl->setVariable("object", $object);
$tpl->setVariable("version", $version);
开发者ID:rmiguel,项目名称:ezpublish,代码行数:31,代码来源:restore.php

示例5: removeThis

 function removeThis()
 {
     $ini = eZINI::instance();
     $object = $this->object();
     $nodeID = $this->attribute('node_id');
     $objectID = $object->attribute('id');
     if (eZAudit::isAuditEnabled()) {
         // Set audit params.
         $objectName = $object->attribute('name');
         eZAudit::writeAudit('content-delete', array('Node ID' => $nodeID, 'Object ID' => $objectID, 'Content Name' => $objectName, 'Comment' => 'Removed the current node: eZContentObjectTreeNode::removeNode()'));
     }
     $db = eZDB::instance();
     $db->begin();
     $nodePath = $this->attribute('path_string');
     $childrensPath = $nodePath;
     $pathString = " path_string like '{$childrensPath}%' ";
     $urlAlias = $this->attribute('url_alias');
     // Remove static cache
     if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
         $optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
         $options = new ezpExtensionOptions($optionArray);
         $staticCacheHandler = eZExtension::getHandlerClass($options);
         $staticCacheHandler->removeURL("/" . $urlAlias);
         $staticCacheHandler->generateAlwaysUpdatedCache();
         $parent = $this->fetchParent();
     }
     $db->query("DELETE FROM ezcontentobject_tree\n                            WHERE {$pathString} OR\n                            path_string = '{$nodePath}'");
     // Re-cache parent node
     if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
         if ($parent) {
             $staticCacheHandler->cacheURL("/" . $parent->urlAlias());
         }
     }
     // Clean up URL alias entries
     eZURLAliasML::removeByAction('eznode', $nodeID);
     // Clean up content cache
     eZContentCacheManager::clearContentCacheIfNeeded($this->attribute('contentobject_id'));
     // clean up user cache
     if (in_array($object->attribute('contentclass_id'), eZUser::contentClassIDs())) {
         eZUser::removeSessionData($objectID);
         eZUser::purgeUserCacheByUserId($objectID);
     }
     $parentNode = $this->attribute('parent');
     if (is_object($parentNode)) {
         eZContentCacheManager::clearContentCacheIfNeeded($parentNode->attribute('contentobject_id'));
         $parentNode->updateAndStoreModified();
         eZNodeAssignment::purgeByParentAndContentObjectID($parentNode->attribute('node_id'), $objectID);
     }
     // Clean up policies and limitations
     eZRole::cleanupByNode($this);
     // Clean up recent items
     eZContentBrowseRecent::removeRecentByNodeID($nodeID);
     // Clean up bookmarks
     eZContentBrowseBookmark::removeByNodeID($nodeID);
     // Clean up tip-a-friend counter
     eZTipafriendCounter::removeForNode($nodeID);
     // Clean up view counter
     eZViewCounter::removeCounter($nodeID);
     $db->commit();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:60,代码来源:ezcontentobjecttreenode.php

示例6: tearDown

 public function tearDown()
 {
     eZUser::purgeUserCacheByUserId($this->userId);
     eZDir::cleanupEmptyDirectories(eZUser::getCacheDir($this->userId));
     parent::tearDown();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:6,代码来源:ezusercache_test.php


注:本文中的eZUser::purgeUserCacheByUserId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。