Index: lang/en/moodle.php
===================================================================
--- lang/en/moodle.php	(revision 52)
+++ lang/en/moodle.php	(working copy)
@@ -147,6 +147,9 @@
 $string['authenticateduserdescription'] = 'All logged in users.';
 $string['authentication'] = 'Authentication';
 $string['authenticationplugins'] = 'Authentication plugins';
+// CMDL-1530 new option to allow turning on/off of scheduled backup
+$string['autobackup'] = 'Allow scheduled backups?';
+// end CMDL-1530
 $string['autosubscribe'] = 'Forum auto-subscribe';
 $string['autosubscribeno'] = 'No: don\'t automatically subscribe me to forums';
 $string['autosubscribeyes'] = 'Yes: when I post, subscribe me to that forum';
@@ -281,6 +284,12 @@
 $string['courseapprovedemail2'] = 'Your requested course, {$a->name}, has been approved.  To access your new course, go to {$a->url}';
 $string['courseapprovedfailed'] = 'Failed to save the course as approved!';
 $string['courseapprovedsubject'] = 'Your course has been approved!';
+// CMDL-1530 new option to allow turning on/off of scheduled backup
+$string['courseautobackup'] = 'Allow scheduled backups';
+$string['courseautobackup_help'] = '<p>By default this is set to Yes i.e. a course is set to be included in scheduled backups (currently daily).</p>
+<p>Set this to No if the course is no longer required to be backed up. This might be if it is no longer in use i.e. is from a previous academic year, or it is a read-only course and a backup already exists.
+By turning off backups for such courses you will help make Moodle run more efficiently and save on storage space.</p>';
+// end CMDL-1530
 $string['courseavailable'] = 'This course is available to students';
 $string['courseavailablenot'] = 'This course is not available to students';
 $string['coursebackup'] = 'Course backup';
Index: course/edit_form.php
===================================================================
--- course/edit_form.php	(revision 52)
+++ course/edit_form.php	(working copy)
@@ -155,6 +155,13 @@
         $mform->addHelpButton('maxbytes', 'maximumupload');
         $mform->setDefault('maxbytes', $courseconfig->maxbytes);
 
+        // CMDL-1530 new option to allow turning on/off of scheduled backup
+        $mform->addElement('selectyesno', 'autobackup', get_string('autobackup'));
+        $mform->addHelpButton('autobackup', 'courseautobackup');
+        $mform->setDefault('autobackup', $courseconfig->autobackup);
+        // end CMDL-1530
+
+
         if (!empty($course->legacyfiles) or !empty($CFG->legacyfilesinnewcourses)) {
             if (empty($course->legacyfiles)) {
                 //0 or missing means no legacy files ever used in this course - new course or nobody turned on legacy files yet
Index: backup/backup_scheduled.php
===================================================================
--- backup/backup_scheduled.php	(revision 52)
+++ backup/backup_scheduled.php	(working copy)
@@ -112,6 +112,16 @@
                     $DB->set_field("backup_courses","laststatus","3", array("courseid"=>$backup_course->courseid));
                     $skipped = true;
                 }
+
+                // CMDL-1530 new option to allow turning on/off of scheduled backup
+                // skip backup if the option is set to off in course settings
+                if (!$course->autobackup) {
+                    mtrace("            SKIPPING - autobackup turned off");
+                    $DB->set_field("backup_courses","laststatus","3", array("courseid"=>$backup_course->courseid));
+                    $skipped = true;
+                }
+                // end CMDL-1530
+
                 //Now we backup every non skipped course with nextstarttime < now
                 if (!$skipped  && $backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
                     //We have to send a email because we have included at least one backup
Index: backup/util/helper/backup_cron_helper.class.php
===================================================================
--- backup/util/helper/backup_cron_helper.class.php	(revision 52)
+++ backup/util/helper/backup_cron_helper.class.php	(working copy)
@@ -130,6 +130,16 @@
                     $DB->update_record('backup_courses', $backupcourse);
                     mtrace('Skipping unchanged course '.$course->fullname);
                     $skipped = true;
+
+                // CMDL-1530 new option to allow turning on/off of scheduled backup
+                // skip backup if the option is set to off in course settings
+                } else if (empty($course->autobackup)) {
+                    $backupcourse->laststatus = backup_cron_automated_helper::BACKUP_STATUS_SKIPPED;
+                    $DB->update_record('backup_courses', $backupcourse);
+                    mtrace('Skipping course with autobackup switched off '.$course->fullname);
+                    $skipped = true;
+                // end CMDL-1530
+
                 } else if (($backupcourse->nextstarttime >= 0 && $backupcourse->nextstarttime < $now) || $rundirective == self::RUN_IMMEDIATELY) {
                     mtrace('Backing up '.$course->fullname, '...');

