Moodle
  1. Moodle
  2. MDL-28657

Moodle Backup (Automated Backup File Names)

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1. Turn on automated backups.
      2. Make sure "Use course name in backup filename" is set to "No" (default).
      3. Create a new course (Course A).
      4. Manually run automated backups. Verify that the backup filename for Course A uses the id.
      5. Change the "Use course name in backup filename" setting to "Yes."
      6. Create a new course (Course B).
      7. Manually run automated backups. Verify that the backup filename for Course B uses the shortname.

      Show
      1. Turn on automated backups. 2. Make sure "Use course name in backup filename" is set to "No" (default). 3. Create a new course (Course A). 4. Manually run automated backups. Verify that the backup filename for Course A uses the id. 5. Change the "Use course name in backup filename" setting to "Yes." 6. Create a new course (Course B). 7. Manually run automated backups. Verify that the backup filename for Course B uses the shortname.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-28657-master
    • Rank:
      18315

      Description

      When backups are created automatically in Moodle 2.1, the files created are named:

      rw-rw-rw- 1 root root 27609 Aug 8 00:45 backup-moodle2-course-530-20110808-0045.mbz
      rw-rw-rw 1 root root 30671 Aug 8 00:45 backup-moodle2-course-541-20110808-0045.mbz
      rw-rw-rw 1 root root 243078 Aug 8 10:46 backup-moodle2-course-542-20110808-1046.mbz
      rw-rw-rw 1 root root 22009102 Aug 8 13:01 backup-moodle2-course-542-20110808-1301.mbz

      These names do not help us to locate a backup to restore from tape or allow a user to quickly find the backup they need when looking at the back end.

      Can you tell me where I can hack the code to change these file names to reflect the course short name?

        Issue Links

          Activity

          Hide
          Stuart R Mealor added a comment -

          Having just had to rebuild a site using file backups I can confirm that have a Course ID rather than the short course name makes it a lot more difficult!
          (I noticed that the manual backups DO get the short course name, so it seems clear that the automated backups should also have this, and suggests it should be a relatively simple change?)
          PS - what does the Label "triaged' means in this tracker item?

          Show
          Stuart R Mealor added a comment - Having just had to rebuild a site using file backups I can confirm that have a Course ID rather than the short course name makes it a lot more difficult! (I noticed that the manual backups DO get the short course name, so it seems clear that the automated backups should also have this, and suggests it should be a relatively simple change?) PS - what does the Label "triaged' means in this tracker item?
          Hide
          Melinda Kraft added a comment -

          We backup all of our sites as a service for our course instructors and we restore them on request. In all our prior versions of Moodle (we've been using it for 7 years), this was really easy to do because course short names are in the file name. This new file naming convention is really complicating the issue! Please fix the file naming convention, or at least give us the option to choose. As it is now, I have to log into the data table and export a list as a spreadsheet for cross referencing which is time consuming.

          Show
          Melinda Kraft added a comment - We backup all of our sites as a service for our course instructors and we restore them on request. In all our prior versions of Moodle (we've been using it for 7 years), this was really easy to do because course short names are in the file name. This new file naming convention is really complicating the issue! Please fix the file naming convention, or at least give us the option to choose. As it is now, I have to log into the data table and export a list as a spreadsheet for cross referencing which is time consuming.
          Hide
          Adam Lipkin added a comment -

          We're in the exact same issue as Melinda. There shouldn't be a need to cross-reference names when looking for courses to restore.

          Show
          Adam Lipkin added a comment - We're in the exact same issue as Melinda. There shouldn't be a need to cross-reference names when looking for courses to restore.
          Hide
          Charles Fulton added a comment -

          I've written up a short patch to make this behavior site-configurable; the default is still to use the id. I don't see that there's much danger from bad filenames; shortname still gets passed through clean_filename() which ought to be sufficient protection.

          Show
          Charles Fulton added a comment - I've written up a short patch to make this behavior site-configurable; the default is still to use the id. I don't see that there's much danger from bad filenames; shortname still gets passed through clean_filename() which ought to be sufficient protection.
          Hide
          Brent Lee added a comment -

          Can someone update us on this issue? I see it is becoming more and more of a problem for my site administrators.

          Show
          Brent Lee added a comment - Can someone update us on this issue? I see it is becoming more and more of a problem for my site administrators.
          Hide
          Carlos Sánchez-Martín added a comment -

          Just a short comment... I see that the database listed is MySQL. This also happens with MS-SQL. Eloy, thank you for taking this assignment. It would really help to have it fixed!

          Show
          Carlos Sánchez-Martín added a comment - Just a short comment... I see that the database listed is MySQL. This also happens with MS-SQL. Eloy, thank you for taking this assignment. It would really help to have it fixed!
          Hide
          Brent Lee added a comment -

          Does anyone have advice on what library to modify for this issue?

          Show
          Brent Lee added a comment - Does anyone have advice on what library to modify for this issue?
          Hide
          Charles Fulton added a comment -

          @Brent see https://github.com/mackensen/moodle/compare/MOODLE_22_STABLE...MDL-28657 for the necessary modifications. Hopefully this will get rolled into core soon.

          Show
          Charles Fulton added a comment - @Brent see https://github.com/mackensen/moodle/compare/MOODLE_22_STABLE...MDL-28657 for the necessary modifications. Hopefully this will get rolled into core soon.
          Hide
          Tom B. added a comment -

          Please fix this. As an admin I would like to be able to restore a creation course from the automated backup directory without searching in the database for the name of the course which belongs to the course ID. Please make things easier for us admins and not more complicate!

          Show
          Tom B. added a comment - Please fix this. As an admin I would like to be able to restore a creation course from the automated backup directory without searching in the database for the name of the course which belongs to the course ID. Please make things easier for us admins and not more complicate!
          Hide
          Chris Follin added a comment -

          There seems to be a small problem with the suggested fix. The backup_shortname setting will be 0 when the setting is off, but passing 0 to the $useidasname parameter of get_default_backup_filename() means to use the shortname (don't use the ID). When backup_shortname is on, the setting will be 1, but passing 1 to $useidasname means to use the ID (you want it to use the shortname). On the $filename assignment line, $config->backup_shortname should be negated to !$config->backup_shortname and then it works as desired.

          Show
          Chris Follin added a comment - There seems to be a small problem with the suggested fix. The backup_shortname setting will be 0 when the setting is off, but passing 0 to the $useidasname parameter of get_default_backup_filename() means to use the shortname (don't use the ID). When backup_shortname is on, the setting will be 1, but passing 1 to $useidasname means to use the ID (you want it to use the shortname). On the $filename assignment line, $config->backup_shortname should be negated to !$config->backup_shortname and then it works as desired.
          Hide
          Charles Fulton added a comment -

          Thanks for the heads-up Chris, you're absolutely right. Adding patches for 2.1 and master, plus testing instructions.

          Show
          Charles Fulton added a comment - Thanks for the heads-up Chris, you're absolutely right. Adding patches for 2.1 and master, plus testing instructions.
          Hide
          Dan Poltawski added a comment -

          Looks good to me - thanks Charles - submitting for integration!

          Show
          Dan Poltawski added a comment - Looks good to me - thanks Charles - submitting for integration!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Aparup Banerjee added a comment -

          Thanks for that. The option has been integrated into master as well as 21 and 22.

          ready for testing.

          ps: hm idea, perhaps this option could in future become a possible list of templates to build the filename if needed?

          Show
          Aparup Banerjee added a comment - Thanks for that. The option has been integrated into master as well as 21 and 22. ready for testing. ps: hm idea, perhaps this option could in future become a possible list of templates to build the filename if needed?
          Hide
          Rajesh Taneja added a comment -

          Works Great
          Thanks for fixing this Charles.

          Show
          Rajesh Taneja added a comment - Works Great Thanks for fixing this Charles.
          Hide
          Eloy Lafuente (stronk7) added a comment -
          UPDATE tracker_issues
             SET status = 'Closed',
                comment = 'Thanks!'
          WHEN participants = 'Did a gorgeous work'
          

          This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).

          Show
          Eloy Lafuente (stronk7) added a comment - UPDATE tracker_issues SET status = 'Closed', comment = 'Thanks!' WHEN participants = 'Did a gorgeous work' This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).
          Hide
          Mary Cooch added a comment - - edited

          documented in 2.3 and in 2.2 referring to 2.2.3

          Show
          Mary Cooch added a comment - - edited documented in 2.3 and in 2.2 referring to 2.2.3

            People

            • Votes:
              30 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: