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

Ignore unknown setting levels during restore instead of throwing exception

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.3, 2.7.3
    • Fix Version/s: 3.0
    • Component/s: Backup
    • Labels:
    • Testing Instructions:
      Hide
      1. Backup a course and download the .mbz file
      2. In the package, edit the file moodle_backup.xml and add the following setting in settings:

              <setting>
                <level>invalid</level>
                <name>unknown</name>
                <value>1</value>
              </setting>
        

      3. Try to restore the backup file on a non-patched Moodle, it should fail with "wrong_setting_level_moodle_backup_xml_file"
      4. On the instance containing the patch, restore the backup file
      5. Confirm the backup was restored successfully, though a debugging message will be displayed informing devs of the invalid setting level.
      Show
      Backup a course and download the .mbz file In the package, edit the file moodle_backup.xml and add the following setting in settings : <setting> <level>invalid</level> <name>unknown</name> <value>1</value> </setting> Try to restore the backup file on a non-patched Moodle, it should fail with "wrong_setting_level_moodle_backup_xml_file" On the instance containing the patch, restore the backup file Confirm the backup was restored successfully, though a debugging message will be displayed informing devs of the invalid setting level.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-36957-master
    • Sprint:
      Team Beards Sprint 5, Team '; drop tables Sprint 6

      Description

      In backup_general_helper::get_backup_information(), it throws the following exception when it encounters an unknown setting level:

      throw new backup_helper_exception('wrong_setting_level_moodle_backup_xml_file', $setting['level']);

      Instead of throwing an error, would it be possible to just ignore the setting and allow the restore to take place? The current design prevents backup portability when the backup has been customized.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                16/Nov/15