Moodle
  1. Moodle
  2. MDL-29626

Course Restore does not keep URLs in resources when URLs are Moodle courses in the same installation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.13
    • Fix Version/s: 1.9.15
    • Component/s: Backup
    • Labels:
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1) Create one 1.9 site with 2 courses, A and B
      2) In course B create one resource (web page), with 2 links, one pointing to course A main page and another pointing to course B main page.
      3) Backup course B
      4) Restore the backup into new course (let's call it C).
      5) TEST: The original link to course A is unmodified and continues pointing to course A.
      6) TEST: The original link to course B has been modified and now points to course C.

      Show
      1) Create one 1.9 site with 2 courses, A and B 2) In course B create one resource (web page), with 2 links, one pointing to course A main page and another pointing to course B main page. 3) Backup course B 4) Restore the backup into new course (let's call it C). 5) TEST: The original link to course A is unmodified and continues pointing to course A. 6) TEST: The original link to course B has been modified and now points to course C.
    • Workaround:
      Hide

      None to my knowledge, except manually re-assigning links.

      Show
      None to my knowledge, except manually re-assigning links.
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Pull from Repository:
    • Rank:
      19139

      Description

      Affect version: Moodle 1.9.13+ (Build: 20110928)

      To reproduce:
      1. create a Moodle course "A"
      2. create a couple of meta courses "M1" and "M2" and enroll course "A" in the two meta courses
      3. now in course "A", add two resources "Link to file or web site", pointing to the Moodle URLs of the two courses "M1" and "M2". (for example, http://www.yourdomain.tld/course/view.php?id=XX)
      4. verify you can access the correct link (ak, course M1 and M2) using the resources
      5. now backup and restore the course "A" in a new course "B", in the same site.
      6. in the newly created course "B", check the resources pointing to the course M1 and M2: resource links are now broken and points to the home page of course "B".

      This issue may be related to MDL-26831

        Activity

        Hide
        Eloy Lafuente (stronk7) added a comment -

        Oki, so I've made this to mimic the behavior of restore with all the rest of interlinks:

        1) If restoring to new course
        2) If there are links to "self" course page, change them to the new course id
        3) Rest of cases, leave the link unmodified. Will continue pointing to the same place it was in the original course.

        So I think this will solve your problem above, although I'm sure that such behavior has other problems (like restoring to existing course, for example). But I think it's something we are not going to fix globally for 19_STABLE at all.

        So, sending this for integration with the (standard) behavior applied. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Oki, so I've made this to mimic the behavior of restore with all the rest of interlinks: 1) If restoring to new course 2) If there are links to "self" course page, change them to the new course id 3) Rest of cases, leave the link unmodified. Will continue pointing to the same place it was in the original course. So I think this will solve your problem above, although I'm sure that such behavior has other problems (like restoring to existing course, for example). But I think it's something we are not going to fix globally for 19_STABLE at all. So, sending this for integration with the (standard) behavior applied. Ciao
        Hide
        Sam Hemelryk added a comment -

        Thanks Eloy this has been integrated now

        Show
        Sam Hemelryk added a comment - Thanks Eloy this has been integrated now
        Hide
        Ankit Agarwal added a comment -

        Works as expected!
        Test passed
        Thanks

        Show
        Ankit Agarwal added a comment - Works as expected! Test passed Thanks
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Many thanks for all the hard work. This is now part of Moodle, your favorite LMS.

        Closing as fixed, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Many thanks for all the hard work. This is now part of Moodle, your favorite LMS. Closing as fixed, ciao
        Hide
        Bonnie Mioduchoski added a comment -

        Hi, I am in Moodle 2.43. We have links in a lesson to course activities. We did not create these links; they appeared just by typing the exact name of the resource. When I create a new course and import activities it keeps the links for the old course. Is there any way to have it point to the link in the current course without doing it manually for each? It's similar to this issue MDL 24-344 which was closed:

        "A link to a resource within a course results in a link that points back to the original course after backup and restore.

        Steps to reproduce:

        1) Create a course. Using "Topics Format" in this example

        2) Add, say, a Label to a course section. Create a link to a resource within a course. For example, link to another topic within the course. That type of link looks like this: http://demo.mroomstest.net/course/view.php?id=26&topic=2

        3) Create a course backup. Pick all the default options.

        4) Restore the course backup to a new course

        5) If you have pasted in the full link for the resource, the resulting link points back to the original course id. Which is actually "broken" in the context of the newly created course, since you want the new course to have the link to the resource within its own confines.

        This list of steps also affects links to images when added to a course label in this way.

        Actual Result

        Course resources in the restored course point to the original course.

        Expected Result

        Course resources in the restored course point to the new course."

        Show
        Bonnie Mioduchoski added a comment - Hi, I am in Moodle 2.43. We have links in a lesson to course activities. We did not create these links; they appeared just by typing the exact name of the resource. When I create a new course and import activities it keeps the links for the old course. Is there any way to have it point to the link in the current course without doing it manually for each? It's similar to this issue MDL 24-344 which was closed: "A link to a resource within a course results in a link that points back to the original course after backup and restore. Steps to reproduce: 1) Create a course. Using "Topics Format" in this example 2) Add, say, a Label to a course section. Create a link to a resource within a course. For example, link to another topic within the course. That type of link looks like this: http://demo.mroomstest.net/course/view.php?id=26&topic=2 3) Create a course backup. Pick all the default options. 4) Restore the course backup to a new course 5) If you have pasted in the full link for the resource, the resulting link points back to the original course id. Which is actually "broken" in the context of the newly created course, since you want the new course to have the link to the resource within its own confines. This list of steps also affects links to images when added to a course label in this way. Actual Result Course resources in the restored course point to the original course. Expected Result Course resources in the restored course point to the new course."

          People

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

            Dates

            • Created:
              Updated:
              Resolved: