Merge branch 'MDL-66468-37' of git://github.com/jleyva/moodle into MOODLE_37_STABLE

This commit is contained in:
Adrian Greeve
2019-08-28 08:56:30 +08:00
3 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -1044,7 +1044,8 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
// Do not merge files, leave it as it was.
if ($draftitemid === IGNORE_FILE_MERGE) {
return null;
// Safely return $text, no need to rewrite pluginfile because this is mostly comming from an external client like the app.
return $text;
}
$usercontext = context_user::instance($USER->id);
+5
View File
@@ -869,6 +869,11 @@ class core_filelib_testcase extends advanced_testcase {
// Save without merge.
file_save_draft_area_files(IGNORE_FILE_MERGE, $usercontext->id, 'user', 'private', 0);
$this->assertCount(2, $fs->get_area_files($usercontext->id, 'user', 'private'));
// Save again, this time including some inline text.
$inlinetext = 'Some text <img src="@@PLUGINFILE@@/file.png">';
$text = file_save_draft_area_files(IGNORE_FILE_MERGE, $usercontext->id, 'user', 'private', 0, null, $inlinetext);
$this->assertCount(2, $fs->get_area_files($usercontext->id, 'user', 'private'));
$this->assertEquals($inlinetext, $text);
}
/**
+1
View File
@@ -23,6 +23,7 @@ attribute on forms to avoid collisions in forms loaded in AJAX requests.
and get_reduced_timeout(). These allow for timeouts to be increased by a setting in config.php.
* The $draftitemid parameter of file_save_draft_area_files() function now supports the constant IGNORE_FILE_MERGE:
When the parameter is set to that constant, the function won't process file merging, keeping the original state of the file area.
Notice also than when $text is set, pluginfile rewrite won't be processed so the text will not be modified.
* Introduced new callback for plugin developers '<component>_pre_processor_message_send($procname, $proceventdata)':
This will allow any plugin to manipulate messages or notifications before they are sent by a processor (email, mobile...)
* New capability 'moodle/category:viewcourselist' in category context that controls whether user is able to browse list of courses