Details

      Description

      (related to Studio, but happens on Platform functionality)

      There is a problem when trying edit Swapped Landing Pages.

      Steps:
      1. In Platform UI create two Folders. In each of these folders create one Landing Page.
      2. Go to one of these Landing Pages in Platform UI and Swap it with the other one.
      3. Go to one of these Landing Pages in Studio UI and try to switch to Edit.

      Actual Result: A "400 Bad Request" error appears.
      Expected result: You can edit the swapped Landing Page normally.

      Remarks: This happens when trying to swap two Landing Pages, or a Landing Page with a different type of content.

        Issue Links

          Activity

          Hide
          Gunnstein Lye added a comment - - edited

          Not reproducible on pure Platform (just swapping folders).

          In Studio, I don't even get to the point of editing, as viewing the landing page fails with 404 not found. Nothing useful in the logs.

          Viewing the parent of the landing page produces an exception:

          Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Argument '$fieldIdentifier' is invalid: 'image' field not present on content #107 'Page B'") in "eZStudioDemoBundle:full:folder.html.twig" at line 27."
           
          at /home/gl/git/ezstudio-demo-ezsystems/app/cache/prod/classes.php line 5266 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Argument '$fieldIdentifier' is invalid: 'image' field not present on content #107 'Page B'\") in \"eZStudioDemoBundle:full:folder.html.twig\" at line 27.
           
          at /home/gl/git/ezstudio-demo-ezsystems/app/cache/prod/classes.php:5266, eZ\\Publish\\Core\\Base\\Exceptions\\InvalidArgumentException(code: 0): Argument '$fieldIdentifier' is invalid: 'image' field not present on content #107 'Page B' at /home/gl/git/ezstudio-demo-ezsystems/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php:126)"} []
          

          Show
          Gunnstein Lye added a comment - - edited Not reproducible on pure Platform (just swapping folders). In Studio, I don't even get to the point of editing, as viewing the landing page fails with 404 not found. Nothing useful in the logs. Viewing the parent of the landing page produces an exception: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Argument '$fieldIdentifier' is invalid: 'image' field not present on content #107 'Page B'") in "eZStudioDemoBundle:full:folder.html.twig" at line 27."   at /home/gl/git/ezstudio-demo-ezsystems/app/cache/prod/classes.php line 5266 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Argument '$fieldIdentifier' is invalid: 'image' field not present on content #107 'Page B'\") in \"eZStudioDemoBundle:full:folder.html.twig\" at line 27.   at /home/gl/git/ezstudio-demo-ezsystems/app/cache/prod/classes.php:5266, eZ\\Publish\\Core\\Base\\Exceptions\\InvalidArgumentException(code: 0): Argument '$fieldIdentifier' is invalid: 'image' field not present on content #107 'Page B' at /home/gl/git/ezstudio-demo-ezsystems/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php:126)"} []
          Hide
          Gunnstein Lye added a comment - - edited

          Confirmed: Fixing the above DB inconsistencies solves the problem.

          Fixing the bug should be easy. Making an update script that solves existing instances of the problem may be tricky-to-impossible, depending on whether content has been renamed since the swap.

          Oh joy. This goes back to 2011: https://github.com/ezsystems/ezpublish-kernel/commit/67222b398940cfa76f7aac33899cf5a231a41aa3
          Partially fixed in 2012: https://github.com/ezsystems/ezpublish-kernel/commit/2c5bf4f9ff793a852d283c891b1e58a6c1c102ff

          Show
          Gunnstein Lye added a comment - - edited Confirmed: Fixing the above DB inconsistencies solves the problem. Fixing the bug should be easy. Making an update script that solves existing instances of the problem may be tricky-to-impossible, depending on whether content has been renamed since the swap. Oh joy. This goes back to 2011: https://github.com/ezsystems/ezpublish-kernel/commit/67222b398940cfa76f7aac33899cf5a231a41aa3 Partially fixed in 2012: https://github.com/ezsystems/ezpublish-kernel/commit/2c5bf4f9ff793a852d283c891b1e58a6c1c102ff
          Hide
          Gunnstein Lye added a comment -

          In ezcontentobject_tree, the contentobject_id and contentobject_version of the landing page locations are swapped. To fix the bug we also need to swap/update these, I think:

          • contentobject_is_published
          • remote_id (not sure)
          • path_identification_string

          In ezurlalias_ml no changes are made when swapping. This is OK as far as locations go, since it's the content that is swapped, not the locations. However, to fix the bug we have to swap the content related data:

          • text
          • text_md5
          • lang_mask
          • alias_redirects (not sure)
          • is_alias (not sure)
          • is_original (not sure)

          The actual trigger of the bug is ezurlalias_ml, text and/or text_md5. The other changes are just to stay consistent.

          Alternative: Remove the swap location feature

          Show
          Gunnstein Lye added a comment - In ezcontentobject_tree , the contentobject_id and contentobject_version of the landing page locations are swapped. To fix the bug we also need to swap/update these, I think: contentobject_is_published remote_id (not sure) path_identification_string In ezurlalias_ml no changes are made when swapping. This is OK as far as locations go, since it's the content that is swapped, not the locations. However, to fix the bug we have to swap the content related data: text text_md5 lang_mask alias_redirects (not sure) is_alias (not sure) is_original (not sure) The actual trigger of the bug is ezurlalias_ml , text and/or text_md5 . The other changes are just to stay consistent. Alternative: Remove the swap location feature
          Show
          Gunnstein Lye added a comment - PR: https://github.com/ezsystems/ezpublish-kernel/pull/1752
          Show
          Petar Spanja (Inactive) added a comment - Pull request: https://github.com/ezsystems/ezpublish-kernel/pull/1781
          Hide
          Paulo Nunes (Inactive) added a comment -

          PR validated by QA
          I'll send this issue back to dev so that the merge may proceed

          Note: Imho, it might be usefull to consider documenting ezplatform:regenerate:legacy_storage_url_aliases command in doc.ez.no. The documentation text is in the PR anyway.

          Show
          Paulo Nunes (Inactive) added a comment - PR validated by QA I'll send this issue back to dev so that the merge may proceed Note: Imho, it might be usefull to consider documenting ezplatform:regenerate:legacy_storage_url_aliases command in doc.ez.no. The documentation text is in the PR anyway.
          Show
          Petar Spanja (Inactive) added a comment - Merged in https://github.com/ezsystems/ezpublish-kernel/commit/36539960b183ca9d165c5842a343e4073e0815a4
          Hide
          Dominika Kurek added a comment -
          Show
          Dominika Kurek added a comment - Added doc in https://doc.ez.no/display/DEVELOPER/Repository#Repository-RegeneratingURLAliases based on the info in the PR.
          Hide
          Paulo Nunes (Inactive) added a comment -

          Verified by QA

          Show
          Paulo Nunes (Inactive) added a comment - Verified by QA

            People

            • Assignee:
              Unassigned
              Reporter:
              Dominika Kurek
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 1 day, 1 hour, 40 minutes
                1w 1d 1h 40m