/** * Inserts a pending action * @param $action * @param $created * @param $params */ private function insertPendingAction($action, $created, $params) { $row = array('action' => $action, 'created' => $created, 'param' => $params); $obj = new eZPendingActions($row); $obj->store(); unset($obj); }
function lock(eZContentObject $object) { while (true) { if (isLocked($object)) { sleep(1); } else { break; } } $rowPending = array('action' => 'creating_translation', 'param' => $object->attribute('id')); $pendingItem = new eZPendingActions($rowPending); $pendingItem->store(); }
/** * @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(); } }
/** * Adds a "pending clear cache" action if ViewCaching is disabled. * This method should be called at publish time. * Cache should then be cleared by a cronjob * @return void */ public function addPendingClearCacheIfNeeded() { if (eZINI::instance()->variable('ContentSettings', 'ViewCaching') === 'disabled') { $rowPending = array('action' => self::ACTION_CLEAR_CACHE, 'created' => time(), 'param' => $this->contentObject->attribute('id')); $pendingItem = new eZPendingActions($rowPending); $pendingItem->store(); } }
/** * Update index when node's visibility is modified. * * If the node has children, they will be also re-indexed, but this action is deferred to ezfindexsubtree cronjob. * * @param int $nodeID * @param string $action */ public function updateNodeVisibility($nodeID, $action) { $node = eZContentObjectTreeNode::fetch($nodeID); eZContentOperationCollection::registerSearchObject($node->attribute('contentobject_id')); $params = array('Depth' => 1, 'DepthOperator' => 'eq', 'Limitation' => array(), 'IgnoreVisibility' => true); if ($node->subTreeCount($params) > 0) { $pendingAction = new eZPendingActions(array('action' => 'index_subtree', 'created' => time(), 'param' => $nodeID)); $pendingAction->store(); } }
$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); eZSearch::removeObject($object, true); } return $module->redirect( 'content', 'view', array( $viewMode, $nodeID, $languageCode ) );
/** * @param int $remoteNodeID * @param int $localParentNodeID * * @return eZContentObject * @throws Exception */ public function import($remoteNodeID, $localParentNodeID) { if (!class_exists('OCOpenDataApiNode')) { throw new Exception("Libreria OCOpenDataApiNode non trovata"); } $apiNodeUrl = rtrim($this->attributes['definition']['Url'], '/') . '/api/opendata/v1/content/node/' . $remoteNodeID; $remoteApiNode = OCOpenDataApiNode::fromLink($apiNodeUrl); if (!$remoteApiNode instanceof OCOpenDataApiNode) { throw new Exception("Url remoto \"{$apiNodeUrl}\" non raggiungibile"); } $newObject = $remoteApiNode->createContentObject($localParentNodeID); if (!$newObject instanceof eZContentObject) { throw new Exception("Fallita la creazione dell'oggetto da nodo remoto"); } $rowPending = array('action' => self::ACTION_SYNC_OBJECT, 'param' => $newObject->attribute('id')); $pendingItem = new eZPendingActions($rowPending); $pendingItem->store(); return $newObject; }
/** * Called when a node's visibility is modified. * Will re-index content identified by $nodeID. * If the node has children, they will be also re-indexed, but this action is deferred to ezfindexsubtree cronjob. * * @todo when Solr supports it: update fields only * * @param $nodeID * @param $action * @return void * @see eZSearch::updateNodeVisibility() */ public function updateNodeVisibility($nodeID, $action) { $node = eZContentObjectTreeNode::fetch($nodeID); $this->addObject($node->attribute('object')); $params = array('Depth' => 1, 'DepthOperator' => 'eq', 'Limitation' => array(), 'IgnoreVisibility' => true); if ($node->subTreeCount($params) > 0) { $pendingAction = new eZPendingActions(array('action' => self::PENDING_ACTION_INDEX_SUBTREE, 'created' => time(), 'param' => $nodeID)); $pendingAction->store(); } }
public function lock() { $pendingAction = new eZPendingActions( array( 'action' => self::ACTION_KEY, 'created' => time(), 'param' => '' ) ); $pendingAction->store(); }