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


PHP eZRole::expireCache方法代码示例

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


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

示例1: move

 function move($newParentNodeID, $nodeID = 0)
 {
     if ($nodeID == 0) {
         $node = $this;
         $nodeID = $node->attribute('node_id');
     } else {
         $node = eZContentObjectTreeNode::fetch($nodeID);
     }
     $oldPath = $node->attribute('path_string');
     $oldParentNodeID = $node->attribute('parent_node_id');
     $newParentNodeID = (int) $newParentNodeID;
     if ($oldParentNodeID != $newParentNodeID) {
         $node->updateAndStoreModified();
         // Who moves which content should be logged.
         $object = $node->object();
         eZAudit::writeAudit('content-move', array('Node ID' => $node->attribute('node_id'), 'Old parent node ID' => $oldParentNodeID, 'New parent node ID' => $newParentNodeID, 'Object ID' => $object->attribute('id'), 'Content Name' => $object->attribute('name'), 'Comment' => 'Moved the node to the given node: eZContentObjectTreeNode::move()'));
         $newParentNode = eZContentObjectTreeNode::fetch($newParentNodeID);
         $newParentPath = $newParentNode->attribute('path_string');
         $newParentDepth = $newParentNode->attribute('depth');
         $newPath = $newParentPath . $nodeID;
         $oldDepth = $node->attribute('depth');
         $oldPathLength = strlen($oldPath);
         $moveQuery = "UPDATE\n                                 ezcontentobject_tree\n                          SET\n                                 parent_node_id = {$newParentNodeID}\n                          WHERE\n                                 node_id = {$nodeID}";
         $db = eZDB::instance();
         $subStringString = $db->subString('path_string', $oldPathLength);
         $newPathString = $db->concatString(array("'{$newPath}'", $subStringString));
         $moveQuery1 = "UPDATE\n                                 ezcontentobject_tree\n                           SET\n                                 path_identification_string = " . $db->concatString(array("'" . $db->escapeString($newParentNode->PathIdentificationString) . "'", $db->subString("path_identification_string", mb_strlen($node->PathIdentificationString) + 1))) . ",\n                                 path_string = {$newPathString},\n                                 depth = depth + {$newParentDepth} - {$oldDepth} + 1\n                           WHERE\n                                 path_string LIKE '{$oldPath}%'";
         $db->begin();
         $db->query($moveQuery);
         $db->query($moveQuery1);
         /// role system clean up
         // Clean up policies and limitations
         $expireRoleCache = false;
         $limitationsToFix = eZPolicyLimitation::findByType('SubTree', $node->attribute('path_string'), false);
         if (count($limitationsToFix) > 0) {
             $limitationIDString = $db->generateSQLINStatement($limitationsToFix, 'limitation_id');
             $subStringString = $db->subString('value', $oldPathLength);
             $newValue = $db->concatString(array("'{$newPath}'", $subStringString));
             $query = "UPDATE\n                                ezpolicy_limitation_value\n                          SET\n                                value = {$newValue}\n                          WHERE\n                                value LIKE '{$oldPath}%' AND {$limitationIDString}";
             $db->query($query);
             $expireRoleCache = true;
         }
         // clean up limitations on role assignment level
         $countRows = $db->arrayQuery("SELECT COUNT(*) AS row_count FROM ezuser_role WHERE limit_identifier='Subtree' AND limit_value LIKE '{$oldPath}%'");
         $assignmentsToFixCount = $countRows[0]['row_count'];
         if ($assignmentsToFixCount > 0) {
             $subStringString = $db->subString('limit_value', $oldPathLength);
             $newValue = $db->concatString(array("'{$newPath}'", $subStringString));
             $db->query("UPDATE\n                                ezuser_role\n                             SET\n                                limit_value = {$newValue}\n                             WHERE\n                                limit_identifier='Subtree' AND limit_value LIKE '{$oldPath}%'");
             $expireRoleCache = true;
         }
         if ($expireRoleCache) {
             eZRole::expireCache();
         }
         // Update "is_invisible" node attribute.
         $newNode = eZContentObjectTreeNode::fetch($nodeID);
         eZContentObjectTreeNode::updateNodeVisibility($newNode, $newParentNode);
         $db->commit();
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:60,代码来源:ezcontentobjecttreenode.php

示例2: foreach

     $selectedNodeIDArray = $http->postVariable('SelectedNodeIDArray');
     if (count($selectedNodeIDArray) == 1) {
         $limitValue = $selectedNodeIDArray[0];
     }
     $Module->redirectTo('/role/assign/' . $roleID . '/' . $limitIdent . '/' . $limitValue);
 } else {
     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':
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:assign.php

示例3: cleanupByNode

 static function cleanupByNode($node)
 {
     // Clean up role assignments with limitations related to this object
     $db = eZDB::instance();
     $db->begin();
     $pathString = $node->attribute('path_string');
     $nodeID = $node->attribute('node_id');
     $db->query("DELETE FROM ezuser_role\n                     WHERE limit_value LIKE '{$pathString}%' AND limit_identifier='Subtree'");
     // Clean up subtree limitations related to this object
     $limitationsToFix = eZPolicyLimitation::findByType('SubTree', $node->attribute('path_string'), true, true);
     foreach ($limitationsToFix as $limitation) {
         $values = $limitation->attribute('values');
         $valueCount = count($values);
         if ($valueCount > 0) {
             foreach ($values as $value) {
                 if (strpos($value->attribute('value'), $node->attribute('path_string')) === 0) {
                     $value->remove();
                     $valueCount--;
                 }
             }
         }
         if ($valueCount == 0) {
             $policy = eZPolicy::fetch($limitation->attribute('policy_id'));
             if (is_object($policy)) {
                 $policy->removeThis();
             }
         }
     }
     $limitationsToFixNode = eZPolicyLimitation::findByType('Node', $node->attribute('node_id'));
     foreach ($limitationsToFixNode as $limitation) {
         $values = $limitation->attribute('values');
         $valueCount = count($values);
         if ($valueCount > 0) {
             foreach ($values as $value) {
                 if ($value->attribute('value') == $node->attribute('node_id')) {
                     $value->remove();
                     $valueCount--;
                 }
             }
         }
         if ($valueCount == 0) {
             $policy = eZPolicy::fetch($limitation->attribute('policy_id'));
             if (is_object($policy)) {
                 $policy->removeThis();
             }
         }
     }
     eZRole::expireCache();
     $db->commit();
 }
开发者ID:,项目名称:,代码行数:50,代码来源:


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