]> git.mjollnir.org Git - moodle.git/commitdiff
Added $restore->mods[$mod->type]->granular to restore_create_sections() and to restor...
authorvyshane <vyshane>
Wed, 4 Oct 2006 08:35:00 +0000 (08:35 +0000)
committervyshane <vyshane>
Wed, 4 Oct 2006 08:35:00 +0000 (08:35 +0000)
backup/restorelib.php

index 3a93c36beff369947d08d4efed51d9f39def5d00..42f65cf777e97ca05ed963db9b70728f9a35671f 100644 (file)
                         foreach ($sect->mods as $keym => $mod) {
                             //Check if we've to restore this module (and instance) 
                             if ($restore->mods[$mod->type]->restore) {
-                                if (!is_array($restore->mods[$mod->type]->instances)  // we don't care about per instance
+                                
+                                if (is_array($restore->mods[$mod->type]->instances)) {
+                                    // This defines whether we want to restore specific
+                                    // instances of the modules (granular restore), or
+                                    // whether we don't care and just want to restore
+                                    // all module instances (non-granular).
+                                    $restore->mods[$mod->type]->granular = true;
+                                }
+                                
+                                if (!$restore->mods[$mod->type]->granular  // we don't care about per instance
                                     || (array_key_exists($mod->instance,$restore->mods[$mod->type]->instances) 
                                         && !empty($restore->mods[$mod->type]->instances[$mod->instance]->restore))) {
                                     
                 }
                 //Iterate over each module
                 foreach ($info as $mod) {
-                    if (!is_array($restore->mods[$mod->modtype]->instances)  // we don't care about per instance
+                    if (!(isset($restore->mods[$mod->modtype]->granular) && $restore->mods[$mod->modtype]->granular)  // We don't care about per instance, i.e. restore all instances.
                         || (array_key_exists($mod->id,$restore->mods[$mod->modtype]->instances) 
                             && !empty($restore->mods[$mod->modtype]->instances[$mod->id]->restore))) {
                         $modrestore = $mod->modtype."_restore_mods";