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

admin/cli/restore.php addition for single/bulk Course restore

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 3.8, 3.9, STABLE backlog
    • Backup
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • Easy
    • Hide

      Test 1:

      1. Run php admin/cli/backup.php --courseid=chosen_course_id --destination=/tmp/new_existing_empty_folder
      2. Make any changes to Course with chosen_course_id through moodle ui
      3. Run php admin/cli/restore.php --courseid=chosen_course_id1 --source=/tmp/existing_empty_folder/generated_name_backup1.mbz
      4. VERIFY that the course is restored and overwriten
        Test 2:
      5. Run php admin/cli/backup.php --courseid=chosen_course_id2_from_same_category_as_course_id1 --destination=/tmp/existing_empty_folder
      6. Make any changes to both Courses 1 and 2 from same Category that were backed up.
      7. Run php admin/cli/restore.php --source=/tmp/same_existing_empty_folder --categoryid=Same_category_id
      8. VERIFY that both Courses were restored sequentially and overwriten with same Full and Short names
        Test 3:
      9. Run php admin/cli/restore.php --categoryid=Same_category_id --courseshortname=newshortname --source=/tmp/existing_empty_folder/generated_name_backup1.mbz
      10. VERIFY that Course 1 is restored with newshortname in Same Category with original Fullname
        Test 4:
      11. Create 4 Courses and back them up using backup.php to destination folder.
      12. Delete the two of them
      13. Run php admin/cli/restore.php --categoryid=Same_category_id --source=backup_destination_folder --create
      14. VERIFY that only the two ones that were deleted get restored.
      15. Delete those two Courses again
      16. Run php admin/cli/restore.php --categoryid=Same_category_id --source=backup_destination_folder --reset
      17. VERIFY that the existing ones get overwriten and no others get restored.
        Test 5:
      18. Run same tests using different restore modes adding option --mode=general (default)/import/hub/samesite
      Show
      Test 1: Run php admin/cli/backup.php --courseid=chosen_course_id --destination=/tmp/new_existing_empty_folder Make any changes to Course with chosen_course_id through moodle ui Run php admin/cli/restore.php --courseid=chosen_course_id1 --source=/tmp/existing_empty_folder/generated_name_backup1.mbz VERIFY that the course is restored and overwriten Test 2: Run php admin/cli/backup.php --courseid=chosen_course_id2_from_same_category_as_course_id1 --destination=/tmp/existing_empty_folder Make any changes to both Courses 1 and 2 from same Category that were backed up. Run php admin/cli/restore.php --source=/tmp/same_existing_empty_folder --categoryid=Same_category_id VERIFY that both Courses were restored sequentially and overwriten with same Full and Short names Test 3: Run php admin/cli/restore.php --categoryid=Same_category_id --courseshortname=newshortname --source=/tmp/existing_empty_folder/generated_name_backup1.mbz VERIFY that Course 1 is restored with newshortname in Same Category with original Fullname Test 4: Create 4 Courses and back them up using backup.php to destination folder. Delete the two of them Run php admin/cli/restore.php --categoryid=Same_category_id --source=backup_destination_folder --create VERIFY that only the two ones that were deleted get restored. Delete those two Courses again Run php admin/cli/restore.php --categoryid=Same_category_id --source=backup_destination_folder --reset VERIFY that the existing ones get overwriten and no others get restored. Test 5: Run same tests using different restore modes adding option --mode=general (default)/import/hub/samesite
    • Small

      Although a cli/admin/backup.php script is available for Course backup to specific destination, there is no relative admin/cli/restore.php to reverse the action.

      Thus I thought it was a nice idea to create one, as close as possible to the options provided by the existing backup.php

      I have created a branch for this in my repository.

      It can restore either a specific course from a single .mbz source or an entire category from a source directory containing multiple .mbz files.

      I did test it on 3.8 but I think it will work without problem on any version because it uses only moodle api's

      It is discussed in forum here

      Regards,

      Lazaros

       

            Unassigned Unassigned
            lazarosfs Lazaros Sotiriadis
            Ferran Recio Ferran Recio
            Votes:
            20 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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