MDL-83332 core: Revert the slashargument removal on MDL-62640

Removing the option causes issues on MacOS.
This commit is contained in:
meirzamoodle
2024-10-02 18:36:14 +07:00
parent 0eacab846e
commit 3229dda3d6
38 changed files with 833 additions and 549 deletions
+38 -17
View File
@@ -682,7 +682,15 @@ class theme_config {
}
$url = new moodle_url("/theme/styles.php");
$url->set_slashargument("/{$this->name}/{$rev}/{$type}", 'noparam');
if (!empty($CFG->slasharguments)) {
$url->set_slashargument("/{$this->name}/{$rev}/{$type}", 'noparam', true);
} else {
$url->params([
'theme' => $this->name,
'rev' => $rev,
'type' => $type,
]);
}
} else {
$url = new moodle_url('/theme/styles_debug.php', [
'theme' => $this->name,
@@ -817,17 +825,30 @@ class theme_config {
$rev .= "_{$themesubrevision}";
}
$slashargs = '';
if (!$svg) {
// We add a simple /_s to the start of the path.
// The underscore is used to ensure that it isn't a valid theme name.
$slashargs .= '/_s' . $slashargs;
if (!empty($CFG->slasharguments)) {
$slashargs = '';
if (!$svg) {
// We add a simple /_s to the start of the path.
// The underscore is used to ensure that it isn't a valid theme name.
$slashargs .= '/_s' . $slashargs;
}
$slashargs .= '/' . $this->name . '/' . $rev . '/' . $filename;
if ($separate) {
$slashargs .= '/chunk0';
}
$url->set_slashargument($slashargs, 'noparam', true);
} else {
$params = ['theme' => $this->name, 'rev' => $rev, 'type' => $filename];
if (!$svg) {
// We add an SVG param so that we know not to serve SVG images.
// We do this because all modern browsers support SVG and this param will one day be removed.
$params['svg'] = '0';
}
if ($separate) {
$params['chunk'] = '0';
}
$url->params($params);
}
$slashargs .= '/' . $this->name . '/' . $rev . '/' . $filename;
if ($separate) {
$slashargs .= '/chunk0';
}
$url->set_slashargument($slashargs, 'noparam');
$urls[] = $url;
} else {
$baseurl = new moodle_url('/theme/styles_debug.php');
@@ -1436,9 +1457,9 @@ class theme_config {
return null;
}
if ($rev > 0) {
if (!empty($CFG->slasharguments) && $rev > 0) {
$url = new moodle_url("/theme/javascript.php");
$url->set_slashargument('/' . $this->name . '/' . $rev . '/' . $params['type'], 'noparam');
$url->set_slashargument('/' . $this->name . '/' . $rev . '/' . $params['type'], 'noparam', true);
return $url;
} else {
return new moodle_url('/theme/javascript.php', $params);
@@ -1676,14 +1697,14 @@ class theme_config {
$params['image'] = $imagename;
$url = new moodle_url("/theme/image.php");
if ($rev > 0) {
if (!empty($CFG->slasharguments) && $rev > 0) {
$path = '/' . $params['theme'] . '/' . $params['component'] . '/' . $params['rev'] . '/' . $params['image'];
if (!$svg) {
// We add a simple /_s to the start of the path.
// The underscore is used to ensure that it isn't a valid theme name.
$path = '/_s' . $path;
}
$url->set_slashargument($path, 'noparam');
$url->set_slashargument($path, 'noparam', true);
} else {
if (!$svg) {
// We add an SVG param so that we know not to serve SVG images.
@@ -1722,9 +1743,9 @@ class theme_config {
$params['font'] = $font;
$url = new moodle_url("/theme/font.php");
if ($rev > 0) {
if (!empty($CFG->slasharguments) && $rev > 0) {
$path = '/' . $params['theme'] . '/' . $params['component'] . '/' . $params['rev'] . '/' . $params['font'];
$url->set_slashargument($path, 'noparam');
$url->set_slashargument($path, 'noparam', true);
} else {
$url->params($params);
}