]> git.mjollnir.org Git - moodle.git/commitdiff
Changes to users restore and some minor bugs detected
authorstronk7 <stronk7>
Fri, 20 Jun 2003 19:44:06 +0000 (19:44 +0000)
committerstronk7 <stronk7>
Fri, 20 Jun 2003 19:44:06 +0000 (19:44 +0000)
(when no modules were selected to restore)

backup/restore_execute.html

index 4729ca8322d698218004d59a8309932f1b7330c4..337cbf1ac71e2c1907d5f3a37f879e7942373143 100644 (file)
 
     //Now create users as needed 
     if ($status and ($restore->users == 0 or $restore->users == 1)) {
-        echo "<li>Creating users";
+        echo "<li>Creating users<br>";
         $status = restore_create_users($restore,$xml_file);
         //Now print info about the work done
         if ($status) {
-            $recs = get_records_sql("select old_id, info from {$CFG->prefix}backup_ids
+            $recs = get_records_sql("select old_id, new_id from {$CFG->prefix}backup_ids
                                      where backup_code = '$restore->backup_unique_code' and
                                      table_name = 'user'");
             //We've records
                 $other_count = 0;
                 //Iterate, filling counters
                 foreach ($recs as $rec) {
-                    if (strpos($rec->info,"new") !== false) {
+                    //Get full record, using backup_getids
+                    $record = backup_getid($restore->backup_unique_code,"user",$rec->old_id);
+                    if (strpos($record->info,"new") !== false) {
                         $new_count++;
                     } 
-                    if (strpos($rec->info,"exists") !== false) {
+                    if (strpos($record->info,"exists") !== false) {
                         $exists_count++;
                     }
-                    if (strpos($rec->info,"student")) {
+                    if (strpos($record->info,"student")) {
                         $student_count++;
-                    } else if (strpos($rec->info,"teacher")) {
+                    } else if (strpos($record->info,"teacher")) {
                         $teacher_count++;
-                    } else if (strpos($rec->info,"admin")) {
+                    } else if (strpos($record->info,"admin")) {
                         $admin_count++;
-                    } else if (strpos($rec->info,"coursecreator")) {
+                    } else if (strpos($record->info,"coursecreator")) {
                         $coursecreator_count++;
-                    } else if ($rec->info == "new" or $rec->info == "exists") {
+                    } else if ($record->info == "new" or $record->info == "exists") {
                         $other_count++;
                     }
                 }
     if ($status) {
         echo "<li>Creating Course Modules";
         $status = restore_create_modules($restore,$xml_file);
-        //If all is ok (and we have a counter)
-        if ($status and ($status !== true)) {   
-            //Inform about modules restores
-        }
     }