本文整理汇总了PHP中eZContentCacheManager::clearContentCache方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentCacheManager::clearContentCache方法的具体用法?PHP eZContentCacheManager::clearContentCache怎么用?PHP eZContentCacheManager::clearContentCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentCacheManager
的用法示例。
在下文中一共展示了eZContentCacheManager::clearContentCache方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feZMetaData_ContentActionHandler
function feZMetaData_ContentActionHandler( &$module, &$http, &$objectID )
{
// Action when user clicks on the Add Button
if( $http->hasPostVariable( 'AddMetaDataButton' ) )
{
$link = 'fezmetadata/edit/0/(contentObjectID)/'.$objectID;
$link .= '/(metaDataName)/'.$_POST['metaDataName'];
$link .= '/(language)/'.$_POST['language'];
eZURI::transformURI( $link );
$http->redirect( $link );
}
// Action when user clicks on the Remove Button
if( $http->hasPostVariable( 'RemoveMetaDataButton' ) and $http->hasPostVariable( 'MetaDataIDSelection' ) )
{
$metaDataSelection = $http->postVariable( 'MetaDataIDSelection' );
foreach( $metaDataSelection as $metaData )
{
$metaDataObject = feZMetaData::fetch( $metaData );
$metaDataObject->remove();
}
eZContentCacheManager::clearContentCache( $objectID );
$ContentObject = eZContentObject::fetch( $objectID );
$ContentNodeID = $ContentObject->mainNodeID();
return $module->redirect( 'content', 'view', array( 'full', $ContentNodeID ) );
}
}
示例2: updatePriority
/**
* Updating priority sorting for given node
*
* @param mixed $args
* @return array
*/
public static function updatePriority( $args )
{
$http = eZHTTPTool::instance();
if ( !$http->hasPostVariable('ContentNodeID')
|| !$http->hasPostVariable('PriorityID')
|| !$http->hasPostVariable('Priority') )
{
return array();
}
$contentNodeID = $http->postVariable('ContentNodeID');
$priorityArray = $http->postVariable('Priority');
$priorityIDArray = $http->postVariable('PriorityID');
$contentNode = eZContentObjectTreeNode::fetch( $contentNodeID );
if ( !$contentNode->attribute( 'can_edit' ) )
{
eZDebug::writeError( 'Current user can not update the priorities because he has no permissions to edit the node' );
return array();
}
if ( eZOperationHandler::operationIsAvailable( 'content_updatepriority' ) )
{
$operationResult = eZOperationHandler::execute( 'content', 'updatepriority',
array( 'node_id' => $contentNodeID,
'priority' => $priorityArray,
'priority_id' => $priorityIDArray ), null, true );
}
else
{
eZContentOperationCollection::updatePriority( $contentNodeID, $priorityArray, $priorityIDArray );
}
if ( $http->hasPostVariable( 'ContentObjectID' ) )
{
$objectID = $http->postVariable( 'ContentObjectID' );
eZContentCacheManager::clearContentCache( $objectID );
}
}
示例3: execute
/**
* @param eZWorkflowProcess $process
* @param eZWorkflowEvent $event
* @return int
*/
function execute( $process, $event )
{
// Get some information about the object being passed
$parameters = $process->attribute( 'parameter_list' );
$object = eZContentObject::fetch( $parameters['object_id'] );
if($object->ClassIdentifier != 'article')
return self::STATUS_ACCEPTED;
/* @type $dataMap eZContentObjectAttribute[] */
$dataMap = $object->dataMap();
if(isset($dataMap['source']))
{
$sourceString = MMNewsSource::getSourceString($object);
if($sourceString)
{
$dataMap['source']->setAttribute('data_text', $sourceString);
$dataMap['source']->store();
}
eZContentCacheManager::clearContentCache($object->attribute('id'));
}
return self::STATUS_ACCEPTED;
}
示例4: changeSortOrder
/**
* Changes the sort order for a node
*
* @param int $nodeID
* @param string $sortingField
* @param bool $sortingOrder
*
* @return array An array with operation status, always true
*/
public static function changeSortOrder($nodeID, $sortingField, $sortingOrder = false)
{
$curNode = eZContentObjectTreeNode::fetch($nodeID);
if (is_object($curNode)) {
$db = eZDB::instance();
$db->begin();
$curNode->setAttribute('sort_field', $sortingField);
$curNode->setAttribute('sort_order', $sortingOrder);
$curNode->store();
$db->commit();
$object = $curNode->object();
eZContentCacheManager::clearContentCache($object->attribute('id'));
}
return array('status' => true);
}
示例5: array
if (!$contentNode->attribute('can_edit')) {
eZDebug::writeError('Current user can not update the priorities because he has no permissions to edit the node');
$module->redirectTo($module->functionURI('view') . '/' . $viewMode . '/' . $contentNodeID . '/');
return;
}
$priorityArray = $http->postVariable('Priority');
$priorityIDArray = $http->postVariable('PriorityID');
if (eZOperationHandler::operationIsAvailable('content_updatepriority')) {
$operationResult = eZOperationHandler::execute('content', 'updatepriority', array('node_id' => $contentNodeID, 'priority' => $priorityArray, 'priority_id' => $priorityIDArray), null, true);
} else {
eZContentOperationCollection::updatePriority($contentNodeID, $priorityArray, $priorityIDArray);
}
}
if ($http->hasPostVariable('ContentObjectID')) {
$objectID = $http->postVariable('ContentObjectID');
eZContentCacheManager::clearContentCache($objectID);
}
if ($http->hasPostVariable('RedirectURIAfterPriority')) {
return $module->redirectTo($http->postVariable('RedirectURIAfterPriority'));
}
$module->redirectTo($module->functionURI('view') . '/' . $viewMode . '/' . $contentNodeID . '/');
return;
} else {
if ($http->hasPostVariable("ActionAddToBookmarks")) {
$user = eZUser::currentUser();
$nodeID = false;
if ($http->hasPostVariable('ContentNodeID')) {
$nodeID = $http->postVariable('ContentNodeID');
$node = eZContentObjectTreeNode::fetch($nodeID);
$bookmark = eZContentBrowseBookmark::createNew($user->id(), $nodeID, $node->attribute('name'));
}
示例6: forceSiteColor
/**
* Forza l'impostazione del colore di base di un site
*
* Ritorna true se il colore è stato modificato
*
* @param int $currentColor
* @return boolean
*/
public static function forceSiteColor($currentColor)
{
//
// lettura variabili per individuare file scss
$designINIinstance = eZINI::instance('design.ini', 'settings', null, FALSE);
$_stylesheetBaseFile = $designINIinstance->variable('StylesheetSettings', 'StylesheetBaseFile');
$_stylesheetDestFile = $designINIinstance->variable('StylesheetSettings', 'StylesheetDestinationFile');
$_stylesheetCluster = $designINIinstance->variable('StylesheetSettings', 'StylesheetCluster');
// Cicla sui file di origine
for ($i = 0; $i < count($_stylesheetBaseFile); $i++) {
foreach ($_stylesheetCluster as $itemCluster) {
// File da sostituire.
$curFile = $itemCluster . $_stylesheetBaseFile[$i];
$curDestinationFile = $itemCluster . $_stylesheetDestFile[$i];
//print_r('File :<br><b>');
//print_r($curFile);
//print_r('<br>in:<br><b>');
//print_r($curDestinationFile);
//die();
// recupera i valori del eZPersistentObject sinet_site_colors
$colorList = Sinetsitecolors_PstObject::fetchHandlerList();
$fh = fopen($curFile, 'r');
$newRow = '';
// Legge ogni singola riga del file origine
$arrayOriginalColor = explode("-", $currentColor);
while (!feof($fh)) {
$tmpRow = fgets($fh);
$indiceColore = 0;
foreach ($colorList as $objColor) {
// per ogni riga del pesisten object sostituisce il name_tag con il colore letto
$curname_tag = $objColor['name_tag'];
if (count($arrayOriginalColor) > $indiceColore) {
$tmpRow = PatBaseColorFunctions::replaceCssInLine($tmpRow, $arrayOriginalColor[$indiceColore], $curname_tag);
}
$indiceColore++;
}
$newRow .= $tmpRow;
}
// set del colore nel persistent object
$indiceColore = 0;
foreach ($colorList as $objColor) {
$curname_tag = $objColor['name_tag'];
$curId = $objColor['id'];
if (count($arrayOriginalColor) > $indiceColore) {
$simpleObj = Sinetsitecolors_PstObject::fetchById($curId);
$simpleObj->setAttribute('color', $arrayOriginalColor[$indiceColore]);
$simpleObj->store();
}
$indiceColore++;
}
// Scrive il file di destinazione
$fw = fopen($curDestinationFile, 'w');
if (!$fw) {
echo '</b><font color=red>Errore Open W</font></pre>';
} else {
$bytes = fwrite($fw, $newRow);
fclose($fw);
}
fclose($fh);
// echo('</b><font color=red>OK</font></pre>');
}
}
// Prova la pulizia della cache dei template
eZContentCacheManager::clearAllContentCache();
eZContentCacheManager::clearContentCache(2);
//die();
return true;
}
示例7: update
//.........这里部分代码省略.........
// Move objects waiting in queue to the "valid ones"
foreach ($movingFromQueue as $itemToMove) {
$objectID = $itemToMove['object_id'];
$db->query("UPDATE ezm_pool\n SET ts_visible={$time}, priority={$priority}\n WHERE block_id='{$blockID}'\n AND object_id={$objectID}");
$priority++;
}
$countValid += count($movingFromQueue);
// Compare this number to the given and archive the oldest (order by ts_visible)
$numberOfValidItems = $ini->variable($block['block_type'], 'NumberOfValidItems');
if (!$numberOfValidItems) {
$numberOfValidItems = 20;
eZDebug::writeWarning('Number of valid items for ' . $block['block_type'] . ' is not set; using the default value (' . $numberOfValidItems . ')', __METHOD__);
}
$countToRemove = $countValid - $numberOfValidItems;
if ($countToRemove > 0) {
$overflowID = $block['overflow_id'];
$items = $db->arrayQuery("SELECT node_id, object_id, rotation_until\n FROM ezm_pool\n WHERE block_id='{$blockID}'\n AND ts_visible>0\n AND ts_hidden=0\n ORDER BY priority ASC", array('limit' => $countToRemove));
if ($items) {
$itemArray = array();
$priority = 0;
foreach ($items as $item) {
$objectID = $item['object_id'];
if ($block['rotation_type'] != self::ROTATION_NONE && ($item['rotation_until'] > $time || $item['rotation_until'] == 0)) {
if ($block['rotation_type'] == self::ROTATION_SIMPLE) {
// Simple rotation
$newPublicationTS = -$time;
$priority++;
} else {
// Random rotation/Shuffle
$newPublicationTS = 0;
$priority = mt_rand();
}
// Move item back to queue
$db->query("UPDATE ezm_pool\n SET ts_visible=0,\n ts_publication=-{$time},\n priority={$priority}\n WHERE block_id='{$blockID}'\n AND object_id={$objectID}");
} else {
$itemArray[] = $objectID;
}
}
if ($itemArray) {
if ($overflowID) {
// Put $itemArray items into pool of different block
$priority = 0;
foreach ($items as $item) {
$itemObjectID = $item['object_id'];
$itemNodeID = $item['node_id'];
// Check if the object_id is not already in the new block
$duplicityCheck = $db->arrayQuery("SELECT object_id\n FROM ezm_pool\n WHERE block_id='{$overflowID}'\n AND object_id={$itemObjectID}", array('limit' => 1));
if ($duplicityCheck) {
eZDebug::writeNotice("Object {$itemObjectID} is already available in the block {$overflowID}.", __METHOD__);
} else {
$db->query("INSERT INTO ezm_pool(block_id,object_id,node_id,ts_publication,priority)\n VALUES ('{$overflowID}',{$itemObjectID},{$itemNodeID},{$time},{$priority})");
$priority++;
}
}
$db->query("UPDATE ezm_pool\n SET ts_hidden={$time},\n moved_to='{$overflowID}',\n priority=0\n WHERE block_id='{$blockID}'\n AND " . $db->generateSQLINStatement($itemArray, 'object_id'));
} else {
$db->query("UPDATE ezm_pool\n SET ts_hidden={$time},\n priority=0\n WHERE block_id='{$blockID}'\n AND " . $db->generateSQLINStatement($itemArray, 'object_id'));
}
}
}
}
// Cleanup in archived items
$countArchived = $db->arrayQuery("SELECT count(*) AS count\n FROM ezm_pool\n WHERE block_id='{$blockID}'\n AND ts_hidden>0");
$countArchived = $countArchived[0]['count'];
// Compare this number to the given and remove the oldest ones
$numberOfArchivedItems = $ini->variable($block['block_type'], 'NumberOfArchivedItems');
if ($numberOfArchivedItems < 0) {
$numberOfArchivedItems = 50;
eZDebug::writeWarning('Number of archived items for ' . $block['block_type'] . ' is not set; using the default value (' . $numberOfArchivedItems . ')', __METHOD__);
}
$countToRemove = $countArchived - $numberOfArchivedItems;
if ($countToRemove > 0) {
$items = $db->arrayQuery("SELECT object_id\n FROM ezm_pool\n WHERE block_id='{$blockID}'\n AND ts_hidden>0\n ORDER BY ts_hidden ASC", array('limit' => $countToRemove));
if ($items) {
$itemArray = array();
foreach ($items as $item) {
$itemArray[] = $item['object_id'];
}
$db->query("DELETE FROM ezm_pool\n WHERE block_id='{$blockID}'\n AND " . $db->generateSQLINStatement($itemArray, 'object_id'));
}
}
}
// If the block changed, we need to update whole node
if ($blockChanged) {
$nodeChanged = true;
}
$db->commit();
}
if ($nodeChanged) {
$contentObject = eZContentObject::fetchByNodeID($nodeID);
if ($contentObject) {
eZContentCacheManager::clearContentCache($contentObject->attribute('id'));
}
}
}
// log the previously logged in user if it was changed to anonymous earlier
if (isset($loggedInUser)) {
eZUser::setCurrentlyLoggedInUser($loggedInUser, $loggedInUser->attribute('contentobject_id'));
}
}
示例8: array
$cli->output("Clearing cache for subtree {$nodeName} ({$nodeSubtree})");
$objectID = $node->attribute('contentobject_id');
$offset = 0;
$params = array('AsObject' => false, 'Depth' => false, 'Limitation' => array());
// Empty array means no permission checking
$subtreeCount = $node->subTreeCount($params);
$script->resetIteration($subtreeCount / $limit);
while ($offset < $subtreeCount) {
$params['Offset'] = $offset;
$params['Limit'] = $limit;
$subtree = $node->subTree($params);
$offset += count($subtree);
if (count($subtree) == 0) {
break;
}
$objectIDList = array();
foreach ($subtree as $subtreeNode) {
$objectIDList[] = $subtreeNode['contentobject_id'];
}
$objectIDList = array_unique($objectIDList);
unset($subtree);
$script->iterate($cli, eZContentCacheManager::clearContentCache($objectIDList), "Cleared view cache for object(s): " . implode(", ", $objectIDList));
eZContentObject::clearCache();
// Clear all object memory cache to free memory
}
}
$script->shutdown(0);
}
}
$cli->output("You will need to specify what to clear, either with --clear-node or --clear-subtree");
$script->shutdown(1);
示例9: updatePriority
/**
* Updating priority sorting for given node
*
* @since 1.2
* @param mixed $args
* @return array
*/
public static function updatePriority($args)
{
$http = eZHTTPTool::instance();
if (!$http->hasPostVariable('ContentNodeID') || !$http->hasPostVariable('PriorityID') || !$http->hasPostVariable('Priority')) {
return array();
}
$contentNodeID = $http->postVariable('ContentNodeID');
$priorityArray = $http->postVariable('Priority');
$priorityIDArray = $http->postVariable('PriorityID');
$contentNode = eZContentObjectTreeNode::fetch($contentNodeID);
if (!$contentNode instanceof eZContentObjectTreeNode) {
throw new InvalidArgumentException("Argument ContentNodeID: '{$contentNodeID}' does not exist");
} else {
if (!$contentNode->canEdit()) {
throw new InvalidArgumentException("Argument ContentNodeIDs: '{$contentNodeID}' is not available");
}
}
if (eZOperationHandler::operationIsAvailable('content_updatepriority')) {
$operationResult = eZOperationHandler::execute('content', 'updatepriority', array('node_id' => $contentNodeID, 'priority' => $priorityArray, 'priority_id' => $priorityIDArray), null, true);
} else {
eZContentOperationCollection::updatePriority($contentNodeID, $priorityArray, $priorityIDArray);
}
if ($http->hasPostVariable('ContentObjectID')) {
$objectID = $http->postVariable('ContentObjectID');
eZContentCacheManager::clearContentCache($objectID);
}
}
示例10: execute
function execute($process, $event)
{
// Get some information about the object being passed
$parameters = $process->attribute('parameter_list');
$object = eZContentObject::fetch($parameters['object_id']);
// Because this is also run by the cronjob, check to make sure the object hasn't been deleted
if (!$object) {
eZDebugSetting::writeError('workflow-hideuntildate', 'The object with ID ' . $parameters['object_id'] . ' does not exist.', 'eZApproveType::execute() object is unavailable');
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
// if the current version of an object is not the version the workflow pertains to, cancel the workflow
$currentVersion = $object->attribute('current_version');
$version = $parameters['version'];
if ($currentVersion != $version) {
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
// Get the data map for this object
$objectAttributes = $object->attribute('data_map');
// Get the user configuration with class and attribute mapping and the boolean modify publish date setting
$workflowSettings = $this->getWorkflowSettings($event);
foreach ($objectAttributes as $objectAttribute) {
if (in_array($objectAttribute->attribute('contentclassattribute_id'), $workflowSettings['classattribute_map'])) {
// Make sure this is of a date or datetime attribute
if (in_array($objectAttribute->attribute('data_type_string'), array('ezdate', 'ezdatetime'))) {
// If the publish date is in the future, hide the node
if (time() < $objectAttribute->toString()) {
// Set a time for when this workflow should be tested again via the cronjob
// Store a description to be displayed in the Setup > Workflow processes list
// This must also be accompanied by overriding the workflow/processlist.tpl template
$parameters = array_merge($parameters, array('event_description' => 'Publishing of object delayed until ' . $objectAttribute->attribute('content')->toString(true)));
$process->setParameters($parameters);
$process->store();
// Hide the object's nodes
$nodes = $object->attribute('assigned_nodes');
foreach ($nodes as $node) {
if (!$node->attribute('is_hidden')) {
eZContentObjectTreeNode::hideSubTree($node);
}
}
return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
} elseif ($objectAttribute->hasContent()) {
if ($workflowSettings['modify_publish_date']) {
$object->setAttribute('published', $objectAttribute->toString());
$object->store();
}
$nodes = $object->attribute('assigned_nodes');
foreach ($nodes as $node) {
eZContentObjectTreeNode::unhideSubTree($node);
eZContentCacheManager::clearContentCache($parameters['object_id']);
eZContentCacheManager::clearObjectViewCache($parameters['object_id']);
}
return eZWorkflowType::STATUS_ACCEPTED;
}
} else {
// Attribute that matched was not a valid date or datetime attribute, so ignore
return eZWorkflowType::STATUS_ACCEPTED;
}
}
}
// No attributes matched the workflow configured by the user
return eZWorkflowType::STATUS_ACCEPTED;
}
示例11: foreach
$remoteIDNodeList = $http->postVariable($inputNodeListName);
foreach ($object->attribute('assigned_nodes') as $node_item) {
$node_item_id = $node_item->attribute('node_id');
if (isset($remoteIDNodeList[$node_item_id]) && jcRemoteID::isValidNodeRemoteID($remoteIDNodeList[$node_item_id], $node_item_id, $errors)) {
$node_item->setAttribute('remote_id', $remoteIDNodeList[$node_item_id]);
$node_item->store();
if ($node_item_id == $NodeID) {
//update $node for template if errors
$node = $node_item;
}
}
}
}
// If ok -> send data
if (empty($errors)) {
//Clear cache of this object
eZContentCacheManager::clearContentCache($object->attribute('id'));
//Redirect to node
$Module->redirectTo('content/view/full/' . $NodeID);
return;
}
$tpl->setVariable('errors', $errors);
$tpl->setVariable('new_object_remote_id', $http->postVariable($inputObjectName));
$tpl->setVariable('new_node_remote_id_list', $remoteIDNodeList);
}
} else {
//Wrong parameters
}
$tpl->setVariable('node', $node);
$tpl->setVariable('error_list', $errors);
$Result['content'] = $tpl->fetch('design:remoteid/update.tpl');
示例12: updateEzContentObject
/**
*
* Modifie les données (dataMap) de la version courante d'un objet eZ
* Cette méthode délègue chaque phase de la création aux API bas niveau d'eZ.
* (NB : cette méthode modifie la version courante. Elle ne crée pas de nouvelle version !)
*
* @todo : Gérer les exceptions
*
* @param $contentObject : l'objet eZ.
* @param $attributes : un tableau associatif des attributs à initialiser \
* (clé : attribute_id ; valeur : chaine de caractères utilisé comme paramètre de la méthode 'eZDataType::fromString()')
* @param: $clearcontentcache : true => vider le cache lié à l'objjet - false : ne rien faire (défaut : true)
* @param: $languageCode : le code de la version linguistique à modifier (ex: fre-FR). Si false, la langue par défaut de l'objet est modifiée.
*
* @return void
*
*/
public static function updateEzContentObject( &$contentObject, $attributes, $clearcontentcache=true, $languageCode = false )
{
// Récupération de la version courante :
$version = $contentObject->createNewVersion( false, true, $languageCode );
$version->setAttribute( 'modified', time() );
$version->store();
$dataMap = $version->dataMap();
self::setDataMapInfos( $dataMap, $attributes );
// Publication de l'objet :
eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObject->attribute('id'),
'version' => $version->attribute('version') ) );
// Vidage du cache associé à l'objet :
if ( $clearcontentcache )
{
eZContentCacheManager::clearContentCache($contentObject->ID);
}
$contentObject = eZContentObject::fetch( $contentObject->ID );
}