本文整理汇总了PHP中eZContentCacheManager::clearContentCacheIfNeeded方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentCacheManager::clearContentCacheIfNeeded方法的具体用法?PHP eZContentCacheManager::clearContentCacheIfNeeded怎么用?PHP eZContentCacheManager::clearContentCacheIfNeeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentCacheManager
的用法示例。
在下文中一共展示了eZContentCacheManager::clearContentCacheIfNeeded方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
static function remove($objectID, $removeSubtrees = true)
{
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
$object = eZContentObject::fetch($objectID);
if (!is_object($object)) {
return false;
}
// TODO: Is content cache cleared for all objects in subtree ??
if ($removeSubtrees) {
$assignedNodes = $object->attribute('assigned_nodes');
if (count($assignedNodes) == 0) {
$object->purge();
eZContentObject::expireAllViewCache();
return true;
}
$assignedNodeIDArray = array();
foreach ($assignedNodes as $node) {
$assignedNodeIDArray[] = $node->attribute('node_id');
}
eZContentObjectTreeNode::removeSubtrees($assignedNodeIDArray, false);
} else {
$object->purge();
}
return true;
}
示例2: sectionEditActionCheck
function sectionEditActionCheck($module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
{
if (!$module->isCurrentAction('SectionEdit')) {
return;
}
$http = eZHTTPTool::instance();
if (!$http->hasPostVariable('SelectedSectionId')) {
return;
}
$selectedSection = eZSection::fetch((int) $http->postVariable('SelectedSectionId'));
if (!$selectedSection instanceof eZSection) {
return;
}
$selectedSection->applyTo($object);
eZContentCacheManager::clearContentCacheIfNeeded($object->attribute('id'));
$module->redirectToView('edit', array($object->attribute('id'), $editVersion, $editLanguage, $fromLanguage));
}
示例3: clearSubtreeCache
private function clearSubtreeCache($nodeId)
{
$node = eZContentObjectTreeNode::fetch($nodeId);
$limit = 50;
$offset = 0;
$params = array('AsObject' => false, 'Depth' => false, 'Limitation' => array());
// Empty array means no permission checking
$subtreeCount = $node->subTreeCount($params);
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);
foreach ($objectIDList as $objectID) {
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
}
}
}
示例4: setFailedLoginAttempts
static function setFailedLoginAttempts($userID, $value = false, $setByForce = false)
{
$trustedUser = eZUser::isTrusted();
// If user is trusted we should stop processing
if ($trustedUser and !$setByForce) {
return true;
}
$maxNumberOfFailedLogin = eZUser::maxNumberOfFailedLogin();
if ($maxNumberOfFailedLogin == '0' and !$setByForce) {
return true;
}
$userID = (int) $userID;
$userObject = eZUser::fetch($userID);
if (!$userObject) {
return true;
}
$isEnabled = $userObject->isEnabled();
// If current user is disabled we should not continue
if (!$isEnabled and !$setByForce) {
return true;
}
$db = eZDB::instance();
$db->begin();
$userVisitArray = $db->arrayQuery("SELECT 1 FROM ezuservisit WHERE user_id={$userID}");
if (isset($userVisitArray[0])) {
if ($value === false) {
$failedLoginAttempts = $userObject->failedLoginAttempts();
$failedLoginAttempts += 1;
} else {
$failedLoginAttempts = (int) $value;
}
$db->query("UPDATE ezuservisit SET failed_login_attempts={$failedLoginAttempts} WHERE user_id={$userID}");
} else {
if ($value === false) {
$failedLoginAttempts = 1;
} else {
$failedLoginAttempts = (int) $value;
}
$db->query("INSERT INTO ezuservisit ( failed_login_attempts, user_id ) VALUES ( {$failedLoginAttempts}, {$userID} )");
}
$db->commit();
eZContentCacheManager::clearContentCacheIfNeeded($userID);
eZContentCacheManager::generateObjectViewCache($userID);
}
示例5: array
// Sort objectDepthList by depth to apply updatechildren in the right order
if (!array_multisort($objectDepthList[0], SORT_ASC, $objectDepthList[1], SORT_ASC)) {
eZDebug::writeError('Error in array_multisort', 'ezmbpaex_updatechildren.php');
} else {
// Generate array of paex objects to update
$paexObjectArray = array();
foreach ($objectDepthList[1] as $contentobjectId) {
if (isset($pendingList[$contentobjectId])) {
// Generate update children data for every pending object in pendingIDList
$paexObjectArray = $pendingList[$contentobjectId]->generateUpdateChildren($paexObjectArray);
} else {
eZDebug::writeError('Found contentobject_id [' . $contentobjectId . '] not present in the pendingIDList', 'ezmbpaex_updatechildren.php');
}
}
// Reset pending object updatechildren attribute in pendingIDList objects and add to the array of paex objects to update
foreach ($pendingList as $pendingObject) {
$pendingObject->setAttribute('updatechildren', 0);
$paexObjectArray[$pendingObject->attribute('contentobject_id')] = $pendingObject;
}
// Store updated paex objects in the DB
$db = eZDB::instance();
$db->begin();
foreach ($paexObjectArray as $paexObject) {
$paexObject->store();
eZContentCacheManager::clearContentCacheIfNeeded($paexObject->attribute('contentobject_id'));
}
$db->commit();
}
}
$cli->output("eZPaEx: Update children process end");
}
示例6: rate
/**
* Rate content object attribute id
*
* @param array $args ( 0 => contentobjectattribute_id, 1 => contentobject_version, 2 => rating )
* @return array
*/
public static function rate( $args )
{
$ret = array( 'id' => 0, 'rated' => false, 'already_rated' => false, 'stats' => false );
if ( !isset( $args[2] ) )
throw new LengthException( 'Rating expects 3 arguments: attr_id, version, rating' );
else if ( !is_numeric( $args[0] ) )
throw new InvalidArgumentException( 'Rating argument[0] attr_id must be a number' );
else if ( !is_numeric( $args[1] ) )
throw new InvalidArgumentException( 'Rating argument[1] version must be a number' );
else if ( !is_numeric( $args[2] ) )
throw new InvalidArgumentException( 'Rating argument[2] rating must be a number' );
else if ( $args[2] > 5 || $args[2] < 1 )
throw new UnexpectedValueException( 'Rating argument[2] rating must be between 1 and 5' );
$ret['id'] = (int) $args[0];
// Provide extra session protection on 4.1 (not possible on 4.0) by expecting user
// to have an existing session (new session = mostlikely a spammer / hacker trying to manipulate rating)
if (
eZSession::userHasSessionCookie() !== true
&& eZINI::instance()->variable( 'eZStarRating', 'AllowAnonymousRating' ) === 'disabled'
)
return $ret;
// Return if parameters are not valid attribute id + version numbers
$contentobjectAttribute = eZContentObjectAttribute::fetch( $ret['id'], $args[1] );
if ( !$contentobjectAttribute instanceof eZContentObjectAttribute )
return $ret;
// Return if attribute is not a rating attribute
if ( $contentobjectAttribute->attribute('data_type_string') !== ezsrRatingType::DATA_TYPE_STRING )
return $ret;
// Return if rating has been disabled on current attribute
if ( $contentobjectAttribute->attribute('data_int') )
return $ret;
// Return if user does not have access to object
$contentobject = $contentobjectAttribute->attribute('object');
if ( !$contentobject instanceof eZContentObject || !$contentobject->attribute('can_read') )
return $ret;
$rateDataObj = ezsrRatingDataObject::create( array( 'contentobject_id' => $contentobjectAttribute->attribute('contentobject_id'),
'contentobject_attribute_id' => $ret['id'],
'rating' => $args[2]
));
$proiorRating = $rateDataObj->userHasRated( true );
if ( $proiorRating === true )
{
$ret['already_rated'] = true;
}
else if ( $proiorRating instanceof ezsrRatingDataObject )
{
$rateDataObj = $proiorRating;
$rateDataObj->setAttribute( 'rating', $args[2] );
$ret['already_rated'] = true;
$proiorRating = false;// just to reuse code bellow
}
if ( !$proiorRating )
{
$rateDataObj->store();
$avgRateObj = $rateDataObj->getAverageRating();
$avgRateObj->updateFromRatingData();
$avgRateObj->store();
eZContentCacheManager::clearContentCacheIfNeeded( $rateDataObj->attribute('contentobject_id') );
$ret['rated'] = true;
$ret['stats'] = array(
'rating_count' => $avgRateObj->attribute('rating_count'),
'rating_average' => $avgRateObj->attribute('rating_average'),
'rounded_average' => $avgRateObj->attribute('rounded_average'),
);
}
return $ret;
}
示例7:
if ($existingNotification) {
$tpl->setVariable('success_message', ezpI18n::tr('ezcomments/comment/add', 'You have already subscribed to comment updates on this content.'));
} else {
$tpl->setVariable('success_message', ezpI18n::tr('ezcomments/comment/add', 'You will receive comment updates on the content.'));
}
} else {
$tpl->setVariable('success_message', ezpI18n::tr('ezcomments/comment/add', 'A confirmation email has been sent to your email address. You will receive comment updates after confirmation.'));
}
}
//remember cookies
$cookieManager = ezcomCookieManager::instance();
if ($http->postVariable('CommentRememberme', false) !== false || !$user->isAnonymous()) {
$cookieManager->storeCookie($comment);
} else {
$cookieManager->clearCookie();
}
eZContentCacheManager::clearContentCacheIfNeeded($contentObjectId);
if (!$changeNotification) {
$commentINI = eZINI::instance('ezcomments.ini');
if ($commentINI->variable('GlobalSettings', 'RedirectAfterCommenting') === 'true') {
$module->redirectTo($redirectURI);
}
} else {
$tpl->setVariable('redirect_uri', $redirectURI);
}
}
} else {
$tpl->setVariable('error_message', ezpI18n::tr('ezcomments/comment/add', 'You should not access this view directly.'));
}
$Result['content'] = $tpl->fetch('design:comment/add.tpl');
return $Result;
示例8: rate
/**
* Create a ezsrRatingDataObject and store it.
* Note: No access checks or input validation is done other then on rating
*
* @param int $contentobjectId
* @param int $contentobjectAttributeId
* @param int $rate (above 0 and bellow or equal 5)
* @param bool $onlyStoreIfUserNotAlreadyRated
* @return null|ezsrRatingDataObject
*/
static function rate($contentobjectId, $contentobjectAttributeId, $rate)
{
$rating = null;
if (is_numeric($contentobjectId) && is_numeric($contentobjectAttributeId) && is_numeric($rate) && $rate <= 5 && $rate > 0) {
$row = array('contentobject_attribute_id' => $contentobjectAttributeId, 'contentobject_id' => $contentobjectId, 'rating' => $rate);
$rating = self::create($row);
if (!$rating->userHasRated()) {
$rating->store();
$avgRating = $rating->getAverageRating();
$avgRating->updateFromRatingData();
$avgRating->store();
// clear the cache for all nodes associated with this object
eZContentCacheManager::clearContentCacheIfNeeded($contentobjectId, true, false);
}
}
return $rating;
}
示例9: clearObjectCache
private function clearObjectCache($objectId)
{
// todo: the first one is suspect:
//eZContentObject::clearCache( array( $objectId ) );
// ... so, todo: does this work any better?
eZContentCacheManager::clearContentCacheIfNeeded($objectId);
}
示例10: removeByAttribute
//.........这里部分代码省略.........
$contentObjectAttributeVersion = $contentObjectAttribute->attribute('version');
if ($contentObjectAttributeVersion === null) {
$files = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID, true);
$dirs = array();
$count = 0;
// Iterate over files
foreach ($files as $filepath) {
// Test $filepath from $files is in contains one of the $aliases items
if ($aliases != false && is_array($aliases)) {
foreach ($aliases as $alias) {
if (!stristr('_' . $alias, $filepath)) {
continue 1;
}
}
}
$file = eZClusterFileHandler::instance($filepath);
if ($file->exists()) {
$filePaths[] = $filepath;
if (!$executionOptions['dry']) {
$file->fileDelete($filepath);
$dirs[] = eZDir::dirpath($filepath);
}
$count++;
}
}
if (!$executionOptions['dry']) {
$dirs = array_unique($dirs);
foreach ($dirs as $dirpath) {
eZDir::cleanupEmptyDirectories($dirpath);
}
eZImageFile::removeForContentObjectAttribute($contentObjectAttributeID);
$message = "Removed datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation " . $filePaths[$messageCount] . "\n";
} else {
$message = "Dry run: Remove datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation " . $filePaths[$messageCount] . "\n";
}
while ($messageCount < $count) {
self::scriptIterate($message);
$messageCount++;
$result = true;
}
} else {
// We loop over each image alias, and look up the file in ezcontentobject_attribute
// Only images referenced by one version will be removed
foreach ($aliasList as $aliasName => $aliasListAliasItem) {
// Test $aliasListAliasItem from $aliasList is in $aliases array
if ($aliases != false && is_array($aliases) && !in_array($aliasListAliasItem['name'], $aliases)) {
continue;
}
if ($aliasListAliasItem['is_valid'] && $aliasListAliasItem['name'] != 'original') {
$filepath = $aliasListAliasItem['url'];
// Calculate appropriate message to Alert user with
if (!$executionOptions['dry']) {
// Remove the alias variation image file from the attribute dom tree
$doc = $imageHandler->ContentObjectAttributeData['DataTypeCustom']['dom_tree'];
foreach ($doc->getElementsByTagName('alias') as $aliasNode) {
if ($aliasListAliasItem['name'] == $aliasNode->getAttribute('name')) {
// Optional debug output
if ($executionOptions['troubleshoot']) {
self::displayMessage('Removing image alias image variation ' . "'" . $aliasNode->getAttribute('name') . "'" . ' from attribute dom document');
}
$aliasNode->parentNode->removeChild($aliasNode);
}
}
$imageHandler->ContentObjectAttributeData['DataTypeCustom']['dom_tree'] = $doc;
unset($imageHandler->ContentObjectAttributeData['DataTypeCustom']['alias_list']);
$imageHandler->storeDOMTree($doc, true, $contentObjectAttribute);
}
// Calculate appropriate message to Alert user with
if ($executionOptions['dry']) {
$message = "Dry run: Calculating removal of datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation file " . $filepath;
} else {
$message = "Removed standard datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation file " . $filepath;
}
if (!$executionOptions['dry']) {
$dirpath = $aliasListAliasItem['dirpath'];
$file = eZClusterFileHandler::instance($filepath);
if ($file->exists()) {
$file->purge();
eZImageFile::removeFilepath($contentObjectAttributeID, $filepath);
eZDir::cleanupEmptyDirectories($dirpath);
self::scriptIterate($message);
$results[] = true;
} else {
eZDebug::writeError("Image file {$filepath} for alias {$aliasName} does not exist, could not remove from disk", __METHOD__);
self::displayMessage("Image file {$filepath} for alias {$aliasName} does not exist, could not remove from disk: " . __METHOD__);
}
eZContentCacheManager::clearContentCacheIfNeeded($contentObjectID);
} else {
self::scriptIterate($message);
$results[] = true;
}
}
}
}
// Calculate return results based on execution options and results comparison
if (in_array(true, $results) && count($aliasList) == count($results) && !$executionOptions['dry']) {
return true;
}
return false;
}
示例11: process
/**
* (non-PHPdoc)
* @see extension/sqliimport/classes/sourcehandlers/ISQLIImportHandler::process()
*/
public function process($row)
{
// $row is a SimpleXMLElement object
$this->currentGUID = $row->id;
$contentOptions = new SQLIContentOptions(array('class_identifier' => 'blog_post', 'remote_id' => (string) $row->id));
$content = SQLIContent::create($contentOptions);
$published = (string) $row->published;
$updated = (string) $row->updated;
$skipUpdated = false;
if ($published && $published != '' && $published != 0) {
$content->setAttribute('published', strtotime($published));
$content->store();
} elseif ((!$published || ${$published} == '' || $published == 0) && ($updated && $updated != '' && $updated != 0)) {
$content->setAttribute('published', strtotime($updated));
$content->setAttribute('modified', strtotime($updated));
$content->store();
$skipUpdated = true;
}
if (!$skipUpdated && $updated && $updated != '' && $updated != 0) {
$content->setAttribute('modified', strtotime($updated));
$content->store();
} elseif (!$skipUpdated && (!$updated || ${$updated} == '' || $updated == 0) && ($published && $published != '' && $published != 0)) {
$content->setAttribute('published', strtotime($published));
$content->setAttribute('modified', strtotime($published));
$content->store();
}
$defaultParentNodeID = $this->handlerConfArray['DefaultParentNodeID'];
$title = (string) $row->title;
$content->fields->title = $title;
$content->fields->blog_post_author = (string) $row->author->name;
$content->fields->blog_post_url = (string) $row->link["href"];
$content->fields->publication_date = strtotime((string) $row->updated);
// Handle HTML content
$message = (string) $row->content;
$content->fields->blog_post_description_text_block = str_replace('href="/', 'href="http://github.com/', $message);
// Proxy method to SQLIContentUtils::getRichContent()
$issueTicketID = $this->getIssueFromGitCommitMessage($title, strip_tags($message));
// echo "\n\n"; print_r($issueTicketID); echo "\n\n";
$content->fields->tags = $issueTicketID;
//echo "\n\nCorrupt-ObjectID: "; print_r( $content->attribute( 'id' ) ); echo "\n\n";
// Now publish content
$content->addLocation(SQLILocation::fromNodeID($defaultParentNodeID));
$publisher = SQLIContentPublisher::getInstance();
$publisher->publish($content);
// Clear cache
$defaultParentNodeID = $this->handlerConfArray['DefaultParentNodeID'];
$parentNode = eZContentObjectTreeNode::fetch($defaultParentNodeID, 'eng-US');
if ($parentNode != false) {
$objectID = $parentNode->attribute('object')->attribute('id');
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
}
// Free some memory. Internal methods eZContentObject::clearCache() and eZContentObject::resetDataMap() will be called
// @see SQLIContent::__destruct()
unset($content);
}
示例12: array
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
*
*/
$Module = $Params['Module'];
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('ConfirmButton')) {
$deleteIDArray = $http->hasSessionVariable('DeleteCommentsIDArray') ? $http->sessionVariable('DeleteCommentsIDArray') : array();
if (is_array($deleteIDArray) && !empty($deleteIDArray)) {
$db = eZDB::instance();
$db->begin();
$commentManager = ezcomCommentManager::instance();
foreach ($deleteIDArray as $deleteID) {
$commentToRemove = ezcomComment::fetch($deleteID);
$deleteResult = $commentManager->deleteComment($commentToRemove);
if ($deleteResult === true) {
eZContentCacheManager::clearContentCacheIfNeeded($commentToRemove->attribute('contentobject_id'));
}
}
$db->commit();
}
$Module->redirectTo('/comment/list/');
}
if ($http->hasPostVariable('CancelButton')) {
$Module->redirectTo('/comment/list/');
}
$contentInfoArray = array();
$tpl = eZTemplate::factory();
$tpl->setVariable('persistent_variable', false);
$Result = array();
$Result['content'] = $tpl->fetch('design:comment/removecomments.tpl');
$Result['path'] = array(array('text' => ezpI18n::tr('ezcomments/comment/removecomments', 'Remove comments'), 'url' => false));
示例13: 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
示例14: viewCacheClear
/**
* Clears view cache for imported content objects.
* ObjectIDs are stored in 'ezpending_actions' table, with {@link SQLIContent::ACTION_CLEAR_CACHE} action
*/
public static function viewCacheClear()
{
$db = eZDB::instance();
$isCli = isset($_SERVER['argv']);
$output = null;
$progressBar = null;
$i = 0;
$conds = array('action' => SQLIContent::ACTION_CLEAR_CACHE);
$limit = array('offset' => 0, 'length' => 50);
$count = (int) eZPersistentObject::count(eZPendingActions::definition(), $conds);
if ($isCli && $count > 0) {
// Progress bar implementation
$output = new ezcConsoleOutput();
$output->outputLine('Starting to clear view cache for imported objects...');
$progressBarOptions = array('emptyChar' => ' ', 'barChar' => '=');
$progressBar = new ezcConsoleProgressbar($output, $count, $progressBarOptions);
$progressBar->start();
}
/*
* To avoid fatal errors due to memory exhaustion, pending actions are fetched by packets
*/
do {
$aObjectsToClear = eZPendingActions::fetchObjectList(eZPendingActions::definition(), null, $conds, null, $limit);
$jMax = count($aObjectsToClear);
if ($jMax > 0) {
for ($j = 0; $j < $jMax; ++$j) {
if ($isCli) {
$progressBar->advance();
}
$db->begin();
eZContentCacheManager::clearContentCacheIfNeeded((int) $aObjectsToClear[$j]->attribute('param'));
$aObjectsToClear[$j]->remove();
$db->commit();
$i++;
}
}
unset($aObjectsToClear);
eZContentObject::clearCache();
if (eZINI::instance('site.ini')->variable('ContentSettings', 'StaticCache') == 'enabled') {
$optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
$options = new ezpExtensionOptions($optionArray);
$staticCacheHandler = eZExtension::getHandlerClass($options);
$staticCacheHandler::executeActions();
}
} while ($i < $count);
if ($isCli && $count > 0) {
$progressBar->finish();
$output->outputLine();
}
}
示例15: execute
//.........这里部分代码省略.........
}
$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
{
$this->writeMessage( "\tLocation of " . $object->attribute( 'name' ) . " to Node $parentNodeID already exists.", 'notice' );
$destNode = eZContentObjectTreeNode::fetchObject( eZContentObjectTreeNode::definition(), null, array( 'parent_node_id' => $parentNodeID, 'contentobject_id' => $objectID ) );
}
$db->commit();
if( $destNode && $priority )
{
$destNode->setAttribute( 'priority', $priority );
$destNode->store();
}
if( $destNode && $setReferenceID )
{
$this->addReference( array( $setReferenceID => $destNode->attribute( 'node_id' ) ) );
}
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
}