本文整理汇总了PHP中eZContentCacheManager::clearAllContentCache方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentCacheManager::clearAllContentCache方法的具体用法?PHP eZContentCacheManager::clearAllContentCache怎么用?PHP eZContentCacheManager::clearAllContentCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentCacheManager
的用法示例。
在下文中一共展示了eZContentCacheManager::clearAllContentCache方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
$db->commit();
// because we changed users, we have to remove content cache
eZContentCacheManager::clearAllContentCache();
}
if ($http->hasPostVariable("RemoveCustomerButton")) {
if ($http->hasPostVariable("CustomerIDArray")) {
$customerIDArray = $http->postVariable("CustomerIDArray");
$db = eZDB::instance();
$db->begin();
foreach ($customerIDArray as $customerID) {
eZUserDiscountRule::removeUser($customerID);
}
$db->commit();
}
eZContentCacheManager::clearAllContentCache();
}
$membershipList = eZUserDiscountRule::fetchByRuleID($discountGroupID);
$customers = array();
foreach ($membershipList as $membership) {
$customers[] = eZContentObject::fetch($membership->attribute('contentobject_id'));
}
$ruleList = eZDiscountSubRule::fetchByRuleID($discountGroupID);
$ruleArray = array();
foreach ($ruleList as $rule) {
$name = $rule->attribute('name');
$percent = $rule->attribute('discount_percent');
$limitation = $rule->attribute('limitation');
$discountRuleID = $rule->attribute('id');
if ($limitation != '*') {
$ruleValues = eZDiscountSubRuleValue::fetchBySubRuleID($discountRuleID);
示例2: storeVersioned
/**
* Stores the current class as a modified version, updates the contentobject_name
* attribute and recreates the class group entries.
*
* @note It will remove classes in the previous and specified version before storing.
*
* @param array $attributes array of attributes
* @param int $version version status
* @since Version 4.3
*/
public function storeVersioned($attributes, $version)
{
$previousVersion = $this->attribute('version');
$db = eZDB::instance();
$db->begin();
// Before removing anything from the attributes, load attribute information
// which might otherwise not accessible when recreating them below.
// See issue #18164
foreach ($attributes as $attribute) {
$attribute->content();
}
$this->removeAttributes(false, $version);
$this->removeAttributes(false, $previousVersion);
$this->remove(false);
$this->setVersion($version, $attributes);
$this->setAttribute("modifier_id", eZUser::currentUser()->attribute("contentobject_id"));
$this->setAttribute("modified", time());
$this->adjustAttributePlacements($attributes);
foreach ($attributes as $attribute) {
$attribute->storeVersioned($version);
}
// Set contentobject_name to something sensible if it is missing
if (count($attributes) > 0 && trim($this->attribute('contentobject_name')) == '') {
$this->setAttribute('contentobject_name', '<' . $attributes[0]->attribute('identifier') . '>');
}
// Recreate class member entries
eZContentClassClassGroup::removeClassMembers($this->ID, $version);
foreach (eZContentClassClassGroup::fetchGroupList($this->ID, $previousVersion) as $classgroup) {
$classgroup->setAttribute('contentclass_version', $version);
$classgroup->store();
}
eZContentClassClassGroup::removeClassMembers($this->ID, $previousVersion);
eZExpiryHandler::registerShutdownFunction();
$handler = eZExpiryHandler::instance();
$time = time();
$handler->setTimestamp('user-class-cache', $time);
$handler->setTimestamp('class-identifier-cache', $time);
$handler->setTimestamp('sort-key-cache', $time);
$handler->store();
eZContentCacheManager::clearAllContentCache();
$this->setAttribute('serialized_name_list', $this->NameList->serializeNames());
$this->setAttribute('serialized_description_list', $this->DescriptionList->serializeNames());
eZPersistentObject::store();
$this->NameList->store($this);
$db->commit();
}
示例3: removeRelatedCache
function removeRelatedCache($siteAccess)
{
// Delete compiled template
$ini = eZINI::instance();
$iniPath = eZSiteAccess::findPathToSiteAccess($siteAccess);
$siteINI = eZINI::instance('site.ini.append', $iniPath);
if ($siteINI->hasVariable('FileSettings', 'CacheDir')) {
$cacheDir = $siteINI->variable('FileSettings', 'CacheDir');
if ($cacheDir[0] == "/") {
$cacheDir = eZDir::path(array($cacheDir));
} else {
if ($siteINI->hasVariable('FileSettings', 'VarDir')) {
$varDir = $siteINI->variable('FileSettings', 'VarDir');
$cacheDir = eZDir::path(array($varDir, $cacheDir));
}
}
} else {
if ($siteINI->hasVariable('FileSettings', 'VarDir')) {
$varDir = $siteINI->variable('FileSettings', 'VarDir');
$cacheDir = $ini->variable('FileSettings', 'CacheDir');
$cacheDir = eZDir::path(array($varDir, $cacheDir));
} else {
$cacheDir = eZSys::cacheDirectory();
}
}
$compiledTemplateDir = $cacheDir . "/template/compiled";
eZDir::unlinkWildcard($compiledTemplateDir . "/", "*pagelayout*.*");
eZCache::clearByTag('template-block');
// Expire content view cache
eZContentCacheManager::clearAllContentCache();
}
示例4: removeThis
/**
* Removes the language if there is no object having translation in it.
*
* \return True if the language was removed from the site, false otherwise.
*/
function removeThis()
{
if ($this->objectCount() > 0 or $this->classCount() > 0) {
return false;
}
$this->remove();
eZContentCacheManager::clearAllContentCache();
eZContentLanguage::fetchList(true);
return true;
}
示例5: 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;
}
示例6: 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.
// If child count exceeds threshold, do nothing here, and instead clear all view cache at the end.
$childCountInThresholdRange = eZContentCache::inCleanupThresholdRange($node->childrenCount(false));
if ($childCountInThresholdRange) {
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 specifying we are doing a move operation
$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, true);
}
$result = true;
} else {
eZDebug::writeError("Node {$nodeID} was moved to {$newParentNodeID} but fetching the new node failed");
}
$db->commit();
// clear cache for new placement.
// If child count exceeds threshold, clear all view cache instead.
if ($childCountInThresholdRange) {
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
} else {
eZContentCacheManager::clearAllContentCache();
}
return $result;
}
示例7: execute
//.........这里部分代码省略.........
}
foreach ($classAttributeList as $classAttributeNode) {
$attributeDatatype = $classAttributeNode->getAttribute('datatype');
$attributeIsRequired = strtolower($classAttributeNode->getAttribute('required')) == 'true';
$attributeIsSearchable = strtolower($classAttributeNode->getAttribute('searchable')) == 'true';
$attributeIsInformationCollector = strtolower($classAttributeNode->getAttribute('informationCollector')) == 'true';
$attributeIsTranslatable = strtolower($classAttributeNode->getAttribute('translatable')) == 'false' ? 0 : 1;
$attributeIdentifier = $classAttributeNode->getAttribute('identifier');
$attributePlacement = $classAttributeNode->getAttribute('placement');
$attributeNameListObject = $classAttributeNode->getElementsByTagName('Names')->item(0);
if ($attributeNameListObject->hasAttributes()) {
if ($attributeNameListObject->hasAttributes()) {
$attributes = $attributeNameListObject->attributes;
if (!is_null($attributes)) {
$attributeNameList = array();
foreach ($attributes as $index => $attr) {
$attributeNameList[$attr->name] = $attr->value;
}
}
}
}
$classAttributeNameList = new eZContentClassNameList(serialize($attributeNameList));
$classAttributeNameList->validate();
$attributeDatatypeParameterNode = $classAttributeNode->getElementsByTagName('DatatypeParameters')->item(0);
$classAttribute = $class->fetchAttributeByIdentifier($attributeIdentifier);
$params = array();
$params['identifier'] = $attributeIdentifier;
$params['name_list'] = $classAttributeNameList;
$params['data_type_string'] = $attributeDatatype;
$params['default_value'] = '';
$params['can_translate'] = $attributeIsTranslatable;
$params['is_required'] = $attributeIsRequired;
$params['is_searchable'] = $attributeIsSearchable;
$params['content'] = '';
$params['placement'] = $attributePlacement;
$params['is_information_collector'] = $attributeIsInformationCollector;
$params['datatype-parameter'] = $this->parseAndReplaceNodeStringReferences($attributeDatatypeParameterNode);
$params['attribute-node'] = $classAttributeNode;
if (!array_key_exists($attributeIdentifier, $classDataMap)) {
$this->writeMessage("\t\tClass '{$classIdentifier}' will get new Attribute '{$attributeIdentifier}'.", 'notice');
$updateAttributeList[] = $this->addClassAttribute($class, $params);
} else {
$this->writeMessage("\t\tClass '{$classIdentifier}' will get updated Attribute '{$attributeIdentifier}'.", 'notice');
$this->updateClassAttribute($class, $params);
}
}
if ($this->adjustAttributesPlacement) {
//once every attribute has been processed, we may reset placement
$this->writeMessage("\t\tAdjusting attributes placement.", 'notice');
$this->adjustClassAttributesPlacement($class);
}
if (count($updateAttributeList)) {
$this->writeMessage("\t\tUpdating content object attributes.", 'notice');
$classID = $class->attribute('id');
// update object attributes
$objects = eZContentObject::fetchSameClassList($classID, false);
foreach ($objects as $objectID) {
$object = eZContentObject::fetch($objectID['id']);
if ($object) {
$contentobjectID = $object->attribute('id');
$objectVersions = $object->versions();
foreach ($objectVersions as $objectVersion) {
$translations = $objectVersion->translations(false);
$version = $objectVersion->attribute('version');
foreach ($translations as $translation) {
foreach ($updateAttributeList as $classAttributeID) {
$objectAttribute = eZContentObjectAttribute::create($classAttributeID, $contentobjectID, $version);
$objectAttribute->setAttribute('language_code', $translation);
$objectAttribute->initialize();
$objectAttribute->store();
$objectAttribute->postInitialize();
}
}
}
}
unset($object);
}
}
if ($classNameList) {
$classNameList->store($class);
}
// add class to a class group
$classGroupsList = $classGroupsNode->getElementsByTagName('Group');
foreach ($classGroupsList as $classGroupNode) {
$classGroupName = $classGroupNode->getAttribute('name');
$classGroup = eZContentClassGroup::fetchByName($classGroupName);
if (!$classGroup) {
$classGroup = eZContentClassGroup::create();
$classGroup->setAttribute('name', $classGroupName);
$classGroup->store();
}
$classGroup->appendClass($class);
}
if ($referenceID) {
$refArray[$referenceID] = $class->attribute('id');
}
}
$this->addReference($refArray);
eZContentCacheManager::clearAllContentCache();
}
示例8: removeThis
/**
* Removes the language if there is no object having translation in it.
*
* \return True if the language was removed from the site, false otherwise.
*/
function removeThis()
{
if ( ($this->objectCount() > 0) or ($this->classCount() > 0) )
{
return false;
}
eZPersistentObject::remove();
eZContentCacheManager::clearAllContentCache();
eZContentLanguage::fetchList( true );
return true;
}