MDL-59780 mathjax: Make sure mathjax url doesn't become empty

This commit is contained in:
Ankit Agarwal
2017-09-27 09:16:11 +05:30
parent 469c46aa3a
commit 1da8d303ef
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -138,7 +138,8 @@ MathJax.Hub.Config({
// setting. Since it is preferably to always load the secure resource.
$httpurl = get_config('filter_mathjaxloader', 'httpurl');
if ($httpurl !== 'http://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js') {
if ($httpurl !== 'http://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js' &&
$httpurl !== 'http://cdn.mathjax.org/mathjax/2.6.1/MathJax.js') {
// If the http setting has been changed, we make the admin choose the https setting because
// it indicates some sort of custom setup. This will be supported by the release notes.
unset_config('httpsurl', 'filter_mathjaxloader');
@@ -196,5 +197,15 @@ MathJax.Hub.Config({
upgrade_plugin_savepoint(true, 2016120502, 'filter', 'mathjaxloader');
}
if ($oldversion < 2016120503) {
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
if (empty($httpsurl)) {
// URL is empty, most likely because of bad upgrade path. See MDL-59780.
set_config('httpsurl', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js', 'filter_mathjaxloader');
}
upgrade_plugin_savepoint(true, 2016120503, 'filter', 'mathjaxloader');
}
return true;
}
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016120502;
$plugin->version = 2016120503;
$plugin->requires = 2016112900; // Requires this Moodle version.
$plugin->component= 'filter_mathjaxloader';