From 249daa5d3c209ae8bd2135ef35e2e13acd861a23 Mon Sep 17 00:00:00 2001 From: gbateson Date: Sun, 15 Jan 2006 01:47:08 +0000 Subject: [PATCH] if foreign keys are missing, backup will not abort, but record will not be restored --- mod/hotpot/restorelib.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mod/hotpot/restorelib.php b/mod/hotpot/restorelib.php index edc11f46536..0ae49e6def6 100644 --- a/mod/hotpot/restorelib.php +++ b/mod/hotpot/restorelib.php @@ -274,6 +274,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys, $record->$tag = backup_todb($value); } } + $ok = true; foreach ($foreign_keys as $key=>$value) { if (is_numeric($value)) { $record->$key = $value; @@ -290,8 +291,15 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys, $new_ids[] = $key_record->new_id; } else { // foreign key could not be updated - print ""; - $status = false; + // print ""; + print ""; + $ok = false; } } $record->$key = implode(',', $new_ids); @@ -299,7 +307,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys, } } // check everything is OK so far - if ($status && isset($record)) { + if ($ok && isset($record)) { // store old record id, if necessary if (isset($record->id)) { $record->old_id = $record->id;