MDL-70130 core: allow to attach files from localrequestdir to emails
authorMarina Glancy <marina@moodle.com>
Thu, 5 Nov 2020 16:01:54 +0000 (17:01 +0100)
committerAndrew Nicols <andrew@nicols.co.uk>
Fri, 6 Nov 2020 02:02:04 +0000 (10:02 +0800)
Co-authored-by: Paul Holden <paulh@moodle.com>
lib/moodlelib.php
lib/tests/moodlelib_test.php

index 5e09703..2712d3d 100644 (file)
@@ -6325,7 +6325,8 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
                 $CFG->dataroot,
                 $CFG->dirroot,
                 $CFG->localcachedir,
-                $CFG->tempdir
+                $CFG->tempdir,
+                $CFG->localrequestdir,
             ]);
             // Set addpath to true.
             $addpath = true;
index ff52d2c..6962100 100644 (file)
@@ -3446,6 +3446,9 @@ class core_moodlelib_testcase extends advanced_testcase {
             'dirroot' => [$CFG->dirroot],
             'localcachedir' => [$CFG->localcachedir],
             'tempdir' => [$CFG->tempdir],
+            // Paths within $CFG->localrequestdir.
+            'localrequestdir_request_directory' => [make_request_directory()],
+            'localrequestdir_request_storage_directory' => [get_request_storage_directory()],
             // Pass null to indicate we want to test a path relative to $CFG->dataroot.
             'relative' => [null]
         ];