From f88224624dca76e1a8a2810fd8cc04292611f91c Mon Sep 17 00:00:00 2001
From: "Eloy Lafuente (stronk7)" <stronk7@moodle.org>
Date: Mon, 27 Feb 2012 03:37:52 +0100
Subject: [PATCH] MDL-29248 backup: delete user_files settings, lang strings
 and uses

---
 admin/settings/courses.php                          | 2 --
 backup/util/dbops/backup_controller_dbops.class.php | 1 -
 backup/util/helper/backup_cron_helper.class.php     | 1 -
 lang/en/backup.php                                  | 2 --
 lib/db/upgrade.php                                  | 9 +++++++++
 version.php                                         | 2 +-
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/admin/settings/courses.php b/admin/settings/courses.php
index 88fbdef20a4..321ce449762 100644
--- a/admin/settings/courses.php
+++ b/admin/settings/courses.php
@@ -97,7 +97,6 @@ if ($hassiteconfig
     $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', new lang_string('generalusers','backup'), new lang_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0)));
     $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', new lang_string('generalanonymize','backup'), new lang_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0)));
     $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
-    $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_user_files', new lang_string('generaluserfiles','backup'), new lang_string('configgeneraluserfiles','backup'), array('value'=>1, 'locked'=>0)));
     $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
     $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
     $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
@@ -144,7 +143,6 @@ if ($hassiteconfig
     $temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), ''));
     $temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', new lang_string('generalusers', 'backup'), new lang_string('configgeneralusers', 'backup'), 1));
     $temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), 1));
-    $temp->add(new admin_setting_configcheckbox('backup/backup_auto_user_files', new lang_string('generaluserfiles', 'backup'), new lang_string('configgeneraluserfiles','backup'), 1));
     $temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), 1));
     $temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), 1));
     $temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), 1));
diff --git a/backup/util/dbops/backup_controller_dbops.class.php b/backup/util/dbops/backup_controller_dbops.class.php
index cd89d82f55f..dffdb8d73a0 100644
--- a/backup/util/dbops/backup_controller_dbops.class.php
+++ b/backup/util/dbops/backup_controller_dbops.class.php
@@ -440,7 +440,6 @@ abstract class backup_controller_dbops extends backup_dbops {
             'backup_general_users'              => 'users',
             'backup_general_anonymize'          => 'anonymize',
             'backup_general_role_assignments'   => 'role_assignments',
-            'backup_general_user_files'         => 'user_files',
             'backup_general_activities'         => 'activities',
             'backup_general_blocks'             => 'blocks',
             'backup_general_filters'            => 'filters',
diff --git a/backup/util/helper/backup_cron_helper.class.php b/backup/util/helper/backup_cron_helper.class.php
index 8631be6488d..b3599757157 100644
--- a/backup/util/helper/backup_cron_helper.class.php
+++ b/backup/util/helper/backup_cron_helper.class.php
@@ -323,7 +323,6 @@ abstract class backup_cron_automated_helper {
             $settings = array(
                 'users' => 'backup_auto_users',
                 'role_assignments' => 'backup_auto_role_assignments',
-                'user_files' => 'backup_auto_user_files',
                 'activities' => 'backup_auto_activities',
                 'blocks' => 'backup_auto_blocks',
                 'filters' => 'backup_auto_filters',
diff --git a/lang/en/backup.php b/lang/en/backup.php
index 0116d50c36f..769394751b2 100644
--- a/lang/en/backup.php
+++ b/lang/en/backup.php
@@ -86,7 +86,6 @@ $string['configgeneralhistories'] = 'Sets the default for including user history
 $string['configgenerallogs'] = 'If enabled logs will be included in backups by default.';
 $string['configgeneralroleassignments'] = 'If enabled by default roles assignments will also be backed up.';
 $string['configgeneraluserscompletion'] = 'If enabled user completion information will be included in backups by default.';
-$string['configgeneraluserfiles'] = 'Sets the default for whether user files will be included in backups.';
 $string['configgeneralusers'] = 'Sets the default for whether to include users in backups.';
 $string['confirmcancel'] = 'Cancel backup';
 $string['confirmcancelquestion'] = 'Are you sure you wish to cancel?
@@ -127,7 +126,6 @@ $string['generalgradehistories'] = 'Include histories';
 $string['generallogs'] = 'Include logs';
 $string['generalroleassignments'] = 'Include role assignments';
 $string['generaluserscompletion'] = 'Include user completion information';
-$string['generaluserfiles'] = 'Include user files';
 $string['generalusers'] = 'Include users';
 $string['importfile'] = 'Import a backup file';
 $string['importbackupstage1action'] = 'Next';
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index df9b3f88060..8aa90d81c62 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -187,6 +187,15 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2012021700.02);
     }
 
+    // The ability to backup user (private) files is out completely - MDL-29248
+    if ($oldversion < 2012030100.01) {
+        unset_config('backup_general_user_files', 'backup');
+        unset_config('backup_general_user_files_locked', 'backup');
+        unset_config('backup_auto_user_files', 'backup');
+
+        upgrade_main_savepoint(true, 2012030100.01);
+    }
+
     return true;
 }
 
diff --git a/version.php b/version.php
index 52b1122b6a0..190f235d90f 100644
--- a/version.php
+++ b/version.php
@@ -30,7 +30,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$version  = 2012030100.00;              // YYYYMMDD      = weekly release date of this DEV branch
+$version  = 2012030100.01;              // YYYYMMDD      = weekly release date of this DEV branch
                                         //         RR    = release increments - 00 in DEV branches
                                         //           .XX = incremental changes