Moodle
  1. Moodle
  2. MDL-5145

Running restore twice in immediate succession fails

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: Backup
    • Labels:
      None
    • Environment:
      All
    • Database:
      Any
    • Affected Branches:
      MOODLE_16_STABLE
    • Rank:
      14759

      Description

      To reproduce:

      1. Backup a course.

      2. Restore that course, leaving all options default, until restore is complete and you are at the new site.

      3. Now return to the original course and choose restore, again leaving all options default

      'Error creating sections in the existing course.

      An error has occurred and the restore could not be completed!'

      This error occurs because the restore session was no longer cleared, probably as a result of changes to use required_param etc. I have checked in a fix and tested it works, but somebody who knows the code better might want to take a look. In http://moodle.cvs.sourceforge.net/moodle/moodle/backup/restore_check.html I changed:

      if (isset($restore) and isset($restore_restoreto))

      ($restore_restoreto never was set) to

      if (isset($restore) and isset($_POST['restore_restoreto']))

        Activity

        Hide
        Martin Dougiamas added a comment -

        From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 11 April 2006, 12:49 AM:

        Yep, it seems that the backup/restore process rely partially on the historic pseudo-register-globals that was stripped some days ago. I'll review all the parameters in hours... to use the required_param() and optional_param() mandatory functions completely... instead of using $_POST or similar directly.

        Thanks and ciao

        From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 11 April 2006, 03:17 AM:

        Now, all the variables seem to be working under xxx_param() functions. Also I discovered another bug preventing admins to restore to existing courses caused by the same use of our old pseudo-register-globals. It's working now.

        Anyway I've got the error creating sections when importing one simple course (and it works when being restored). I've created MDL-5148 to handle it.

        Closing this in some hours...

        From Martin Dougiamas (martin at moodle.com) Tuesday, 11 April 2006, 12:04 PM:

        Well, at least removing that globals hack is finding some potential security issues.

        From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 11 April 2006, 03:12 PM:

        Yep! Cool!

        Show
        Martin Dougiamas added a comment - From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 11 April 2006, 12:49 AM: Yep, it seems that the backup/restore process rely partially on the historic pseudo-register-globals that was stripped some days ago. I'll review all the parameters in hours... to use the required_param() and optional_param() mandatory functions completely... instead of using $_POST or similar directly. Thanks and ciao From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 11 April 2006, 03:17 AM: Now, all the variables seem to be working under xxx_param() functions. Also I discovered another bug preventing admins to restore to existing courses caused by the same use of our old pseudo-register-globals. It's working now. Anyway I've got the error creating sections when importing one simple course (and it works when being restored). I've created MDL-5148 to handle it. Closing this in some hours... From Martin Dougiamas (martin at moodle.com) Tuesday, 11 April 2006, 12:04 PM: Well, at least removing that globals hack is finding some potential security issues. From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 11 April 2006, 03:12 PM: Yep! Cool!
        Hide
        Michael Blake added a comment -

        assign to a valid user

        Show
        Michael Blake added a comment - assign to a valid user

          People

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

            Dates

            • Created:
              Updated:
              Resolved: