MDL-22142 backup - P3: add all the remaining dependencies
authorEloy Lafuente <stronk7@moodle.org>
Sun, 2 May 2010 10:35:51 +0000 (10:35 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Sun, 2 May 2010 10:35:51 +0000 (10:35 +0000)
backup/moodle2/backup_activity_task.class.php
backup/moodle2/backup_root_task.class.php
backup/moodle2/backup_section_task.class.php

index dcc6387..934ee10 100644 (file)
@@ -218,6 +218,9 @@ abstract class backup_activity_task extends backup_task {
         // All these are common settings to be shared by all activities
 
         // Define activity_include (to decide if the whole task must be really executed)
+        // Dependent of:
+        // - activities root setting
+        // - section_included setting (if exists)
         $settingname = $settingprefix . 'included';
         $activity_included = new backup_activity_generic_setting($settingname, base_setting::IS_BOOLEAN, true);
         $this->add_setting($activity_included);
@@ -231,7 +234,10 @@ abstract class backup_activity_task extends backup_task {
             $section_included->add_dependency($activity_included);
         }
 
-        // Define activity_userinfo (dependent of root users setting)
+        // Define activity_userinfo. Dependent of:
+        // - users root setting
+        // - section_userinfo setting (if exists)
+        // - activity_included setting
         $settingname = $settingprefix . 'userinfo';
         $activity_userinfo = new backup_activity_userinfo_setting($settingname, base_setting::IS_BOOLEAN, true);
         $activity_userinfo->get_ui()->set_label(get_string('includeuserinfo','backup'));
@@ -245,6 +251,8 @@ abstract class backup_activity_task extends backup_task {
             $section_userinfo = $this->plan->get_setting($settingname);
             $section_userinfo->add_dependency($activity_userinfo);
         }
+        // Look for "activity_included" setting
+        $activity_included->add_dependency($activity_userinfo);
 
         // End of common activity settings, let's add the particular ones
         $this->define_my_settings();
index d171d55..3ddafa2 100644 (file)
@@ -69,7 +69,7 @@ class backup_root_task extends backup_task {
         $this->add_setting($roleassignments);
         $users->add_dependency($roleassignments);
 
-        // Define user_files (dependent of users)
+        // Define user_files (dependent of users and anonymize)
         $userfiles = new backup_user_files_setting('user_files', base_setting::IS_BOOLEAN, true);
         $userfiles->set_ui(new backup_setting_ui_select($userfiles, $userfiles->get_name(), array(1=>get_string('yes'), 0=>get_string('no'))));
         $this->add_setting($userfiles);
@@ -109,9 +109,10 @@ class backup_root_task extends backup_task {
         $this->add_setting($logs);
         $users->add_dependency($logs);
 
-        // Define grade_histories
+        // Define grade_histories (dependent of users)
         $gradehistories = new backup_generic_setting('grade_histories', base_setting::IS_BOOLEAN, true);
         $gradehistories->set_ui(new backup_setting_ui_select($gradehistories, $gradehistories->get_name(), array(1=>get_string('yes'), 0=>get_string('no'))));
         $this->add_setting($gradehistories);
+        $users->add_dependency($gradehistories);
     }
 }
index a63ec64..3f7de2b 100644 (file)
@@ -106,7 +106,9 @@ class backup_section_task extends backup_task {
         $section_included = new backup_section_included_setting($settingname, base_setting::IS_BOOLEAN, true);
         $this->add_setting($section_included);
 
-        // Define section_userinfo (dependent of root users setting)
+        // Define section_userinfo. Dependent of:
+        // - users root setting
+        // - section_included setting
         $settingname = $settingprefix . 'userinfo';
         $section_userinfo = new backup_section_userinfo_setting($settingname, base_setting::IS_BOOLEAN, true);
         $section_userinfo->get_ui()->set_label(get_string('includeuserinfo','backup'));
@@ -114,5 +116,7 @@ class backup_section_task extends backup_task {
         // Look for "users" root setting
         $users = $this->plan->get_setting('users');
         $users->add_dependency($section_userinfo);
+        // Look for "section_included" section setting
+        $section_included->add_dependency($section_userinfo);
     }
 }