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

Configurable default backup file names

    • MOODLE_500_STABLE
    • mdl-84440-main
    • Hide

      Gui test

      1. Navigate to /admin/settings.php?section=backupgeneralsettings
      2. Set the config  "backup_default_filename_template_course" to be

        {{course.shortname}}-{{course.fullname}}-{{course.startdate}}-{{course.enddate}}

      1. Set the config "backup_default_filename_template_section" to be 

        {{section.name}}-{{section.section}}

      1. Set the config "backup_default_filename_template_activity" to be 

        {{activity.name}}-{{activity.modname}}

      1. Make a test course:
        1. Size: XS
        2. Shortname: ABC
        3. Fullname: XYZ
      2. View the course just created
      3. Select More -> Course reuse -> Backup
      4. Click next button twice
      5. Confirm the default filename is `ABC-XYZ-2025xxxx-0000-19700101-0100` where xxxx is the mmdd month / day
      6. Go back to course
      7. Select the default "Assignment 1" activity that is already created
      8. Select More -> Backup
      9. Click next button twice
      10. Confirm the default filename is `Assignment_1-assign.mbz`
      11. Go back to course, ensure editing mode is enabled
      12. Hover on the 2nd Section name and use the pencil/edit button and edit the name to be "Section 1"
      13. Turn off editing mode
      14. Hover over the name, and note down the section id from the link being hovered
      15. Note down the course id from the current course url
      16. Go to 

        /backup/backup.php?id=COURSEID&section=SECTIONID

      17. Click next twice
      18. Confirm the default filename is `Section_1-1.mbz`

      Validation test

      1. Navigate to /admin/settings.php?section=backupgeneralsettings
      2. For each of the following settings, enter "{{" and press save, and verify it gives you a validation error
        1. backup_default_filename_template_course
        2. backup_default_filename_template_section
        3. backup_default_filename_template_activity
      Show
      Gui test Navigate to /admin/settings.php?section=backupgeneralsettings Set the config  "backup_default_filename_template_course" to be {{course.shortname}}-{{course.fullname}}-{{course.startdate}}-{{course.enddate}} Set the config "backup_default_filename_template_section" to be  {{section.name}}-{{section.section}} Set the config "backup_default_filename_template_activity" to be  {{activity.name}}-{{activity.modname}} Make a test course: Size: XS Shortname: ABC Fullname: XYZ View the course just created Select More -> Course reuse -> Backup Click next button twice Confirm the default filename is `ABC-XYZ-2025xxxx-0000-19700101-0100` where xxxx is the mmdd month / day Go back to course Select the default "Assignment 1" activity that is already created Select More -> Backup Click next button twice Confirm the default filename is `Assignment_1-assign.mbz` Go back to course, ensure editing mode is enabled Hover on the 2nd Section name and use the pencil/edit button and edit the name to be "Section 1" Turn off editing mode Hover over the name, and note down the section id from the link being hovered Note down the course id from the current course url Go to  /backup/backup.php?id=COURSEID&section=SECTIONID Click next twice Confirm the default filename is `Section_1-1.mbz` Validation test Navigate to /admin/settings.php?section=backupgeneralsettings For each of the following settings, enter "{{" and press save, and verify it gives you a validation error backup_default_filename_template_course backup_default_filename_template_section backup_default_filename_template_activity
    • Hide

      Code verified against automated checks.

      Checked MDL-84440 using repository: https://github.com/matthewhilton/moodle

      More information about this report

      Built on: Sun May 18 23:07:02 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-84440 using repository: https://github.com/matthewhilton/moodle main (0 errors / 0 warnings) [branch: mdl-84440-main | CI Job ] More information about this report Built on: Sun May 18 23:07:02 UTC 2025
    • Show
      Launching automatic jobs for branch mdl-84440-main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18935/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64802/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64803/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64804/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64805/ App tests (stable app version) Built on: Mon Apr 7 00:25:34 UTC 2025

      Big institutions have data archiving processes which include backups of Moodle courses. As part of that, it's important that the backups have naming schemes that align with their archiving process.

      I'm proposing the idea of a config setting that defines a backup naming scheme, e.g:

      {{courseShortName}}-{{courseID}}-{{courseStartDate}}.mbz

      Where the placeholders are replaced with their values.

      Some thoughts & constraints:

      • could be mustache, would allow for more complex if/else statements when constructing.
      • must be <= 255 chars at end (db column limit)
      • Should always be run through clean_filename
      • ideally maintain current structure as the default

            matthewhilton Matthew Hilton
            matthewhilton Matthew Hilton
            Peter Burnett Peter Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:

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