]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes bug MDL-8059 "... won't restore - error A required parameter (id) was missing"
authornfreear <nfreear>
Fri, 16 Feb 2007 15:45:35 +0000 (15:45 +0000)
committernfreear <nfreear>
Fri, 16 Feb 2007 15:45:35 +0000 (15:45 +0000)
backup/backuplib.php
mod/resource/restorelib.php

index f00eafadac4e6dcd9262db8384c9e6a0d7c57f9d..42da4b0811e558380816d78706ae2c774682dad9 100644 (file)
                 //Extracts user id from file path
                 $tok = strtok($dir,"/");
                 if ($tok) {
-                   $userid = $tok;
+                    $userid = $tok;
                 } else {
-                   $tok = "";
+                    //We were getting $dir='0', so continue (WAS: $tok = "";)
+                    continue;
                 }
                 //Look it is a backupable user
                 $data = get_record ("backup_ids","backup_code","$backup_unique_code",
index 115a449ed5b3c8ed9859db41d8ec3a1fadd7401f..8cd63342bf12a10e670f49bf57a6db7a96b00bc4 100644 (file)
                 //Personalize the searchstring
                 $searchstring='/\$@(RESOURCEINDEX)\*('.$old_id.')@\$/';
                 //If it is a link to this course, update the link to its new location
-                if($rec->new_id) {
+                if (!empty($rec->new_id)) {
                     //Now replace it
                     $result= preg_replace($searchstring,$CFG->wwwroot.'/mod/resource/index.php?id='.$rec->new_id,$result);
                 } else { 
                 //Personalize the searchstring
                 $searchstring='/\$@(RESOURCEVIEWBYID)\*('.$old_id.')@\$/';
                 //If it is a link to this course, update the link to its new location
-                if($rec->new_id) {
+                if (!empty($rec->new_id)) {
                     //Now replace it
                     $result= preg_replace($searchstring,$CFG->wwwroot.'/mod/resource/view.php?id='.$rec->new_id,$result);
                 } else {