Moodle
  1. Moodle
  2. MDL-28221

when restoring a course from an older moodle instance (1.9) some of the content goes into legacy files and when tried to access "This legacy resource type ({$a}) was not yet migrated, sorry." appears.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1.1
    • Component/s: Course
    • Labels:
    • Environment:
      Virtual Machines. Ubuntu 10.04. 2 Gigs of ram for webserver, Ubuntu 10.04. 2 gigs of ram on db server.
    • Database:
      MySQL
    • Testing Instructions:
      Hide
      • In 1.9, create a course with one resource 'Link to a web or file'
      • Let the resource refer to a local file inside course_files - but manually copy and paste the URL to that file instead of choosing it via 1.9 file picker
      • Restore the course in 2.1
      • TEST: make sure the resource is converted to the File module with the referenced file correctly included.
      Show
      In 1.9, create a course with one resource 'Link to a web or file' Let the resource refer to a local file inside course_files - but manually copy and paste the URL to that file instead of choosing it via 1.9 file picker Restore the course in 2.1 TEST: make sure the resource is converted to the File module with the referenced file correctly included.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-28221-resource-conversion
    • Rank:
      17947

      Description

      when restoring a course from an older moodle instance (1.9) some of the content goes into legacy files and when tried to access "This legacy resource type ({$a}) was not yet migrated, sorry." appears.

      I am running Ubuntu 10.04 with mysql and apache2 (php 5.3).

        Issue Links

          Activity

          Hide
          Andrew Davis added a comment -

          I just had a quick look at the code involved. That string is named 'notmigrated' and comes from the 'resource' language file. Its used in 3 places.

          $resoruce_old = $DB->get_record('resource_old', array('oldid'=>$this->current->instance));
          $mform->addElement('static', 'warning', '', get_string('notmigrated', 'resource', $resoruce_old->type));
          

          All 3 have a variable called $resoruce_old which is presumably meant to be $resource_old. This same typo exists in all 3 places indicating copying and pasting. That may well mean that whatever problem exists has to be fixed in all 3 places.

          If nothing else, the misnamed variable should have its name corrected for the sake of readability.

          Show
          Andrew Davis added a comment - I just had a quick look at the code involved. That string is named 'notmigrated' and comes from the 'resource' language file. Its used in 3 places. $resoruce_old = $DB->get_record('resource_old', array('oldid'=>$ this ->current->instance)); $mform->addElement(' static ', 'warning', '', get_string('notmigrated', 'resource', $resoruce_old->type)); All 3 have a variable called $resoruce_old which is presumably meant to be $resource_old. This same typo exists in all 3 places indicating copying and pasting. That may well mean that whatever problem exists has to be fixed in all 3 places. If nothing else, the misnamed variable should have its name corrected for the sake of readability.
          Hide
          Andrew Davis added a comment - - edited

          In mod/resource/locallib.php resource_print_tobemigrated() and resource_print_filenotfound() contain exactly the same code. Code that prints this not migrated error. I dont think thats correct. Probably resource_print_tobemigrated() is meant to be doing something else.

          if we're lucky theres no problem with the file migration and this function is simply outputting the wrong message.

          Show
          Andrew Davis added a comment - - edited In mod/resource/locallib.php resource_print_tobemigrated() and resource_print_filenotfound() contain exactly the same code. Code that prints this not migrated error. I dont think thats correct. Probably resource_print_tobemigrated() is meant to be doing something else. if we're lucky theres no problem with the file migration and this function is simply outputting the wrong message.
          Hide
          Michael de Raadt added a comment -

          Hi, Daniel.

          Thanks for reporting this.

          It would help us if you could add more information, such as screenshots, replication instructions, fix test instructions, a workaround or even a code solution.

          Show
          Michael de Raadt added a comment - Hi, Daniel. Thanks for reporting this. It would help us if you could add more information, such as screenshots, replication instructions, fix test instructions, a workaround or even a code solution.
          Hide
          Daniel Falk added a comment - - edited

          Michael,
          Attached are some screen-shots. These courses have been obtained from the Genesse County ISD in Michigan. Unfortunately I cannot post the specific course but would be willing to work with some one else and give them access to an instance of moodle to see the specific issues.

          The general replication instructions are pretty much just to restore the course from the backup zip file and when you try and click a topic the second screenshot appears. Also Forums / submission forms / exams seem to have migrated correctly.

          Let me know if there is anything else that could be of help.
          -Daniel

          Image of the initial page: http://puu.sh/38St
          Image of the error: http://puu.sh/38Sw
          Image of the legacy files directory: http://puu.sh/38S9

          Show
          Daniel Falk added a comment - - edited Michael, Attached are some screen-shots. These courses have been obtained from the Genesse County ISD in Michigan. Unfortunately I cannot post the specific course but would be willing to work with some one else and give them access to an instance of moodle to see the specific issues. The general replication instructions are pretty much just to restore the course from the backup zip file and when you try and click a topic the second screenshot appears. Also Forums / submission forms / exams seem to have migrated correctly. Let me know if there is anything else that could be of help. -Daniel Image of the initial page: http://puu.sh/38St Image of the error: http://puu.sh/38Sw Image of the legacy files directory: http://puu.sh/38S9
          Hide
          David Mudrak added a comment -

          Daniel, can you please send me the original course backup (without user data) to my email david@moodle.com ? I would analyse it and used for debugging this. Of course I would not provide any part of the course to any 3rd party and would remove it immediately after fixing this.

          If that is not possible, can you please contact me at that email so we could arrange my access to the site to explore details there?

          Show
          David Mudrak added a comment - Daniel, can you please send me the original course backup (without user data) to my email david@moodle.com ? I would analyse it and used for debugging this. Of course I would not provide any part of the course to any 3rd party and would remove it immediately after fixing this. If that is not possible, can you please contact me at that email so we could arrange my access to the site to explore details there?
          Hide
          Daniel Falk added a comment -

          David,
          I just sent you that course.
          -Daniel

          Show
          Daniel Falk added a comment - David, I just sent you that course. -Daniel
          Hide
          David Mudrak added a comment -

          Thanks Daniel for the course. It helped a lot. The issue here is buggy conversion of legacy mod/resource/. In your case, you have a resource in 1.9 of type "Link to a file or URL" with URLs pointing to local course_files area. In moodle.xml such information is then stored as

            <MOD>
              <ID>3226</ID>
              <MODTYPE>resource</MODTYPE>
              <NAME>Blah blah blah</NAME>
              <TYPE>file</TYPE>
              <REFERENCE>$@FILEPHP@$$@SLASH@$flvs$@SLASH@$educator_webdes1_v7_gs$@SLASH@$module5$@SLASH@$lesmo5$@SLASH@$5_04_i.htm</REFERENCE>
              <SUMMARY></SUMMARY>
              <ALLTEXT></ALLTEXT>
              <POPUP></POPUP>
              <OPTIONS></OPTIONS>
              <TIMEMODIFIED>1262756060</TIMEMODIFIED>
            </MOD>
          

          but our current code does not expect @$FILEPHP$@ in the reference field (that is the bug).

          I have this partially fixed on my machine and will continue on that next week. Stay tuned.

          Show
          David Mudrak added a comment - Thanks Daniel for the course. It helped a lot. The issue here is buggy conversion of legacy mod/resource/. In your case, you have a resource in 1.9 of type "Link to a file or URL" with URLs pointing to local course_files area. In moodle.xml such information is then stored as <MOD> <ID>3226</ID> <MODTYPE>resource</MODTYPE> <NAME>Blah blah blah</NAME> <TYPE>file</TYPE> <REFERENCE>$@FILEPHP@$$@SLASH@$flvs$@SLASH@$educator_webdes1_v7_gs$@SLASH@$module5$@SLASH@$lesmo5$@SLASH@$5_04_i.htm</REFERENCE> <SUMMARY></SUMMARY> <ALLTEXT></ALLTEXT> <POPUP></POPUP> <OPTIONS></OPTIONS> <TIMEMODIFIED>1262756060</TIMEMODIFIED> </MOD> but our current code does not expect @$FILEPHP$@ in the reference field (that is the bug). I have this partially fixed on my machine and will continue on that next week. Stay tuned.
          Hide
          David Mudrak added a comment -

          Retriaging and increasing the priority.

          Show
          David Mudrak added a comment - Retriaging and increasing the priority.
          Hide
          David Mudrak added a comment -

          Submitting a patch for integration.

          @Daniel, I am able to restore your course now. Some images in the linked HTML files are not displayed because of the way how they referenced:

          <img src="../../genimage/images/temimage/header.jpg" />
          

          This can't work properly in the restored course because of the changes in File API and the way how Moodle embeds images now.

          Show
          David Mudrak added a comment - Submitting a patch for integration. @Daniel, I am able to restore your course now. Some images in the linked HTML files are not displayed because of the way how they referenced: <img src= "../../genimage/images/temimage/header.jpg" /> This can't work properly in the restored course because of the changes in File API and the way how Moodle embeds images now.
          Hide
          Daniel Falk added a comment -

          David,
          Sounds great. Let me know when the patch is about so I can apply it to my instances. The images I can work on fixing myself. Thanks for all your work.

          Show
          Daniel Falk added a comment - David, Sounds great. Let me know when the patch is about so I can apply it to my instances. The images I can work on fixing myself. Thanks for all your work.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Tested with 1.9 resource having full-path file.php url and embed image and they were perfectly migrated (the html and the image) to resource (file) files. Passed!

          Show
          Eloy Lafuente (stronk7) added a comment - Tested with 1.9 resource having full-path file.php url and embed image and they were perfectly migrated (the html and the image) to resource (file) files. Passed!
          Hide
          Daniel Falk added a comment -

          Since this is integrated... Where would be the best place to pick up the patch for this?

          Show
          Daniel Falk added a comment - Since this is integrated... Where would be the best place to pick up the patch for this?
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Hi Daniel,

          you still will have to wait some hours until this fix, together with the rest, land to our git/cvs servers. Then, you will be able to get the fix from them.

          And < 24h after the fixes are available in the servers, a new battery of packages will be built and available @ download.moodle.org.

          The plan uses to be:

          • EU Wednesday evening: the patches arrive to git/cvs servers
          • EU Thursday morning: the new packages are available @ download.moodle.org

          Ciao

          PS: You will know when the changes have arrived to git/cvs servers because then, and only then, this issue will be closed, so you will receive one email about that.

          Show
          Eloy Lafuente (stronk7) added a comment - Hi Daniel, you still will have to wait some hours until this fix, together with the rest, land to our git/cvs servers. Then, you will be able to get the fix from them. And < 24h after the fixes are available in the servers, a new battery of packages will be built and available @ download.moodle.org. The plan uses to be: EU Wednesday evening: the patches arrive to git/cvs servers EU Thursday morning: the new packages are available @ download.moodle.org Ciao PS: You will know when the changes have arrived to git/cvs servers because then, and only then, this issue will be closed, so you will receive one email about that.
          Hide
          Sam Hemelryk added a comment -

          Congratulations - this fix has just been released in the weeklies.

          Show
          Sam Hemelryk added a comment - Congratulations - this fix has just been released in the weeklies.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: