Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-32012

backup/restore from M1.9 to M2.x does not preserve linking between resources

    Details

    • Testing Instructions:
      Hide

      Create backup:
      In Moodle 1.9 -
      In course file, create a folder, in it place two files, a image, and a html file that loads that image as a relative path (<img src="img.jpg>").
      On the front page of the course, and a Link to a file and link to the html file.
      Backup the course and download it.

      NOTE: I've attached a sample backup that is confirmed to exhibit the behavior, and also includes a 3 level deep folder test.

      In moodle 2.x
      Go into a course, go to restore, and add the 1.9 backup.
      You can restore into the existing course, merging, and use all the default settings, except on step "4. Schema" set overwrite course settings to Yes (this is because of a seeming bug that makes legacy files that may be needed by resources unavailable unless this is done).

      Complete the restore.

      Bad behavior:
      If you edit the resource created, you will notice that img.html is at the base level, instead of in a folder. If you were to upgrade the 1.9 site it would be in the subfolder.
      If you try and view the resource, the image will show as broken.

      Behavior after patch:
      The file structure is recreated in the resource, and when you view the resource, it will load in the image.

      Show
      Create backup: In Moodle 1.9 - In course file, create a folder, in it place two files, a image, and a html file that loads that image as a relative path (<img src="img.jpg>"). On the front page of the course, and a Link to a file and link to the html file. Backup the course and download it. NOTE: I've attached a sample backup that is confirmed to exhibit the behavior, and also includes a 3 level deep folder test. In moodle 2.x Go into a course, go to restore, and add the 1.9 backup. You can restore into the existing course, merging, and use all the default settings, except on step "4. Schema" set overwrite course settings to Yes (this is because of a seeming bug that makes legacy files that may be needed by resources unavailable unless this is done). Complete the restore. Bad behavior: If you edit the resource created, you will notice that img.html is at the base level, instead of in a folder. If you were to upgrade the 1.9 site it would be in the subfolder. If you try and view the resource, the image will show as broken. Behavior after patch: The file structure is recreated in the resource, and when you view the resource, it will load in the image.
    • Workaround:
      Hide

      Patch is attached.

      Show
      Patch is attached.
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:

      Description

      The backup and restore of resources from Moodle 1.9.x to Moodle 2.x does not preserve linking between resources.

      I think this patch fixes this problem.

      mk

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              bazaar Mawuli Kuivi created issue -
              Hide
              salvetore Michael de Raadt added a comment -

              Thanks for reporting that and sharing a patch.

              Could you provide a set of replication steps, just so we know the circumstances?

              Show
              salvetore Michael de Raadt added a comment - Thanks for reporting that and sharing a patch. Could you provide a set of replication steps, just so we know the circumstances?
              salvetore Michael de Raadt made changes -
              Field Original Value New Value
              Fix Version/s STABLE backlog [ 10463 ]
              Labels patch triaged
              salvetore Michael de Raadt made changes -
              Priority Minor [ 4 ] Major [ 3 ]
              Hide
              t6nis20 Tõnis Tartes added a comment -

              This is just what i was looking for!

              Thank you Mawuli!!

              The same problem is addressed also in forum - http://moodle.org/mod/forum/discuss.php?d=193152

              Show
              t6nis20 Tõnis Tartes added a comment - This is just what i was looking for! Thank you Mawuli!! The same problem is addressed also in forum - http://moodle.org/mod/forum/discuss.php?d=193152
              Hide
              bazaar Mawuli Kuivi added a comment -

              Steps for replication:
              The problem was that when you have files in the 1.9 system linked inside some html resource or resource, the backup and restore to 2.x might create problems.

              If the link to the files are in the root directory of the course, then you do not have a problem.

              But if you link to some file say /dir1/dir2/filename, then this creates the problem. The restore does not create the correct link to the file. It creates to link to /filename instead of /dir1/dir2/filename.

              The /dir1/dir2/filename will correctly be restores but any resource linking to this file will end up with a problem,

              Lets create two files.

              1. /dir1/dir2/filename1
              2. /dir1/filename2

              Inside /dir1/filename2 this file, we have say
              <a href="dir2/filename1">conference</a>

              Now when you restore this to 2.x, the link inside /dir1/filename2 will now be pointing to
              <a href="filename1">conference</a> instead of <a href="dir2/filename1">conference</a>

              Hope this helps to replicate the problem.

              mk

              Show
              bazaar Mawuli Kuivi added a comment - Steps for replication: The problem was that when you have files in the 1.9 system linked inside some html resource or resource, the backup and restore to 2.x might create problems. If the link to the files are in the root directory of the course, then you do not have a problem. But if you link to some file say /dir1/dir2/filename, then this creates the problem. The restore does not create the correct link to the file. It creates to link to /filename instead of /dir1/dir2/filename. The /dir1/dir2/filename will correctly be restores but any resource linking to this file will end up with a problem, Lets create two files. 1. /dir1/dir2/filename1 2. /dir1/filename2 Inside /dir1/filename2 this file, we have say <a href="dir2/filename1">conference</a> Now when you restore this to 2.x, the link inside /dir1/filename2 will now be pointing to <a href="filename1">conference</a> instead of <a href="dir2/filename1">conference</a> Hope this helps to replicate the problem. mk
              emerrill Eric Merrill made changes -
              Pull Master Diff URL https://github.com/merrill-oakland/moodle/compare/moodle%3Amaster...MDL-32012
              Pull Master Branch MDL-32012
              Testing Instructions Create backup:
              In Moodle 1.9 -
              In course file, create a folder, in it place two files, a image, and a html file that loads that image as a relative path (<img src="img.jpg>").
              On the front page of the course, and a Link to a file and link to the html file.
              Backup the course and download it.

              NOTE: I've attached a sample backup that is confirmed to exhibit the behavior, and also includes a 3 level deep folder test.



              In moodle 2.x
              Go into a course, go to restore, and add the 1.9 backup.
              You can restore into the existing course, merging, and use all the default settings, except on step "4. Schema" set overwrite course settings to Yes (this is because of a seeming bug that makes legacy files that may be needed by resources unavailable unless this is done).

              Complete the restore.

              Bad behavior:
              If you edit the resource created, you will notice that img.html is at the base level, instead of in a folder. If you were to upgrade the 1.9 site it would be in the subfolder.
              If you try and view the resource, the image will show as broken.

              Behavior after patch:
              The file structure is recreated in the resource, and when you view the resource, it will load in the image.
              Pull 2.2 Diff URL https://github.com/merrill-oakland/moodle/compare/moodle%3AMOODLE_22_STABLE...MDL-32012_m22
              Pull 2.1 Branch MDL-32012_m21
              Pull 2.2 Branch MDL-32012_m22
              Pull 2.1 Diff URL https://github.com/merrill-oakland/moodle/compare/moodle%3AMOODLE_21_STABLE...MDL-32012_m21
              Pull from Repository git://github.com/merrill-oakland/moodle.git
              Attachment backup-resource-20120420-1055.zip [ 27992 ]
              Hide
              emerrill Eric Merrill added a comment -

              We have also been seeing this problem.

              I've added testing instructions, pull branches for 2.1, 2.2 and master (thanks for the patch Mawuli!), and a 1.9 backup file to help with testing.

              Show
              emerrill Eric Merrill added a comment - We have also been seeing this problem. I've added testing instructions, pull branches for 2.1, 2.2 and master (thanks for the patch Mawuli!), and a 1.9 backup file to help with testing.
              Hide
              emerrill Eric Merrill added a comment -

              Oh, I also tested the patch and a few test cases and it seems to work as it should.

              Show
              emerrill Eric Merrill added a comment - Oh, I also tested the patch and a few test cases and it seems to work as it should.
              emerrill Eric Merrill made changes -
              Assignee moodle.com [ moodle.com ] Eric Merrill [ emerrill ]
              emerrill Eric Merrill made changes -
              Status Open [ 1 ] Waiting for peer review [ 10012 ]
              Hide
              salvetore Michael de Raadt added a comment -

              Thanks for adding more information.

              I'll see if we can get this peer reviewed soon.

              Show
              salvetore Michael de Raadt added a comment - Thanks for adding more information. I'll see if we can get this peer reviewed soon.
              poltawski Dan Poltawski made changes -
              Original Estimate 0 minutes [ 0 ]
              Remaining Estimate 0 minutes [ 0 ]
              Status Waiting for peer review [ 10012 ] Peer review in progress [ 10013 ]
              Peer reviewer poltawski
              Hide
              poltawski Dan Poltawski added a comment -

              Thanks everyone for your work on this - it looks good to me, submitting for integration!

              Show
              poltawski Dan Poltawski added a comment - Thanks everyone for your work on this - it looks good to me, submitting for integration!
              poltawski Dan Poltawski made changes -
              Status Peer review in progress [ 10013 ] Waiting for integration review [ 10010 ]
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

              TIA and ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
              Hide
              emerrill Eric Merrill added a comment -

              Rebased.

              Show
              emerrill Eric Merrill added a comment - Rebased.
              samhemelryk Sam Hemelryk made changes -
              Currently in integration Yes [ 10041 ]
              samhemelryk Sam Hemelryk made changes -
              Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
              Integrator samhemelryk
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Thanks guys this has been integrated now.
              Please note I did make an extra commit to fix whitespace however.

              Cheers
              Sam

              Show
              samhemelryk Sam Hemelryk added a comment - Thanks guys this has been integrated now. Please note I did make an extra commit to fix whitespace however. Cheers Sam
              samhemelryk Sam Hemelryk made changes -
              Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
              Fix Version/s 2.1.6 [ 12052 ]
              Fix Version/s 2.2.3 [ 12053 ]
              Fix Version/s STABLE backlog [ 10463 ]
              salvetore Michael de Raadt made changes -
              Tester rwijaya
              rwijaya Rossiani Wijaya made changes -
              Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
              Hide
              rwijaya Rossiani Wijaya added a comment -

              This looks great.

              Test passed.

              Show
              rwijaya Rossiani Wijaya added a comment - This looks great. Test passed.
              rwijaya Rossiani Wijaya made changes -
              Status Testing in progress [ 10011 ] Tested [ 10006 ]
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              UPDATE tracker_issues
                 SET status = 'Closed',
                    comment = 'Thanks!'
              WHEN participants = 'Did a gorgeous work'

              This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - UPDATE tracker_issues SET status = 'Closed', comment = 'Thanks!' WHEN participants = 'Did a gorgeous work' This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).
              stronk7 Eloy Lafuente (stronk7) made changes -
              Status Tested [ 10006 ] Closed [ 6 ]
              Resolution Fixed [ 1 ]
              Currently in integration Yes [ 10041 ]
              Integration date 04/May/12
              salvetore Michael de Raadt made changes -
              Link This issue will help resolve MDL-21380 [ MDL-21380 ]
              mudrd8mz David Mudrák made changes -
              Link This issue has been marked as being related by MDL-37774 [ MDL-37774 ]

                People

                • Votes:
                  4 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/12