Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

if foreign keys are missing, backup will not abort, but record will n…

…ot be restored
  • Loading branch information...
commit 249daa5d3c209ae8bd2135ef35e2e13acd861a23 1 parent 3ce130e
gbateson authored

Showing 1 changed file with 11 additions and 3 deletions. Show diff stats Hide diff stats

  1. +11 3 mod/hotpot/restorelib.php
14 mod/hotpot/restorelib.php
@@ -274,6 +274,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
274 274 $record->$tag = backup_todb($value);
275 275 }
276 276 }
  277 + $ok = true;
277 278 foreach ($foreign_keys as $key=>$value) {
278 279 if (is_numeric($value)) {
279 280 $record->$key = $value;
@@ -290,8 +291,15 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
290 291 $new_ids[] = $key_record->new_id;
291 292 } else {
292 293 // foreign key could not be updated
293   - print "<ul><li>Foreign key could not be updated: table=$table, $key=".$record->$key."</li></ul>";
294   - $status = false;
  294 + // print "<ul><li><b>Warning:</b> Foreign key could not be updated: table=$table, $key=".$record->$key."</li></ul>";
  295 + print "<ul><li><b>Warning:</b><br>";
  296 + print "'$key_table' record (id='$old_id') is missing from backup data.<br>";
  297 + print "'$table' record ";
  298 + if (isset($record->id)) {
  299 + print "(old id='$record->id') ";
  300 + }
  301 + print "could not be restored</li></ul>";
  302 + $ok = false;
295 303 }
296 304 }
297 305 $record->$key = implode(',', $new_ids);
@@ -299,7 +307,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
299 307 }
300 308 }
301 309 // check everything is OK so far
302   - if ($status && isset($record)) {
  310 + if ($ok && isset($record)) {
303 311 // store old record id, if necessary
304 312 if (isset($record->id)) {
305 313 $record->old_id = $record->id;

0 comments on commit 249daa5

Please sign in to comment.
Something went wrong with that request. Please try again.