Uploaded image for project: '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

      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?

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            stuartrmealor 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
            stuartrmealor 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
            mindyk 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
            mindyk 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
            alipkin 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
            alipkin 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
            cfulton 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
            cfulton 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
            leebrent 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
            leebrent 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
            lipousa 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
            lipousa 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
            leebrent Brent Lee added a comment -

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

            Show
            leebrent Brent Lee added a comment - Does anyone have advice on what library to modify for this issue?
            Hide
            cfulton 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
            cfulton 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
            tombaja 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
            tombaja 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
            cfollin 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
            cfollin 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
            cfulton 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
            cfulton 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
            poltawski Dan Poltawski added a comment -

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

            Show
            poltawski Dan Poltawski added a comment - Looks good to me - thanks Charles - submitting for integration!
            Hide
            stronk7 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
            stronk7 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
            nebgor 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
            nebgor 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
            rajeshtaneja Rajesh Taneja added a comment -

            Works Great
            Thanks for fixing this Charles.

            Show
            rajeshtaneja Rajesh Taneja added a comment - Works Great Thanks for fixing this Charles.
            Hide
            stronk7 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
            stronk7 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
            marycooch Mary Cooch added a comment - - edited

            documented in 2.3 and in 2.2 referring to 2.2.3

            Show
            marycooch 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:
                  Fix Release Date:
                  14/May/12