Moodle
  1. Moodle
  2. MDL-39617

CLI backup script for backing up a single course

    Details

    • Testing Instructions:
      Hide
      1. Find a course you want to backup, note its ID (e.g. 2) and SHORTNAME (e.g. mdlcourse)
      2. Run

        sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=2

      3. Click on Restore in the interface, check that in the course backup area new file has been listed.
      4. Run

        sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=2 --destination=/some/dir

      5. Check that the backup file has been created at /some/dir directory.
      6. Run

        sudo -u www-data /usr/bin/php admin/cli/backup.php --courseshortname=mdlcourse

      7. Click on Restore in the interface, check that in the course backup area new file has been listed.
      Show
      Find a course you want to backup, note its ID (e.g. 2) and SHORTNAME (e.g. mdlcourse) Run sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=2 Click on Restore in the interface, check that in the course backup area new file has been listed. Run sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=2 --destination=/some/dir Check that the backup file has been created at /some/dir directory. Run sudo -u www-data /usr/bin/php admin/cli/backup.php --courseshortname=mdlcourse Click on Restore in the interface, check that in the course backup area new file has been listed.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-39617-master

      Description

      Could be quite useful, especially if you want to backup a huge course and does not want to load the frontend.

        Gliffy Diagrams

          Activity

          Hide
          Rajesh Taneja added a comment -

          Thanks for reporting this and working on it.

          I've put that on the backlog.

          Patch looks good, although you might want to fix:

          1. #L0R77 - Locale string
          2. #L0R93 - Comment should start with capital letter

          It might be nice to enhance script to accept course short name.

          Show
          Rajesh Taneja added a comment - Thanks for reporting this and working on it. I've put that on the backlog. Patch looks good, although you might want to fix: #L0R77 - Locale string #L0R93 - Comment should start with capital letter It might be nice to enhance script to accept course short name.
          Hide
          Ruslan Kabalin added a comment -

          Added shortname parameter support.

          Show
          Ruslan Kabalin added a comment - Added shortname parameter support.
          Hide
          Ruslan Kabalin added a comment -

          Rajesh, none of existing CLI scripts uses localised strings in the output. I would stick to hardcoded option at this stage if you do not mind. CLI is usually run by experienced admins who should not have problems understanding its output.

          Show
          Ruslan Kabalin added a comment - Rajesh, none of existing CLI scripts uses localised strings in the output. I would stick to hardcoded option at this stage if you do not mind. CLI is usually run by experienced admins who should not have problems understanding its output.
          Hide
          CiBoT added a comment -
          Show
          CiBoT added a comment - Results for MDL-39617 Remote repository: https://github.com/lucisgit/moodle.git Remote branch MDL-39617 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/771 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/771/artifact/work/smurf.html
          Hide
          Dan Poltawski added a comment -

          Hi Ruslan,

          Thanks for the patch! Glad that someone finally created a patch for this..

          1. It looks good to me and I agree its OK to not be localised for CLI.
          2. Codechecker has found various minor coding style issues reported above
          3. My only question is whether we should name the script differently to avoid people getting confused with the automated backup script. What do you think?

          cheers,
          Dan

          Show
          Dan Poltawski added a comment - Hi Ruslan, Thanks for the patch! Glad that someone finally created a patch for this.. It looks good to me and I agree its OK to not be localised for CLI. Codechecker has found various minor coding style issues reported above My only question is whether we should name the script differently to avoid people getting confused with the automated backup script. What do you think? cheers, Dan
          Hide
          Ruslan Kabalin added a comment -

          Thanks, Dan, for revision. I fixed the codechecker issues (hopefully). Regarding the name, automated one already has name automated_backups.php, so I think it should not cause confusion with this one.

          Show
          Ruslan Kabalin added a comment - Thanks, Dan, for revision. I fixed the codechecker issues (hopefully). Regarding the name, automated one already has name automated_backups.php, so I think it should not cause confusion with this one.
          Hide
          CiBoT added a comment -
          Show
          CiBoT added a comment - Results for MDL-39617 Remote repository: https://github.com/lucisgit/moodle.git Remote branch MDL-39617 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/889 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/889/artifact/work/smurf.html
          Hide
          Ruslan Kabalin added a comment -

          Sorry CiBoT, fixed that as well.

          Show
          Ruslan Kabalin added a comment - Sorry CiBoT , fixed that as well.
          Hide
          Dan Poltawski added a comment -

          Thanks Ruslan - sending for integration.

          Show
          Dan Poltawski added a comment - Thanks Ruslan - sending for integration.
          Hide
          CiBoT added a comment -

          Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!

          Show
          CiBoT added a comment - Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!
          Hide
          Sam Hemelryk added a comment -

          Thanks Ruslan this has landed now.

          I discussed the location/name of this script with Eloy - really we were unsure which is no reason to delay this.

          Show
          Sam Hemelryk added a comment - Thanks Ruslan this has landed now. I discussed the location/name of this script with Eloy - really we were unsure which is no reason to delay this.
          Hide
          David Monllaó added a comment -

          Before testing it, I'm sure loooots of Univs. will be very happy to hear that this is getting integrated

          Show
          David Monllaó added a comment - Before testing it, I'm sure loooots of Univs. will be very happy to hear that this is getting integrated
          Hide
          David Monllaó added a comment -

          Tested in master. It passes.

          Show
          David Monllaó added a comment - Tested in master. It passes.
          Hide
          Andreu Martí added a comment -

          that's a great issue, indeed!

          Show
          Andreu Martí added a comment - that's a great issue, indeed!
          Hide
          Sam Hemelryk added a comment -

          This weeks weekly release is now available and includes your code.
          A big pat on the back to you again for once more being a cog in the Moodle machine.

          Best wishes, the Moodle integration team.

          Show
          Sam Hemelryk added a comment - This weeks weekly release is now available and includes your code. A big pat on the back to you again for once more being a cog in the Moodle machine. Best wishes, the Moodle integration team.
          Hide
          Mary Cooch added a comment -

          Just housekeeping -removing docs_required label as I added a mention of this in https://docs.moodle.org/en/Course_backup

          Show
          Mary Cooch added a comment - Just housekeeping -removing docs_required label as I added a mention of this in https://docs.moodle.org/en/Course_backup

            People

            • Votes:
              5 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: