Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64532

Create import/restore script

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 3.6.1
    • Backup
    • MOODLE_36_STABLE
    • Hide

      Tests must be done on command line.

      • Restore as new course
        1. Populate a course with content and keep track of its courseid
        2. Create backup of the course by running php admin/cli/backup.php --courseid=<COURSEID> --destination=/tmp
        3. Keep track of the backup file name and location
        4. Restore as new course
          1. php admin/cli/restore.php --from=<BACKUP FILE PATH> --categoryid=1
        5. Verify that a new course is created in the Miscellaneous category
      • Restore in existing course, delete existing content and adding content
        1. Populate a course with content and keep track of its courseid
        2. Create backup of the course by running php admin/cli/backup.php --courseid=<COURSEID> --destination=/tmp
        3. Keep track of the backup file name and location
        4. Find an existing course and keep track of its courseid.
        5. Restore in existing course, overwriting.
          1. php admin/cli/restore.php --from=<BACKUP FILE PATH> --courseid=<COURSEID> --type=delete
        6. Verify that content is restored in course and any existing content in course was deleted
        7. Restore in existing course, adding.
          1. php admin/cli/restore.php --from=<BACKUP FILE PATH> --courseid=<COURSEID> --type=add
        8. Verify that content is restored in course and content is duplicated from previous restore.
      • Import, deleting existing content and adding content
        1. Populate a course with content and keep track of its courseid
        2. Find an existing course and keep track of its courseid.
        3. Import, overwriting
          1. php admin/cli/import.php --from=<SOURCEID> --to=<DESTINATIONID> --type=delete
        4. Verify that content is imported in course and any existing content in course was deleted
        5. Import, adding
          1. php admin/cli/import.php --from=<SOURCEID> --to=<DESTINATIONID> --type=add
        6. Verify that content is restored in course and content is duplicated from previous import.

       

      Show
      Tests must be done on command line. Restore as new course Populate a course with content and keep track of its courseid Create backup of the course by running php admin/cli/backup.php --courseid=<COURSEID> --destination=/tmp Keep track of the backup file name and location Restore as new course php admin/cli/restore.php --from=<BACKUP FILE PATH> --categoryid=1 Verify that a new course is created in the Miscellaneous category Restore in existing course, delete existing content and adding content Populate a course with content and keep track of its courseid Create backup of the course by running php admin/cli/backup.php --courseid=<COURSEID> --destination=/tmp Keep track of the backup file name and location Find an existing course and keep track of its courseid. Restore in existing course, overwriting. php admin/cli/restore.php --from=<BACKUP FILE PATH> --courseid=<COURSEID> --type=delete Verify that content is restored in course and any existing content in course was deleted Restore in existing course, adding. php admin/cli/restore.php --from=<BACKUP FILE PATH> --courseid=<COURSEID> --type=add Verify that content is restored in course and content is duplicated from previous restore. Import, deleting existing content and adding content Populate a course with content and keep track of its courseid Find an existing course and keep track of its courseid. Import, overwriting php admin/cli/import.php --from=<SOURCEID> --to=<DESTINATIONID> --type=delete Verify that content is imported in course and any existing content in course was deleted Import, adding php admin/cli/import.php --from=<SOURCEID> --to=<DESTINATIONID> --type=add Verify that content is restored in course and content is duplicated from previous import.  

      Currently there is a backup script that can be used by admins to backup a given course: https://github.com/moodle/moodle/blob/master/admin/cli/backup.php

      But there is no analogous script to restore a backup file via command line.

      I think it would help admins to have such a script as part of core Moodle.

      The moosh utility by tmuras has such a feature to do course restores: https://github.com/tmuras/moosh/blob/master/Moosh/Command/Moodle33/Course/CourseRestore.php

      Can we get this type of functionality into core Moodle? 

      This would help for large backups that take 1 hour+ to perform.

            Unassigned Unassigned
            rex Rex Lorenzo
            Luca Bösch Luca Bösch
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours
                3h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.