From 06a7595c85ca0193dc67a7e39938c15fb2b95582 Mon Sep 17 00:00:00 2001 From: mwithheld Date: Mon, 17 Dec 2018 15:23:28 +0800 Subject: [PATCH] Move creating the temp directory out of the emailing for loop (#238) --- classes/task/email_certificate_task.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/task/email_certificate_task.php b/classes/task/email_certificate_task.php index cf4ec77..a7a6641 100644 --- a/classes/task/email_certificate_task.php +++ b/classes/task/email_certificate_task.php @@ -154,16 +154,16 @@ class email_certificate_task extends \core\task\scheduled_task { continue; } + // Create a directory to store the PDF we will be sending. + $tempdir = make_temp_directory('certificate/attachment'); + if (!$tempdir) { + return; + } + // Now, email the people we need to. foreach ($issuedusers as $user) { $userfullname = fullname($user); - // Create a directory to store the PDF we will be sending. - $tempdir = make_temp_directory('certificate/attachment'); - if (!$tempdir) { - return false; - } - // Now, get the PDF. $template = new \stdClass(); $template->id = $customcert->templateid;