Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-14343

Transaction error in eZURLAliasML::setLangMaskAlwaysAvailable()

    XMLWordPrintable

Details

    Description

      In function eZURLAliasML::setLangMaskAlwaysAvailable() In some cases $actionName could be an array but empty.
      So transaction error will appear due to wrong SQL like

      UPDATE ezurlalias_ml SET lang_mask = cast ( lang_mask | 1 AS SIGNED ) WHERE action in () AND cast( lang_mask & 2 ) > 0
      

      It can happened while installing list of objects from a package.
      Simplified backtrace:
      0. <handler calls are skipped> ...

      1. eZContentObject::unserialize() is called

      2. eZContentObjectVersion::unserialize() is called in eZContentObject::unserialize()

      3. eZContentObjectTreeNode::unserialize() is called in eZContentObjectVersion::unserialize()
      If there is parent node remote id ($parentNodeRemoteID) and could not fetch node by this remote id (It means parent node is not installed yet),
      $parentNodeID will be '-1', so current node, we tried to install, goes to suspended-nodes and will be installed later (after installing of parent node).
      $nodeList is not changed and is still empty!

      4. eZOperationHandler::execute( 'content', 'publish', array(...) ) is called in eZContentObject::unserialize()

      5. eZContentOperationCollection::setObjectStatusPublished() is called in eZModuleOperationInfo::executeClassMethod()

      There is a check for $objectIsAlwaysAvailable

      if ( $objectIsAlwaysAvailable )
      {
          $initialLanguageID = $object->attribute( 'initial_language_id' );
          $object->setAlwaysAvailableLanguageID( $initialLanguageID );
      }
      

      If object is not always available it will be imported correctly, because $object->setAlwaysAvailableLanguageID() will not be called.
      If so,

      6. eZContentObject::setAlwaysAvailableLanguageID() is called in eZContentOperationCollection::setObjectStatusPublished()

      There is a code

      $nodeRows = eZContentObjectTreeNode::fetchByContentObjectID( $objectID, false );
      $actions = array();
      foreach ( $nodeRows as $nodeRow )
      {
          $nodeID = (int)$nodeRow['node_id'];
          $actions[] = array( 'eznode', $nodeID );
      }
      
      eZURLAliasML::setLangMaskAlwaysAvailable( $languageID, $actions, null );
      

      As we remember there is no node for $objectID, due to it was suspended for later importing. Thus $actions will be empty and we will get transaction error in eZURLAliasML::setLangMaskAlwaysAvailable()

      Attachments

        Activity

          People

            ls ls
            vd vd
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: