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

Wrong version translation list in eZContentOperationCollection




      When publishing a content from legacy (e.g. from admin interface), content/publish operation copies missing translations on the published version.
      However, eZContentOperationCollection::copyTranslations() ignores the version language mask when retrieving the translation list for the version to publish, using $version->translationList( false, false ). While this is usually fine as a translation is generally a full bunch of translated attributes, this can lead to unexpected behavior, especially when using a mix of legacy and platform scripts.

      Typical example is when using a wait until date workflow (legacy admin/kernel), combined with several scripts from Symfony stack, like migration scripts for example:

      • Webmaster publishes from admin interface with a publication date set in the future. Content has several translations.
      • DevOps deliver a new version of code with migration scripts to update ContentTypes, including the one used by the webmaster, to add 1 new field
      • Workflow cronjob is run to publish content from webmaster

      The result here will be:

      • Translation published by the webmaster will be OK
      • All other translations will be broken, only having the new field.


      This is due to $version->translationList( false, false ) used in eZContentOperationCollection::copyTranslations, called by the workflow cronjob. This method will list all available translations for given version, by calling a SELECT DISTINCT language_code FROM ezcontentobject_attribute. As we added a new field using the public API, all translations are taken into account, instead of only published language.


      Use language_mask from version instead of $version->translationList().

      Update (eZ Support):

      Steps to reproduce:

      1. Ensure you have at least 2 languages (e.g. eng-GB and fre-FR);
      2. Create a "wait until date" workflow using admin interface. Set the "wait until date" event's class to "article", and attribute to "publish date";
      3. Assign the workflow to the "content/publish/before" trigger;
      4. Create a content in eng-GB (leave the "publication date" field empty) and publish it;
      5. Create a new translation for this content using fre-FR (again, leave the "publication date" field empty) and publish it;
      6. Create a new version in eng-GB, using a publication date in the future;
      7. Create a console command (Symfony stack) to add a new field definition to the ContentType used by the content we manipulated ("article" in this case), using the Public API;

      Note: please use the attached "UpdateContentTypeCommand.php" command as reference. Feel free to use it for tests, just make sure you change the namespace accordingly

      8. Run the command. If you use the attached command, run it like this:

      $ ezpublish/console nuno:test:update_content_type "article" "mynewtestfield"

      9. Run the workflow cronjob in order to publish the programmed content:

      $ php ezpublish/console ezpublish:legacy:script --siteaccess=my_admin_siteaccess runcronjobs.php frequent

      10. Using admin interface, edit the content in eng-GB: all fields are present, including the new one;
      11. Using admin interface, edit the content in fre-FR: same as point #10 but, for the new field, only the caption is displayed, the actual <input /> form field is not there.

      Ref: https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Workflow-events/Wait-until-date


        Issue Links



              Unassigned Unassigned
              9e9f2c72-d8ff-4ec0-b8df-c5a744234b9a@accounts.ibexa.co Jérôme Vieilledent
              0 Vote for this issue
              5 Start watching this issue