-
Bug
-
Resolution: Fixed
-
Major
-
2.3.4
-
MOODLE_23_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
MDL-37552-master -
Having setup and configured a web service for groups, calling the web service function core_group_get_groups returned no response or exception but we got a response code and status of 500: Internal Server Error.
Switched the debugging onto developer in Moodle and received the below line in the error log.
Call to undefined function file_rewrite_pluginfile_urls() in <moodle_dir>/lib/externallib.php on line 690
Looked in the externallib.php file and found this section of code where the error occurs:
function external_format_text($text, $textformat, $contextid, $component, $filearea, $itemid) {
|
global $CFG;
|
|
// Get settings (singleton).
|
$settings = external_settings::get_instance();
|
|
if ($settings->get_fileurl()) {
|
$text = file_rewrite_pluginfile_urls($text, $settings->get_file(), $contextid, $component, $filearea, $itemid);
|
}
|
|
if (!$settings->get_raw()) {
|
$textformat = FORMAT_HTML; // Force format to HTML when not raw.
|
$text = format_text($text, $textformat,
|
array('noclean' => true, 'para' => false, 'filter' => $settings->get_filter()));
|
}
|
|
return array($text, $textformat);
|
}
|
adding the line:
require_once("$CFG->libdir/filelib.php");
|
and modifying the function call to:
$text = file_rewrite_pluginfile_urls($text, $settings->get_file(), $contextid, $component, $filearea, $itemid, null);
|
shown modified below:
function external_format_text($text, $textformat, $contextid, $component, $filearea, $itemid) {
|
global $CFG;
|
require_once("$CFG->libdir/filelib.php");
|
// Get settings (singleton).
|
$settings = external_settings::get_instance();
|
|
if ($settings->get_fileurl()) {
|
$text = file_rewrite_pluginfile_urls($text, $settings->get_file(), $contextid, $component, $filearea, $itemid, null);
|
}
|
|
if (!$settings->get_raw()) {
|
$textformat = FORMAT_HTML; // Force format to HTML when not raw.
|
$text = format_text($text, $textformat,
|
array('noclean' => true, 'para' => false, 'filter' => $settings->get_filter()));
|
}
|
|
return array($text, $textformat);
|
}
|
seems to fix this issue, and a test of calling the core_group_get_groups web service method resulted in a response with the correct data for the group being read and a 200 response code.
- blocks
-
MDL-29472 core_cohort_xxxx_cohorts()
-
- Closed
-