From 9fd128d5e1aeb807607198fa10c4c5dff768beb8 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Fri, 26 Aug 2016 12:46:35 +0800 Subject: [PATCH] Fixed web service not having access to file_save_draft_area_files() The error occurred when editing an image element on the repositioning page for site wide templates. --- classes/certificate.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/certificate.php b/classes/certificate.php index cb3bc5b..0bf17a8 100644 --- a/classes/certificate.php +++ b/classes/certificate.php @@ -84,7 +84,10 @@ class certificate { * @param int $contextid the context we are storing this image in */ public static function upload_imagefiles($draftitemid, $contextid) { + global $CFG; + // Save the file if it exists that is currently in the draft area. + require_once($CFG->dirroot . '/lib/filelib.php'); file_save_draft_area_files($draftitemid, $contextid, 'mod_customcert', 'image', 0); }