From 5cece750f58c0d12991c1d7f17576ed44bdff41f Mon Sep 17 00:00:00 2001 From: Aparup Banerjee Date: Tue, 2 Aug 2011 14:27:43 +0800 Subject: [PATCH] MDL-27174 Backup Assignment - fixed fatal missing assignmenttype error during backup. Credit: Chris Follin --- mod/assignment/backuplib.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mod/assignment/backuplib.php b/mod/assignment/backuplib.php index 1a6d0cd7a58..d03d882c80d 100644 --- a/mod/assignment/backuplib.php +++ b/mod/assignment/backuplib.php @@ -44,11 +44,22 @@ function assignment_backup_one_mod($bf,$preferences,$assignment) { global $CFG; - + + if ($assignment === 0) { //no active instances of assignment to be backed up - skip backup + return false; + } + if (is_numeric($assignment)) { $assignment = get_record('assignment','id',$assignment); } - + + if (empty($assignment->assignmenttype)) { + // No assignment type will cause fatal error below in require_once so bail out now + // Probably ended up here by restoring a course into + // a moodle without this assignmenttype + return false; + } + $status = true; //Start mod