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

ezplatform:urls:regenerate-aliases changes parent of broken link



      When repairing old url aliases (redirecting to current one), if there are a few of them under different parents, they're all attached to the parent of the current entry. What should be repaired is just a link to the current alias.

      Steps to reproduce

      1. Create clean eZ Platform instance
      2. Create and publish folder named "folder"
      3. Inside that folder create and publish another folder also named "folder"
      4. Modify that newly created and published folder - update name to "folder2". Publish the change.
      5. Move the "folder2" up to eZ Platform root, so it's on the same level as the folder created in the pt 2.
      6. Observe that /folder/folder redirects you to /folder2
      7. Break archived ezurlalias_ml record for "folder2" (which was called "folder") entry by modifying and executing the following query:

        UPDATE ezurlalias_ml SET link = 666 WHERE action = "eznode:<FOLDER2_LOCATION_ID>" and is_original = 0 and text = 'folder';

      8. Clear Symfony cache
      9. Execute the ezplatform:urls:regenerate-aliases command
      10. Clear Symfony cache

      Actual result

      1. Script when processing data displays warning "Failed processing location ... - Folder2 (eZ\Publish\Core\Base\Exceptions\BadStateException: Argument 'locationId' has a bad state: Database error)"
      2. The front-end location /folder/folder no longer redirects you to /folder2, instead there's 404.
      3. Archived database entry for "folder2" location (called "folder") got removed from ezurlalias_ml table.

      Expected result

      1. Script goes smoothly w/o warnings and errors.
      2. The front-end location /folder/folder redirects you to /folder2
      3. Archived database entry for "folder2" location (called "folder") still exists and its link column value has been repaired.

        Issue Links


          Andrzej Longosz logged work - 10/Jan/19 7:01 PM
          • Time Spent:
            1 day

            discovery, fix

          Andrzej Longosz logged work - 11/Jan/19 2:40 PM
          • Time Spent:
            4 hours

            regression fix

          Andrzej Longosz logged work - 14/Jan/19 2:40 PM
          • Time Spent:
            2 hours

            tests coverage, finalizing before review

          Andrzej Longosz logged work - 16/Jan/19 5:49 PM
          • Time Spent:
            30 minutes

            merged up


            • Assignee:
              Andrzej Longosz
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created:

                Time Tracking

                Original Estimate - Not Specified
                Not Specified
                Remaining Estimate - 0 minutes
                Time Spent - 1 day, 6 hours, 30 minutes
                1d 6h 30m