From bdfd1504eb2396360ba3d6e867cf5cbbcfe464de Mon Sep 17 00:00:00 2001 From: Nikolai Jahreis <63058688+NJahreis@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:16:30 +0200 Subject: [PATCH] Remove assumtion that syscontext->id = 1 --- locallib.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/locallib.php b/locallib.php index 0cb123b308a..096ce0d01ad 100644 --- a/locallib.php +++ b/locallib.php @@ -740,8 +740,8 @@ function theme_boost_union_get_additionalresources_templatecontext() { // Iterate over the files and fill the templatecontext of the file list. $filesforcontext = []; foreach ($files as $af) { - $urlpersistent = new moodle_url('/pluginfile.php/1/theme_boost_union/additionalresources/0/'.$af->get_filename()); - $urlrevisioned = new moodle_url('/pluginfile.php/1/theme_boost_union/additionalresources/'.theme_get_revision(). + $urlpersistent = new moodle_url('/pluginfile.php/' . $systemcontext->id . '/theme_boost_union/additionalresources/0/'.$af->get_filename()); + $urlrevisioned = new moodle_url('/pluginfile.php/' . $systemcontext->id . '/theme_boost_union/additionalresources/'.theme_get_revision(). '/'.$af->get_filename()); $filesforcontext[] = ['filename' => $af->get_filename(), 'filetype' => $af->get_mimetype(), @@ -799,7 +799,7 @@ function theme_boost_union_get_customfonts_templatecontext() { } // Otherwise, fill the templatecontext of the file list. - $urlpersistent = new moodle_url('/pluginfile.php/1/theme_boost_union/customfonts/0/'.$filename); + $urlpersistent = new moodle_url('/pluginfile.php/' . $systemcontext->id . '/theme_boost_union/customfonts/0/'.$filename); $filesforcontext[] = ['filename' => $filename, 'fileurlpersistent' => $urlpersistent->out(), ]; } @@ -1839,7 +1839,8 @@ function theme_boost_union_get_touchicons_html_for_page() { // If the file exists (i.e. it has been uploaded). if ($file->exists == true) { // Build the file URL. - $fileurl = new moodle_url('/pluginfile.php/1/theme_boost_union/touchiconsios/' . + $systemcontext = \context_system::instance(); + $fileurl = new moodle_url('/pluginfile.php/' . $systemcontext->id . '/theme_boost_union/touchiconsios/' . theme_get_revision().'/'.$file->filename); // Compose and append the HTML tag.