]> git.mjollnir.org Git - moodle.git/commitdiff
rebuild_course_cache() to calculate modinfo before role assignments. MDL-13740 ;...
authorstronk7 <stronk7>
Fri, 29 Feb 2008 19:55:06 +0000 (19:55 +0000)
committerstronk7 <stronk7>
Fri, 29 Feb 2008 19:55:06 +0000 (19:55 +0000)
backup/restorelib.php

index a7470fe824dea8379dd74f50e3cd66d2fa7da851..734bc07f5d9a36e8b6b722027bf8ede966968231 100644 (file)
@@ -4139,6 +4139,8 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                     $status = false;
                }
             }
+        /// Finally, calculate modinfo cache.
+            rebuild_course_cache($restore->course_id);
         }
 
 
@@ -7517,6 +7519,8 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
         }
 
         //Now, if all is OK, adjust the instance field in course_modules !!
+        //this also calculates the final modinfo information so, after this,
+        //code needing it can be used (like role_assignments. MDL-13740)
         if ($status) {
             if (!defined('RESTORE_SILENTLY')) {
                 echo "<li>".get_string("checkinginstances");
@@ -7641,8 +7645,6 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             if (!defined('RESTORE_SILENTLY')) {
                 echo "<li>".get_string("checkingcourse");
             }
-            //modinfo field
-            rebuild_course_cache($restore->course_id);
             //categories table
             $course = get_record("course","id",$restore->course_id);
             fix_course_sortorder();