Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6586

Re: How to I bulk delete Automated backups

$
0
0
by Bill Antonia.  

I had this problem as well. Spent a fair amount of time deleting the files through the UI then thought there must be a better way!

Eventually edited the /moodle/backup/util/helper/backup_cron_helper.class.php

adding the line:

backup_cron_automated_helper::remove_excess_backups($course);

somewhere soon after:

foreach ($rs as $course) {
                $backupcourse = $DB->get_record('backup_courses', array('courseid' => $course->id));
                if (!$backupcourse) {
                    $backupcourse = new stdClass;
                    $backupcourse->courseid = $course->id;
                    $backupcourse->laststatus = self::BACKUP_STATUS_NOTYETRUN;
                    $DB->insert_record('backup_courses', $backupcourse);
                    $backupcourse = $DB->get_record('backup_courses', array('courseid' => $course->id));
                }

which appears from line 124 in Moodle 2.6

Checked the the global automated backup settings, then ran the /moodle/admin/cli/automated_backups.php script from the command line.

Going back to the Moodle Restore UI, the backups have gone, except the last as in my settings! Whoopee!!!!

Commented out the additional line and now to wait 4 days for the "draft" files to be deleted to clean up the drive.

Job done.

Although the settings were to keep just one backup the call backup_cron_automated_helper::remove_excess_backups($course); was being skipped as there was no backup to do for all of my courses.

Good idea to test this on a non-production site first though.

Hope this is of some use.


Viewing all articles
Browse latest Browse all 6586

Trending Articles