static function unserialize($contentNodeDOMNode, $contentObject, $version, $isMain, &$nodeList, &$options, $handlerType = 'ezcontentobject') { $parentNodeID = -1; $remoteID = $contentNodeDOMNode->getAttribute('remote-id'); $parentNodeRemoteID = $contentNodeDOMNode->getAttribute('parent-node-remote-id'); $node = eZContentObjectTreeNode::fetchByRemoteID($remoteID); if (is_object($node)) { $description = "Node with remote ID {$remoteID} already exists."; $choosenAction = eZPackageHandler::errorChoosenAction(eZContentObject::PACKAGE_ERROR_EXISTS, $options, $description, $handlerType, false); switch ($choosenAction) { // In case user have choosen "Keep existing object and create new" case eZContentObject::PACKAGE_NEW: $newRemoteID = eZRemoteIdUtility::generate('node'); $node->setAttribute('remote_id', $newRemoteID); $node->store(); $nodeInfo = array('contentobject_id' => $node->attribute('contentobject_id'), 'contentobject_version' => $node->attribute('contentobject_version'), 'parent_remote_id' => $remoteID); $nodeAssignment = eZPersistentObject::fetchObject(eZNodeAssignment::definition(), null, $nodeInfo); if (is_object($nodeAssignment)) { $nodeAssignment->setAttribute('parent_remote_id', $newRemoteID); $nodeAssignment->store(); } break; // When running non-interactively with ezpm.php // When running non-interactively with ezpm.php case eZPackage::NON_INTERACTIVE: case eZContentObject::PACKAGE_UPDATE: // Update existing node settigns. if (!$parentNodeRemoteID) { // when top node of subtree export, only update node sort field and sort order $node->setAttribute('sort_field', eZContentObjectTreeNode::sortFieldID($contentNodeDOMNode->getAttribute('sort-field'))); $node->setAttribute('sort_order', $contentNodeDOMNode->getAttribute('sort-order')); $node->store(); return true; } break; default: // This error may occur only if data integrity is broken $options['error'] = array('error_code' => eZContentObject::PACKAGE_ERROR_NODE_EXISTS, 'element_id' => $remoteID, 'description' => $description); return false; break; } } if ($parentNodeRemoteID) { $parentNode = eZContentObjectTreeNode::fetchByRemoteID($parentNodeRemoteID); if ($parentNode !== null) { $parentNodeID = $parentNode->attribute('node_id'); } } else { if (isset($options['top_nodes_map'][$contentNodeDOMNode->getAttribute('node-id')]['new_node_id'])) { $parentNodeID = $options['top_nodes_map'][$contentNodeDOMNode->getAttribute('node-id')]['new_node_id']; } else { if (isset($options['top_nodes_map']['*'])) { $parentNodeID = $options['top_nodes_map']['*']; } else { eZDebug::writeError('New parent node not set ' . $contentNodeDOMNode->getAttribute('name'), __METHOD__); } } } $isMain = $isMain && $contentNodeDOMNode->getAttribute('is-main-node'); $nodeInfo = array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => $version, 'is_main' => $isMain, 'parent_node' => $parentNodeID, 'parent_remote_id' => $remoteID, 'sort_field' => eZContentObjectTreeNode::sortFieldID($contentNodeDOMNode->getAttribute('sort-field')), 'sort_order' => $contentNodeDOMNode->getAttribute('sort-order')); if ($parentNodeID == -1 && $parentNodeRemoteID) { if (!isset($options['suspended-nodes'])) { $options['suspended-nodes'] = array(); } $options['suspended-nodes'][$parentNodeRemoteID] = array('nodeinfo' => $nodeInfo, 'priority' => $contentNodeDOMNode->getAttribute('priority')); return true; } $existNodeAssignment = eZPersistentObject::fetchObject(eZNodeAssignment::definition(), null, $nodeInfo); $nodeInfo['priority'] = $contentNodeDOMNode->getAttribute('priority'); if (!is_object($existNodeAssignment)) { $nodeAssignment = eZNodeAssignment::create($nodeInfo); $nodeList[] = $nodeInfo; $nodeAssignment->store(); } return true; }
function install($package, $installType, $parameters, $name, $os, $filename, $subdirectory, $content, &$installParameters, &$installData) { $serializedNameListNode = $content->getElementsByTagName('serialized-name-list')->item(0); $serializedNameList = $serializedNameListNode ? $serializedNameListNode->textContent : false; $classNameList = new eZContentClassNameList($serializedNameList); if ($classNameList->isEmpty()) { $classNameList->initFromString($content->getElementsByTagName('name')->item(0)->textContent); // for backward compatibility( <= 3.8 ) } $classNameList->validate(); $serializedDescriptionListNode = $content->getElementsByTagName('serialized-description-list')->item(0); $serializedDescriptionList = $serializedDescriptionListNode ? $serializedDescriptionListNode->textContent : false; $classDescriptionList = new eZSerializedObjectNameList($serializedDescriptionList); $classIdentifier = $content->getElementsByTagName('identifier')->item(0)->textContent; $classRemoteID = $content->getElementsByTagName('remote-id')->item(0)->textContent; $classObjectNamePattern = $content->getElementsByTagName('object-name-pattern')->item(0)->textContent; $classURLAliasPattern = is_object($content->getElementsByTagName('url-alias-pattern')->item(0)) ? $content->getElementsByTagName('url-alias-pattern')->item(0)->textContent : null; $classIsContainer = $content->getAttribute('is-container'); if ($classIsContainer !== false) { $classIsContainer = $classIsContainer == 'true' ? 1 : 0; } $classRemoteNode = $content->getElementsByTagName('remote')->item(0); $classID = $classRemoteNode->getElementsByTagName('id')->item(0)->textContent; $classGroupsNode = $classRemoteNode->getElementsByTagName('groups')->item(0); $classCreated = $classRemoteNode->getElementsByTagName('created')->item(0)->textContent; $classModified = $classRemoteNode->getElementsByTagName('modified')->item(0)->textContent; $classCreatorNode = $classRemoteNode->getElementsByTagName('creator')->item(0); $classModifierNode = $classRemoteNode->getElementsByTagName('modifier')->item(0); $classAttributesNode = $content->getElementsByTagName('attributes')->item(0); $dateTime = time(); $classCreated = $dateTime; $classModified = $dateTime; $userID = false; if (isset($installParameters['user_id'])) { $userID = $installParameters['user_id']; } $class = eZContentClass::fetchByRemoteID($classRemoteID); if ($class) { $className = $class->name(); $description = ezpI18n::tr('kernel/package', "Class '%classname' already exists.", false, array('%classname' => $className)); $choosenAction = $this->errorChoosenAction(self::ERROR_EXISTS, $installParameters, $description, $this->HandlerType); switch ($choosenAction) { case eZPackage::NON_INTERACTIVE: case self::ACTION_REPLACE: if (eZContentClassOperations::remove($class->attribute('id')) == false) { eZDebug::writeWarning("Unable to remove class '{$className}'."); return true; } eZDebug::writeNotice("Class '{$className}' will be replaced.", 'eZContentClassPackageHandler'); break; case self::ACTION_SKIP: return true; case self::ACTION_NEW: $class->setAttribute('remote_id', eZRemoteIdUtility::generate('class')); $class->store(); $classNameList->appendGroupName(" (imported)"); break; default: $installParameters['error'] = array('error_code' => self::ERROR_EXISTS, 'element_id' => $classRemoteID, 'description' => $description, 'actions' => array()); if ($class->isRemovable()) { $errorMsg = ezpI18n::tr('kernel/package', "Replace existing class"); $objectsCount = eZContentObject::fetchSameClassListCount($class->attribute('id')); if ($objectsCount) { $errorMsg .= ' ' . ezpI18n::tr('kernel/package', "(Warning! {$objectsCount} content object(s) and their sub-items will be removed)"); } $installParameters['error']['actions'][self::ACTION_REPLACE] = $errorMsg; } $installParameters['error']['actions'][self::ACTION_SKIP] = ezpI18n::tr('kernel/package', 'Skip installing this class'); $installParameters['error']['actions'][self::ACTION_NEW] = ezpI18n::tr('kernel/package', 'Keep existing and create a new one'); return false; } } unset($class); // Try to create a unique class identifier $currentClassIdentifier = $classIdentifier; $unique = false; while (!$unique) { $classList = eZContentClass::fetchByIdentifier($currentClassIdentifier); if ($classList) { // "increment" class identifier if (preg_match('/^(.*)_(\\d+)$/', $currentClassIdentifier, $matches)) { $currentClassIdentifier = $matches[1] . '_' . ($matches[2] + 1); } else { $currentClassIdentifier = $currentClassIdentifier . '_1'; } } else { $unique = true; } unset($classList); } $classIdentifier = $currentClassIdentifier; $values = array('version' => 0, 'serialized_name_list' => $classNameList->serializeNames(), 'serialized_description_list' => $classDescriptionList->serializeNames(), 'create_lang_if_not_exist' => true, 'identifier' => $classIdentifier, 'remote_id' => $classRemoteID, 'contentobject_name' => $classObjectNamePattern, 'url_alias_name' => $classURLAliasPattern, 'is_container' => $classIsContainer, 'created' => $classCreated, 'modified' => $classModified); if ($content->hasAttribute('sort-field')) { $values['sort_field'] = eZContentObjectTreeNode::sortFieldID($content->getAttribute('sort-field')); } else { eZDebug::writeNotice('The sort field was not specified in the content class package. ' . 'This property is exported and imported since eZ Publish 4.0.2', __METHOD__); } if ($content->hasAttribute('sort-order')) { $values['sort_order'] = $content->getAttribute('sort-order'); } else { eZDebug::writeNotice('The sort order was not specified in the content class package. ' . 'This property is exported and imported since eZ Publish 4.0.2', __METHOD__); } if ($content->hasAttribute('always-available')) { $values['always_available'] = $content->getAttribute('always-available') === 'true' ? 1 : 0; } else { eZDebug::writeNotice('The default object availability was not specified in the content class package. ' . 'This property is exported and imported since eZ Publish 4.0.2', __METHOD__); } // create class $class = eZContentClass::create($userID, $values); $class->store(); $classID = $class->attribute('id'); if (!isset($installData['classid_list'])) { $installData['classid_list'] = array(); } if (!isset($installData['classid_map'])) { $installData['classid_map'] = array(); } $installData['classid_list'][] = $class->attribute('id'); $installData['classid_map'][$classID] = $class->attribute('id'); // create class attributes $classAttributeList = $classAttributesNode->getElementsByTagName('attribute'); foreach ($classAttributeList as $classAttributeNode) { $isNotSupported = strtolower($classAttributeNode->getAttribute('unsupported')) == 'true'; if ($isNotSupported) { continue; } $attributeDatatype = $classAttributeNode->getAttribute('datatype'); $attributeIsRequired = strtolower($classAttributeNode->getAttribute('required')) == 'true'; $attributeIsSearchable = strtolower($classAttributeNode->getAttribute('searchable')) == 'true'; $attributeIsInformationCollector = strtolower($classAttributeNode->getAttribute('information-collector')) == 'true'; $attributeIsTranslatable = strtolower($classAttributeNode->getAttribute('translatable')) == 'true'; $attributeSerializedNameListNode = $classAttributeNode->getElementsByTagName('serialized-name-list')->item(0); $attributeSerializedNameListContent = $attributeSerializedNameListNode ? $attributeSerializedNameListNode->textContent : false; $attributeSerializedNameList = new eZSerializedObjectNameList($attributeSerializedNameListContent); if ($attributeSerializedNameList->isEmpty()) { $attributeSerializedNameList->initFromString($classAttributeNode->getElementsByTagName('name')->item(0)->textContent); } // for backward compatibility( <= 3.8 ) $attributeSerializedNameList->validate(); $attributeSerializedDescriptionListNode = $classAttributeNode->getElementsByTagName('serialized-description-list')->item(0); $attributeSerializedDescriptionListContent = $attributeSerializedDescriptionListNode ? $attributeSerializedDescriptionListNode->textContent : false; $attributeSerializedDescriptionList = new eZSerializedObjectNameList($attributeSerializedDescriptionListContent); $attributeCategoryNode = $classAttributeNode->getElementsByTagName('category')->item(0); $attributeCategory = $attributeCategoryNode ? $attributeCategoryNode->textContent : ''; $attributeSerializedDataTextNode = $classAttributeNode->getElementsByTagName('serialized-description-text')->item(0); $attributeSerializedDataTextContent = $attributeSerializedDataTextNode ? $attributeSerializedDataTextNode->textContent : false; $attributeSerializedDataText = new eZSerializedObjectNameList($attributeSerializedDataTextContent); $attributeIdentifier = $classAttributeNode->getElementsByTagName('identifier')->item(0)->textContent; $attributePlacement = $classAttributeNode->getElementsByTagName('placement')->item(0)->textContent; $attributeDatatypeParameterNode = $classAttributeNode->getElementsByTagName('datatype-parameters')->item(0); $classAttribute = $class->fetchAttributeByIdentifier($attributeIdentifier); if (!$classAttribute) { $classAttribute = eZContentClassAttribute::create($class->attribute('id'), $attributeDatatype, array('version' => 0, 'identifier' => $attributeIdentifier, 'serialized_name_list' => $attributeSerializedNameList->serializeNames(), 'serialized_description_list' => $attributeSerializedDescriptionList->serializeNames(), 'category' => $attributeCategory, 'serialized_data_text' => $attributeSerializedDataText->serializeNames(), 'is_required' => $attributeIsRequired, 'is_searchable' => $attributeIsSearchable, 'is_information_collector' => $attributeIsInformationCollector, 'can_translate' => $attributeIsTranslatable, 'placement' => $attributePlacement)); $dataType = $classAttribute->dataType(); $classAttribute->store(); $dataType->unserializeContentClassAttribute($classAttribute, $classAttributeNode, $attributeDatatypeParameterNode); $classAttribute->sync(); } } // 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); } return true; }
function createContentObject( $objectInformation ) { $db = eZDB::instance(); $contentObjectVersion = false; if ( $objectInformation['ownerID'] ) { $userID = $objectInformation['ownerID']; } else { $user = eZUser::currentUser(); $userID = $user->attribute( 'contentobject_id' ); } if ( $objectInformation['remoteID'] ) { $contentObject = eZContentObject::fetchByRemoteId( $objectInformation['remoteID'] ); if ( $contentObject ) { $this->writeMessage( "\t[".$objectInformation['remoteID']."] Object exists: " . $contentObject->attribute("name") . ". Creating new version.", 'notice' ); $contentObjectVersion = $contentObject->createNewVersion(); } } elseif ( $objectInformation['objectID'] ) { $contentObject = eZContentObject::fetch( $objectInformation['objectID'] ); if ( $contentObject ) { $this->writeMessage( "\t[".$objectInformation['remoteID']."] Object exists: " . $contentObject->attribute("name") . ". Creating new version.", 'notice' ); $contentObjectVersion = $contentObject->createNewVersion(); } } if ( !$contentObjectVersion ) { if ( is_numeric( $objectInformation['classID'] ) ) { $contentClass = eZContentClass::fetch( $objectInformation['classID'] ); } elseif ( is_string( $objectInformation['classID'] ) && $objectInformation['classID'] != "" ) { $contentClass = eZContentClass::fetchByIdentifier( $objectInformation['classID'] ); } else { $this->writeMessage( "\tNo class defined. Using class article.", 'warning' ); $contentClass = eZContentClass::fetchByIdentifier( 'article' ); } if ( !$contentClass ) { $this->writeMessage( "\tCannot instantiate class '". $objectInformation['classID'] ."'." , 'error' ); return false; } $contentObject = $contentClass->instantiate( $userID ); $contentObject->setAttribute( 'remote_id', $objectInformation['remoteID'] ); if ( $contentObject ) { $contentObjectVersion = $contentObject->currentVersion(); } } if ( $contentObjectVersion ) { $db->begin(); $versionNumber = $contentObjectVersion->attribute( 'version' ); $sortField = intval( eZContentObjectTreeNode::sortFieldID( $objectInformation['sort_field'] ) ); $sortOrder = strtolower( $objectInformation['sort_order'] ) == 'desc' ? eZContentObjectTreeNode::SORT_ORDER_DESC : eZContentObjectTreeNode::SORT_ORDER_ASC; $nodeAssignment = eZNodeAssignment::create( array( 'contentobject_id' => $contentObject->attribute( 'id' ), 'contentobject_version' => $versionNumber, 'parent_node' => $objectInformation['parentNode'], 'is_main' => 1, 'sort_field' => $sortField, 'sort_order' => $sortOrder, ) ); $nodeAssignment->store(); $dataMap = $contentObjectVersion->dataMap(); foreach ( $objectInformation['attributes'] as $attributeName => $attributesContent ) { if ( array_key_exists( $attributeName, $dataMap ) ) { $attribute = $dataMap[$attributeName]; $classAttributeID = $attribute->attribute( 'contentclassattribute_id' ); $dataType = $attribute->attribute( 'data_type_string' ); switch ( $dataType ) { case 'ezstring': case 'eztext': case 'ezselection': case 'ezemail': { if ( array_key_exists( 'parseReferences', $attributesContent ) && $attributesContent['parseReferences'] == "true" ) { $attribute->setAttribute( 'data_text', $this->parseAndReplaceStringReferences( $attributesContent['content'] ) ); } else { $attribute->setAttribute( 'data_text', $attributesContent['content'] ); } } break; case 'ezboolean': case 'ezinteger': { $attribute->setAttribute( 'data_int', (int)$attributesContent['content'] ); } break; case 'ezxmltext': { if ( array_key_exists( 'parseReferences', $attributesContent ) && $attributesContent['parseReferences'] == "true" ) { $attributesContent['content'] = $this->parseAndReplaceStringReferences( $attributesContent['content'] ); } if ( array_key_exists( 'htmlDecode', $attributesContent ) && $attributesContent['htmlDecode'] == "true" ) { $content = html_entity_decode( $attributesContent['content'] ); } else { $content = $attributesContent['content']; } if( array_key_exists( 'fullxml', $attributesContent ) && $attributesContent['fullxml'] == "true" ) { $xml = $content; } else { $xml = '<?xml version="1.0" encoding="utf-8"?>'."\n". '<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"'."\n". ' xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"'."\n". ' xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">'."\n". ' <section>'."\n"; $xml .= ' <paragraph>' . $content . "</paragraph>\n"; $xml .= " </section>\n</section>\n"; } $attribute->setAttribute( 'data_text', $xml ); } break; case 'ezprice': case 'ezfloat': { $attribute->setAttribute( 'data_float', (float)$attributesContent['content'] ); } break; case 'ezimage': { $imagePath = $this->setting( 'data_source' ) . '/' . $attributesContent['src']; $imageName = $attributesContent['title']; $path = realpath( $imagePath ); if ( file_exists( $path ) ) { $content = $attribute->content(); $content->initializeFromFile( $path, $imageName, basename( $attributesContent['src'] ) ); $content->store( $attribute ); } else { $this->writeMessage( "\tFile " . $path . " not found.", 'warning' ); } } break; case 'ezobjectrelation': { $relationContent = trim( $attributesContent['content'] ); if ( $relationContent != '' ) { $objectID = $this->getReferenceID( $attributesContent['content'] ); if ( $objectID ) { $attribute->setAttribute( 'data_int', $objectID ); eZContentObject::fetch( $objectID )->addContentObjectRelation( $objectID, $versionNumber, $contentObject->attribute( 'id' ), $attribute->attribute( 'contentclassattribute_id' ), eZContentObject::RELATION_ATTRIBUTE ); } else { $this->writeMessage( "\tReference " . $attributesContent['content'] . " not set.", 'warning' ); } } } break; case 'ezurl': { $url = ''; $title = ''; if ( array_key_exists( 'url', $attributesContent ) ) $url = $attributesContent['url']; if ( array_key_exists( 'title', $attributesContent ) ) $title = $attributesContent['title']; if ( array_key_exists( 'parseReferences', $attributesContent ) && $attributesContent['parseReferences'] == "true" ) { $title = $this->parseAndReplaceStringReferences( $title ); $url = $this->parseAndReplaceStringReferences( $url ); } $attribute->setAttribute( 'data_text', $title ); $attribute->setContent( $url ); } break; case 'ezuser': { $login = ''; $email = ''; $password = ''; if ( array_key_exists( 'login', $attributesContent ) ) $login = $attributesContent['login']; if ( array_key_exists( 'email', $attributesContent ) ) $email = $attributesContent['email']; if ( array_key_exists( 'password', $attributesContent ) ) $password = $attributesContent['password']; $contentObjectID = $attribute->attribute( "contentobject_id" ); $user =& $attribute->content(); if ( $user === null ) { $user = eZUser::create( $contentObjectID ); } $ini =& eZINI::instance(); $generatePasswordIfEmpty = $ini->variable( "UserSettings", "GeneratePasswordIfEmpty" ); if ( $password == "" ) { if ( $generatePasswordIfEmpty == 'true' ) { $passwordLength = $ini->variable( "UserSettings", "GeneratePasswordLength" ); $password = $user->createPassword( $passwordLength ); } else { $password = null; } } if ( $password == "_ezpassword" ) { $password = false; $passwordConfirm = false; } $user->setInformation( $contentObjectID, $login, $email, $password, $password ); $attribute->setContent( $user ); } break; case 'ezkeyword': { $keyword = new eZKeyword(); $keyword->initializeKeyword( $attributesContent['content'] ); $attribute->setContent( $keyword ); } break; case 'ezmatrix': { if ( is_array( $attributesContent ) ) { $matrix = $attribute->attribute( 'content' ); $cells = array(); $matrix->Matrix['rows']['sequential'] = array(); $matrix->NumRows = 0; foreach( $attributesContent as $key => $value ) { $cells = array_merge( $cells, $value ); $newRow['columns'] = $value; $newRow['identifier'] = 'row_' . ( $matrix->NumRows + 1 ); $newRow['name'] = 'Row_' . ( $matrix->NumRows + 1 ); $matrix->NumRows++; $matrix->Matrix['rows']['sequential'][] = $newRow; } $matrix->Cells = $cells; $attribute->setAttribute( 'data_text', $matrix->xmlString() ); $matrix->decodeXML( $attribute->attribute( 'data_text' ) ); $attribute->setContent( $matrix ); } } break; case 'ezobjectrelationlist': { $relationContent = explode( ',', $attributesContent['content'] ); if ( count( $relationContent ) ) { $objectIDs = array(); foreach( $relationContent as $relation ) { $objectIDs[] = $this->getReferenceID( trim ( $relation ) ); } $attribute->fromString( implode( '-', $objectIDs ) ); } else { eZDebug::writeWarning( $attributesContent['content'], "No relation declared" ); } } break; case 'ezauthor': case 'ezbinaryfile': case 'ezcountry': case 'ezdate': case 'ezdatetime': case 'ezenum': case 'ezidentifier': case 'ezinisetting': case 'ezisbn': case 'ezmedia': case 'ezmultioption': case 'ezmultiprice': case 'ezoption': case 'ezpackage': case 'ezproductcategory': case 'ezrangeoption': case 'ezsubtreesubscription': case 'eztime': default: { try { $attribute->fromString($attributesContent['content']); } catch ( Exception $e ) { $this->writeMessage( "\tDatatype " . $dataType . " fromString function rejected value " . $attributesContent['content'], 'warning' ); } } break; } $attribute->store(); } } if ( isset($objectInformation['sectionID']) && $objectInformation['sectionID'] != '' && $objectInformation['sectionID'] != 0 ) { $contentObject->setAttribute( 'section_id', $objectInformation['sectionID'] ); } if ( isset($objectInformation['creatorID']) && $objectInformation['creatorID'] != '' && $objectInformation['creatorID'] != 0 ) { $contentObjectVersion->setAttribute( 'creator_id', $objectInformation['creatorID'] ); } if ( isset($objectInformation['ownerID']) && $objectInformation['ownerID'] != '' && $objectInformation['ownerID'] != 0 ) { $contentObject->setAttribute( 'owner_id', $objectInformation['ownerID'] ); } if( isset( $objectInformation['relations'] ) && is_array( $objectInformation['relations'] ) ) { foreach( $objectInformation['relations'] as $toObjectID ) { $contentObject->addContentObjectRelation( $toObjectID ); } } $contentObjectVersion->store(); $contentObject->store(); $db->commit(); eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObject->attribute( 'id' ), 'version' => $versionNumber ) ); $newNodeArray = eZContentObjectTreeNode::fetchByContentObjectID( $contentObject->attribute( 'id' ) ); $refArray = false; if ( $newNodeArray && count($newNodeArray) >= 1 ) { $newNode = $newNodeArray[0]; if ( $newNode ) { $refArray = array( "node_id" => $newNode->attribute( 'node_id' ), "name" => $contentObjectVersion->attribute( 'name' ), "object_id" => $contentObject->attribute( 'id' ) ); if( $objectInformation['priority'] ) { $this->updateNodePriority( $refArray['node_id'], $objectInformation['priority'] ); } } } unset($contentObjectVersion); unset($contentObject); return $refArray; } return false; }