Moodle
  1. Moodle
  2. MDL-22176

Backup/Restore does not change manually added links to the same course

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.8
    • Fix Version/s: 1.9.9
    • Component/s: Backup
    • Labels:
      None
    • Environment:
      n/a
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      16533

      Description

      I'm creating a site with simple navigation for early elementary students. Each course is to be set up so that students see a number of large icons under topic 1. Each icon links to a new topic (which in turn has a "back" button to topic 1. Only one topic is to be visible at a time (initially topic 1)

      So course links such as http://mysite.edu/course/view.php?id=34&topic=1, http://mysite.edu/course/view.php?id=34&topic=2, http://mysite.edu/course/view.php?id=34&topic=etc. are used extensively throughout the course. Works fine ... But I want to be able to clone the course for multiple teacher/grade scenarios. ... so, when I backup and restore to another course (say id=35), all of the links remain pointing to id=34. I'm creating these linked icons using labels, but a test of a the same html in a course webpage also failed to change the urls.

      Can the core code be modified (or a fix be provided) to allow for the conversion of all urls (that point to course A ) when it is restored to course B, C, etc.?

      As Eloy stated in http://moodle.org/mod/forum/discuss.php?d=148686, it would be great to have some filter doing that work, exactly like the "Activity Names" filter does, but working on sections.

      1. topic2.txt
        3 kB
        Larry M Elchuck, Ph.D.

        Activity

        Hide
        Eloy Lafuente (stronk7) added a comment - - edited

        Hi Larry,

        this should be considered fixed right now!

        So any link like:

        htttp://yoursite/yourmoodle/course/view.php?id=XX

        is transformed automatically to the new course id (note this includes also links having the "&topic=YY" and "&week=ZZ", suffixes that don't get transformed at all).

        As somehow related with this, I've created MDL-22179, because this needs to be also implemented in Moodle 2.0 restore (work in progress).

        Resolving this as fixed, if you find anything not working as expected, plz, comment here. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - - edited Hi Larry, this should be considered fixed right now! So any link like: htttp://yoursite/yourmoodle/course/view.php?id=XX is transformed automatically to the new course id (note this includes also links having the "&topic=YY" and "&week=ZZ", suffixes that don't get transformed at all). As somehow related with this, I've created MDL-22179 , because this needs to be also implemented in Moodle 2.0 restore (work in progress). Resolving this as fixed, if you find anything not working as expected, plz, comment here. Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        PS: Will be available in next weekly build (or by direct access to CVS).

        Show
        Eloy Lafuente (stronk7) added a comment - PS: Will be available in next weekly build (or by direct access to CVS).
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        Boy ... that was quick ..

        Performed a CVS update and erros like the following occurred:
        ------------

        For http://myserver.edu/course/view?id=38&topic=2

        The requested URL /course/view was not found on this server.
        -----------

        Instead of http://myserver.edu/course/view.php?id=34&topic=20 the following link appears (as a sample)

        http://myserver.edu/course/$@COURSEVIEWBYID*34@$&topic=20
        ========
        resulting in

        The requested URL /course/$@COURSEVIEWBYID*34@$&topic=1 was not found on this server.

        thanks
        larry

        Show
        Larry M Elchuck, Ph.D. added a comment - Boy ... that was quick .. Performed a CVS update and erros like the following occurred: ------------ For http://myserver.edu/course/view?id=38&topic=2 The requested URL /course/view was not found on this server. ----------- Instead of http://myserver.edu/course/view.php?id=34&topic=20 the following link appears (as a sample) http://myserver.edu/course/$@COURSEVIEWBYID*34@$&topic=20 ======== resulting in The requested URL /course/$@COURSEVIEWBYID*34@$&topic=1 was not found on this server. thanks larry
        Hide
        Eloy Lafuente (stronk7) added a comment -

        uhm... so encoding is working ok there (backup) but not decoding (restore). Strange as far as I've both working ok here. Can you tell me the version (1st line) of your restorelib.php file? And then look for "COURSEVIEWBYID" in that file and tell me if it's there? Just guessing you aren't running the last version.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - uhm... so encoding is working ok there (backup) but not decoding (restore). Strange as far as I've both working ok here. Can you tell me the version (1st line) of your restorelib.php file? And then look for "COURSEVIEWBYID" in that file and tell me if it's there? Just guessing you aren't running the last version. Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        crap! "view" ! without the .php extension! And why is it working here! Let me check...

        Show
        Eloy Lafuente (stronk7) added a comment - crap! "view" ! without the .php extension! And why is it working here! Let me check...
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Absolutely incredible! I've this contents in my RESTORED course, once de decoding has happened (I used it to test that both course and course+topic links were working):

        This is section 0 summary
        <br />
        This is link to course:
        <br />
        http://127.0.0.1/~stronk7/moodle_19/course/view?id=10
        <br />
        <a href="http://127.0.0.1/~stronk7/moodle_19/course/view?id=10">this too</a>
        <br />
        This is link to topic 2:
        <br />
        http://127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=2
        <br />
        <a href="http://127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=2">this too</a>
        <br />
        This is link to topic 4:
        <br />
        http://127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=4
        <br />
        <a href="http://127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=4">this too</a>
        

        ... and, as you can see, the ".php" is missing too. But, crazy, those links work here perfectly, and I get the sections collapsed properly, so I wasn't able to detect the problem. Sure I've some default extension or something else configured here, grrr...

        Oki, fixing, re-testing and committing, thanks for feedback! Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Absolutely incredible! I've this contents in my RESTORED course, once de decoding has happened (I used it to test that both course and course+topic links were working): This is section 0 summary <br /> This is link to course: <br /> http: //127.0.0.1/~stronk7/moodle_19/course/view?id=10 <br /> <a href= "http: //127.0.0.1/~stronk7/moodle_19/course/view?id=10" > this too</a> <br /> This is link to topic 2: <br /> http: //127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=2 <br /> <a href= "http: //127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=2" > this too</a> <br /> This is link to topic 4: <br /> http: //127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=4 <br /> <a href= "http: //127.0.0.1/~stronk7/moodle_19/course/view?id=10&topic=4" > this too</a> ... and, as you can see, the ".php" is missing too. But, crazy, those links work here perfectly, and I get the sections collapsed properly, so I wasn't able to detect the problem. Sure I've some default extension or something else configured here, grrr... Oki, fixing, re-testing and committing, thanks for feedback! Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Done, I just added the missing ".php" extension to the URL on restore. Can you check if it's working ok there? Here it's but, you know, that's not a goo test :-P

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Done, I just added the missing ".php" extension to the URL on restore. Can you check if it's working ok there? Here it's but, you know, that's not a goo test :-P Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        wow... i'm not able to understand why those urls: "/course/view?id=10" and friends are working here. Dark magic or so. Who knows!

        Show
        Eloy Lafuente (stronk7) added a comment - wow... i'm not able to understand why those urls: "/course/view?id=10" and friends are working here. Dark magic or so. Who knows!
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        Hi Eloy

        Sorry for the delay in responsding ... was out of the office for a bit

        Weird ... in my restored course, the links in Topic 1 work ok but the links in topics 2+ do not

        From Topic 1 label link:

        http://myserver.edu/course/view.php?id=39&topic=2

        works fine

        ===============

        From topic 2 label link:

        http://myserver.edu/course/$@COURSEVIEWBYID*34@$&topic=7

        It still points back to the backed up course (34) and has the code as per above

        Show
        Larry M Elchuck, Ph.D. added a comment - Hi Eloy Sorry for the delay in responsding ... was out of the office for a bit Weird ... in my restored course, the links in Topic 1 work ok but the links in topics 2+ do not From Topic 1 label link: http://myserver.edu/course/view.php?id=39&topic=2 works fine =============== From topic 2 label link: http://myserver.edu/course/$@COURSEVIEWBYID*34@$&topic=7 It still points back to the backed up course (34) and has the code as per above
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Weird, as I pasted above I get all the links converted on restore. Uhm, can you plz, attach the complete section0 text (that containing all the text with all the links). Both at origin and after restore? Plz don't paste it (as far as te tracker can end changing some characters. Attach them to one file.

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Weird, as I pasted above I get all the links converted on restore. Uhm, can you plz, attach the complete section0 text (that containing all the text with all the links). Both at origin and after restore? Plz don't paste it (as far as te tracker can end changing some characters. Attach them to one file. TIA and ciao
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        Here it is Eloy

        Shows as weird text on mouse over

        larry

        Show
        Larry M Elchuck, Ph.D. added a comment - Here it is Eloy Shows as weird text on mouse over larry
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        Are you ready for this, Eloy?

        I do a backup and restore and only the first topic links work properly using the current CVS-updated files
        The others have links that appear with course/$@COURSEVIEWBYID*34@$&topic=7

        I go in and look at the html code of (say) the topic 2 label images ... All looks ok
        I save and display
        Now all of the links in Topic 2, 3, 4, 5 and 6 work fine (eg. /course/view.php?id=40&topic=7

        Why would re-saving one label's html fix the links for all others (even on different labels in different topics?

        larry

        Show
        Larry M Elchuck, Ph.D. added a comment - Are you ready for this, Eloy? I do a backup and restore and only the first topic links work properly using the current CVS-updated files The others have links that appear with course/$@COURSEVIEWBYID*34@$&topic=7 I go in and look at the html code of (say) the topic 2 label images ... All looks ok I save and display Now all of the links in Topic 2, 3, 4, 5 and 6 work fine (eg. /course/view.php?id=40&topic=7 Why would re-saving one label's html fix the links for all others (even on different labels in different topics? larry
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Uhm... it sounds like some sort of text-caching happening. Perhaps it was one coincidence that, at the time of editing your topic 2 contents, just the cache expired and all the rest of topic contents (section 3, 4, 5...) were also cleaned (as far as they were created at the same time (first course display), they have the same ttl in cache.

        Just to be sure... can you go to Admin->Filters and disable caching completely?

        Then, restore the course again and see how the links look like. Could have sense.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Uhm... it sounds like some sort of text-caching happening. Perhaps it was one coincidence that, at the time of editing your topic 2 contents, just the cache expired and all the rest of topic contents (section 3, 4, 5...) were also cleaned (as far as they were created at the same time (first course display), they have the same ttl in cache. Just to be sure... can you go to Admin->Filters and disable caching completely? Then, restore the course again and see how the links look like. Could have sense. Ciao
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        Good Day Eloy

        I backed up once / restored twice before the change in filter setting and backed up once / restored once after the change in filter setting ... same result

        The opening of one label in the html-editor and saving (in GUI-mode) made all normal

        I'm using a themezilla theme ... that would have no bearing, I assume

        larry

        Show
        Larry M Elchuck, Ph.D. added a comment - Good Day Eloy I backed up once / restored twice before the change in filter setting and backed up once / restored once after the change in filter setting ... same result The opening of one label in the html-editor and saving (in GUI-mode) made all normal I'm using a themezilla theme ... that would have no bearing, I assume larry
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        Not theme related - same with standard theme

        Show
        Larry M Elchuck, Ph.D. added a comment - Not theme related - same with standard theme
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        I can pm you an admin user/pass if you think that would help

        L

        Show
        Larry M Elchuck, Ph.D. added a comment - I can pm you an admin user/pass if you think that would help L
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Just to be 100%, when you say "label", you are talking about the section "intro", correct? Not one "label "resource.

        When you changed the filter... did you set it to 0 (no cache at all) ? Finally, the last think I can imagine is that you are restoring always on the same course (id = 39) and then one browser caching is happening.

        Can you try the restore once again and, if you get the COURSEVIEWBYID text, just try forcing refresh in the browser to see if it disappears... I say this because the "effect" you are describing (editing one section intro fixes all the sections), hasn't sense at all but if you are viewing cached info. Please CTRL, SHIFT, ALT F5 (or whatever is necessary in your browser to force refresh).

        Uhm, I'm sure it's working ok in all sections (like in your section 0 attached). Nothing differentiates it from the rest. About l/p, can be interesting, but first do the last restore + refresh, plz.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Just to be 100%, when you say "label", you are talking about the section "intro", correct? Not one "label "resource. When you changed the filter... did you set it to 0 (no cache at all) ? Finally, the last think I can imagine is that you are restoring always on the same course (id = 39) and then one browser caching is happening. Can you try the restore once again and, if you get the COURSEVIEWBYID text, just try forcing refresh in the browser to see if it disappears... I say this because the "effect" you are describing (editing one section intro fixes all the sections), hasn't sense at all but if you are viewing cached info. Please CTRL, SHIFT, ALT F5 (or whatever is necessary in your browser to force refresh). Uhm, I'm sure it's working ok in all sections (like in your section 0 attached). Nothing differentiates it from the rest. About l/p, can be interesting, but first do the last restore + refresh, plz. Ciao
        Hide
        Larry M Elchuck, Ph.D. added a comment -

        Hi Eloy

        Sorry for the late response ... do not recall getting a confirmation of your last posting to the thread 2 days ago!


        Re: Just to be 100%, when you say "label", you are talking about the section "intro", correct? Not one "label "resource.

        I was talking about the Topic label (the one that appears in the "Jump to" pulldown, when you are viewing one topic at a time (for Topic 2, 3, 4, etc.)


        Re: When you changed the filter... did you set it to 0 (no cache at all)?

        I set text cache lifetime (cachetext) to No


        Re: Finally, the last think I can imagine is that you are restoring always on the same course (id = 39) and then one browser caching is happening.
        Can you try the restore once again and, if you get the COURSEVIEWBYID text, just try forcing refresh in the browser to see if it disappears... I say this because the "effect" you are describing (editing one section intro fixes all the sections), hasn't sense at all but if you are viewing cached info. Please CTRL, SHIFT, ALT F5 (or whatever is necessary in your browser to force refresh).

        I just backed-up course id=44 (to id=45) and the same occurred- Cleared the cache in Firefox - still shows COURSEVIEWBYID

        • Tried in Safari - still shows COURSEVIEWBYID

        ------

        Re: Uhm, I'm sure it's working ok in all sections (like in your section 0 attached). Nothing differentiates it from the rest. About l/p, can be interesting, but first do the last restore + refresh, plz.

        Again opening and saving one of the topic lead labels (eg. course/modedit.php?update=648&return=0) all is corrected.

        cheers
        L

        Show
        Larry M Elchuck, Ph.D. added a comment - Hi Eloy Sorry for the late response ... do not recall getting a confirmation of your last posting to the thread 2 days ago! Re: Just to be 100%, when you say "label", you are talking about the section "intro", correct? Not one "label "resource. I was talking about the Topic label (the one that appears in the "Jump to" pulldown, when you are viewing one topic at a time (for Topic 2, 3, 4, etc.) Re: When you changed the filter... did you set it to 0 (no cache at all)? I set text cache lifetime (cachetext) to No Re: Finally, the last think I can imagine is that you are restoring always on the same course (id = 39) and then one browser caching is happening. Can you try the restore once again and, if you get the COURSEVIEWBYID text, just try forcing refresh in the browser to see if it disappears... I say this because the "effect" you are describing (editing one section intro fixes all the sections), hasn't sense at all but if you are viewing cached info. Please CTRL, SHIFT, ALT F5 (or whatever is necessary in your browser to force refresh). I just backed-up course id=44 (to id=45) and the same occurred- Cleared the cache in Firefox - still shows COURSEVIEWBYID Tried in Safari - still shows COURSEVIEWBYID ------ Re: Uhm, I'm sure it's working ok in all sections (like in your section 0 attached). Nothing differentiates it from the rest. About l/p, can be interesting, but first do the last restore + refresh, plz. Again opening and saving one of the topic lead labels (eg. course/modedit.php?update=648&return=0) all is corrected. cheers L

          People

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

            Dates

            • Created:
              Updated:
              Resolved: