From: nfreear Date: Fri, 16 Feb 2007 15:45:35 +0000 (+0000) Subject: Fixes bug MDL-8059 "... won't restore - error A required parameter (id) was missing" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=88915b1d431854c5165ced5e313d069510a1ac34;p=moodle.git Fixes bug MDL-8059 "... won't restore - error A required parameter (id) was missing" --- diff --git a/backup/backuplib.php b/backup/backuplib.php index f00eafadac..42da4b0811 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -213,9 +213,10 @@ //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", diff --git a/mod/resource/restorelib.php b/mod/resource/restorelib.php index 115a449ed5..8cd63342bf 100644 --- a/mod/resource/restorelib.php +++ b/mod/resource/restorelib.php @@ -132,7 +132,7 @@ //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 { @@ -157,7 +157,7 @@ //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 {