From c6d7956e5503192702cf8d8e4cd01306b6ce18b2 Mon Sep 17 00:00:00 2001 From: Ryan Panning Date: Wed, 10 Apr 2013 14:38:05 +0800 Subject: [PATCH 1/2] MDL-38525: Assignment - print exception message when assignment upgrade fails. Change to use getMessage() from the Exception class will prevent "{$a}" when $e->error is null. --- mod/assign/upgradelib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/assign/upgradelib.php b/mod/assign/upgradelib.php index 4ed07f45e16..9415f47cdf1 100644 --- a/mod/assign/upgradelib.php +++ b/mod/assign/upgradelib.php @@ -301,7 +301,7 @@ class assign_upgrade_manager { } catch (Exception $exception) { $rollback = true; - $log .= get_string('conversionexception', 'mod_assign', $exception->error); + $log .= get_string('conversionexception', 'mod_assign', $exception->getMessage()); } if ($rollback) { From 5e928286039f31a62b5b006053a8539d304fa658 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 10 Apr 2013 16:09:56 +0800 Subject: [PATCH 2/2] MDL-38525: Assignment upgrade - Error with comments for unenrolled students. Students with comments on 'upload' assignments cause errors for the upgrade tool if they are no longer enrolled. The solution is to allow siteadmin to see student submissions even if the student is not currently enrolled (you must be siteadmin to run the upgrade tool). --- mod/assign/locallib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 1c4452958ee..19bcff02d95 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3091,6 +3091,9 @@ class assign { public function can_view_submission($userid) { global $USER; + if (is_siteadmin()) { + return true; + } if (!is_enrolled($this->get_course_context(), $userid)) { return false; }