public function execute($process, $event) { $processParameters = $process->attribute('parameter_list'); $object = eZContentObject::fetch($processParameters['object_id']); $targetClassIdentifier = $object->contentClass()->attribute('identifier'); $iniGroups = eZINI::instance('ngindexer.ini')->groups(); $targets = array(); foreach ($iniGroups as $iniGroupName => $iniGroup) { $iniGroupNameArray = explode('/', $iniGroupName); if (is_array($iniGroupNameArray) && count($iniGroupNameArray) == 3) { $class = eZContentClass::fetchByIdentifier($iniGroupNameArray[0]); if ($class instanceof eZContentClass) { $classAttribute = $class->fetchAttributeByIdentifier($iniGroupNameArray[1]); if ($classAttribute instanceof eZContentClassAttribute) { $indexTarget = isset($iniGroup['IndexTarget']) ? trim($iniGroup['IndexTarget']) : ''; $referencedClassIdentifiers = isset($iniGroup['ClassIdentifiers']) && is_array($iniGroup['ClassIdentifiers']) ? $iniGroup['ClassIdentifiers'] : null; if ($referencedClassIdentifiers != null && (empty($referencedClassIdentifiers) || in_array($targetClassIdentifier, $referencedClassIdentifiers))) { switch ($indexTarget) { case 'parent': case 'parent_line': $children = eZContentObjectTreeNode::subTreeByNodeID(array('ClassFilterType' => 'include', 'ClassFilterArray' => array($iniGroupNameArray[0]), 'Depth' => $indexTarget == 'parent' ? 1 : false), $object->mainNode()->attribute('node_id')); if (is_array($children)) { $targets = array_merge($targets, $children); } break; case 'children': $parentNode = $object->mainNode()->fetchParent(); if ($parentNode->classIdentifier() == $iniGroupNameArray[0]) { $targets[] = $parentNode; } break; case 'subtree': $path = $object->mainNode()->fetchPath(); foreach ($path as $pathNode) { if ($pathNode->classIdentifier() == $iniGroupNameArray[0]) { $targets[] = $parentNode; } } break; default: continue; } } } } } } $filteredTargets = array(); foreach ($targets as $target) { $objectID = $target->attribute('contentobject_id'); $version = $target->object()->attribute('current_version'); if (!isset($filteredTargets[$objectID])) { $filteredTargets[$objectID] = $version; eZContentOperationCollection::registerSearchObject($objectID, $version); } } return eZWorkflowType::STATUS_ACCEPTED; }
/** * @param int $nodeID * @param string $action */ public function updateNodeVisibility( $nodeID, $action ) { $node = eZContentObjectTreeNode::fetch( $nodeID ); eZContentOperationCollection::registerSearchObject($node->attribute( 'contentobject_id' )); if ( $node->childrenCount( false ) ) { $pendingAction = new eZPendingActions( array( 'action' => self::PENDING_ACTION_INDEX_SUBTREE, 'created' => time(), 'param' => $nodeID ) ); $pendingAction->store(); } }
public function execute($process, $event) { //echo('*** workflow importcomunicati ***<pre>'); $parameters = $process->attribute('parameter_list'); try { $object = eZContentObject::fetch($parameters['object_id']); // if a newer object is the current version, abort this workflow. $currentVersion = $object->attribute('current_version'); $version = $object->version($parameters['version']); $classIdentifier = $version->ContentObject->ClassIdentifier; // Verifica se la classe è corretta if ($classIdentifier == self::PUBLISH_CLASS) { $objectAttributes = $version->attribute('contentobject_attributes'); // cicla sugl iattributi foreach ($objectAttributes as $objectAttribute) { $contentClassAttributeIdentifier = $objectAttribute->ContentClassAttributeIdentifier; if ($contentClassAttributeIdentifier == 'published') { // recupera la data di pubblicazione $publisheddate = $objectAttribute->attribute('content'); } } // set della data di pubblicazione if ($publisheddate instanceof eZDateTime || $publisheddate instanceof eZDate) { $object->setAttribute('published', $publisheddate->timeStamp()); $object->store(); eZContentOperationCollection::registerSearchObject($object->attribute('id')); eZDebug::writeNotice('Workflow change object publish date', __METHOD__); } //echo('<br>*** die workflow ***'); //die(); } return eZWorkflowType::STATUS_ACCEPTED; } catch (Exception $e) { eZDebug::writeError($e->getMessage(), __METHOD__); return eZWorkflowType::STATUS_REJECTED; } }
/** * Removes a translation for a contentobject * * @param int $objectID * @param array * @return array An array with operation status, always true */ public static function removeTranslation($objectID, $languageIDArray) { $object = eZContentObject::fetch($objectID); foreach ($languageIDArray as $languageID) { if (!$object->removeTranslation($languageID)) { eZDebug::writeError("Object with id {$objectID}: cannot remove the translation with language id {$languageID}!", __METHOD__); } } eZContentOperationCollection::registerSearchObject($objectID); eZContentCacheManager::clearContentCacheIfNeeded($objectID); return array('status' => true); }
/** * Update search index when object state changes * * @param int $objectID * @param array $objectStateList */ public function updateObjectState($objectID, $objectStateList) { eZContentOperationCollection::registerSearchObject($objectID); }
$module = $Params['Module']; $objectID = $module->actionParameter( 'ContentObjectID' ); $nodeID = $module->actionParameter( 'NodeID' ); $languageCode = $module->actionParameter( 'LanguageCode' ); $viewMode = 'full'; if ( !$module->hasActionParameter( 'ViewMode' ) ) { $viewMode = $module->actionParameter( 'ViewMode' ); } if ( $module->isCurrentAction( 'IndexObject' ) || $module->isCurrentAction( 'IndexSubtree' )) { eZContentOperationCollection::registerSearchObject( $objectID ); } if ( $module->isCurrentAction( 'IndexSubtree' ) ) { $pendingAction = new eZPendingActions( array( 'action' => eZSolr::PENDING_ACTION_INDEX_SUBTREE, 'created' => time(), 'param' => $nodeID ) ); $pendingAction->store(); } if ( $module->isCurrentAction( 'RemoveObject' ) ) { $object = eZContentObject::fetch($objectID);
/** * Called when a node assignement is added to an object. * Simply re-index for now. * * @todo: defer to cron if there are children involved and re-index these too * @todo when Solr supports it: update fields only * * @param $mainNodeID * @param $objectID * @param $nodeAssignmentIDList * @return unknown_type * @see eZSearch::addNodeAssignment() */ public function addNodeAssignment( $mainNodeID, $objectID, $nodeAssignmentIDList ) { eZContentOperationCollection::registerSearchObject( $objectID ); }
if ( empty($rows) ) { $continue = false; break; } foreach( $rows as $row ) { $remoteId = $row['remote_id']; $object = eZContentObject::fetchByRemoteID($remoteId); //if eZ Publish object if ($object) { $counter++; eZContentOperationCollection::registerSearchObject($object->attribute("id"), false); $varnishNodeIds[] = $object->mainNode()->attribute('parent_node_id'); } else { $counter++; //test if solrObject $fields = array( 'rating' => 'attr_content_rating_'.$row['cluster_identifier'].'_f', ); $params = array( 'indent' => 'on', 'q' => '*:*', 'start' => 0,
$indexed_ids = array(); $i = 0; //ezObjects foreach($objectIds as $object_id) { if (!($i%200) ) { echo "Traitement : $i\n"; } $i++; // we let the search plugin deal with the indexation and flag the nodes not to be reindexed eZContentOperationCollection::registerSearchObject($object_id, false); eZContentObject::clearCache(); } $i = 0; //solrObjects foreach($solrJsonObjects as $solrJsonObject) { if (!($i%200) ) { echo "Traitement Solr : $i\n"; } $i++;
/** * Registers all objects related to this tag to search engine for processing * */ function registerSearchObjects() { $eZTagsINI = eZINI::instance('eztags.ini'); if (eZINI::instance('site.ini')->variable('SearchSettings', 'DelayedIndexing') !== 'disabled' || $eZTagsINI->variable('SearchSettings', 'ReindexWhenDelayedIndexingDisabled') == 'enabled') { $relatedObjects = $this->getRelatedObjects(); foreach ($relatedObjects as $relatedObject) { eZContentOperationCollection::registerSearchObject($relatedObject->attribute('id'), $relatedObject->attribute('current_version')); } } else { eZHTTPTool::instance()->setSessionVariable('eZTagsShowReindexMessage', 1); } }