Commit efb76eed authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1760732: Add warning for upgrade of configurable themes"

parents 24a23e33 8cac996b
......@@ -869,6 +869,11 @@ function institution_submit(Pieform $form, $values) {
$newinstitution->commentthreaded = (!empty($values['commentthreaded'])) ? 1 : 0;
if ($newinstitution->theme == 'custom') {
// remove flag to add warning for configurable theme update if it exists.
if (get_config_institution($institution, 'customthemeupdate')) {
set_config_institution($institution, 'customthemeupdate', false);
}
if (!empty($oldinstitution->style)) {
$styleid = $oldinstitution->style;
delete_records('style_property', 'style', $styleid);
......
......@@ -135,6 +135,7 @@ $string['noreplyaddressmissingorinvalid'] = 'The noreply address setting is eith
$string['openbasedirenabled'] = 'Your server has the php open_basedir restriction enabled.';
$string['openbasedirpaths'] = 'Mahara can only open files within the following path(s): %s.';
$string['openbasedirwarning'] = 'Some requests for external sites may fail to complete. This could stop certain feeds from updating among other things.';
$string['resavecustomthemes'] = 'Your latest upgrade may have stopped your configurable themes displaying correctly. To update a configurable theme please go to Administration → Institution -> Settings and configure the institution\'s settings and save the form.<br>The following institutions use configurable themes:';
$string['gdlibrarylacksgifsupport'] = 'The installed PHP GD library does not support both creating and reading GIF images. Full support is needed to upload GIF images.';
$string['gdlibrarylacksjpegsupport'] = 'The installed PHP GD library does not support JPEG/JPG images. Full support is needed to upload JPEG/JPG images.';
......
......@@ -5923,5 +5923,23 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
// add customtheme field to act as a flag for configurable theme bug 1760732
if ($oldversion < 2018070500) {
// workaround for $oldversion check in minaccept
$old = $oldversion;
// Check whether institution uses configurable theme and upgrade is from earlier than 16.10.
// If so, set a customthemeupdate field to 1. 2016090237 is latest version of 16.10_STABLE as of 20180427.
if ($old <= 2016090237) {
$custom_themes = get_records_sql_array("SELECT name FROM {institution} WHERE theme = ?", array('custom'));
if ($custom_themes) {
// set_config_institution requires the Institution class.
require_once(get_config('docroot') . 'lib/institution.php');
foreach ($custom_themes as $inst) {
set_config_institution($inst->name, 'customthemeupdate', true);
}
}
}
}
return $status;
}
}
\ No newline at end of file
......@@ -1561,6 +1561,20 @@ function site_warnings() {
$warnings[] = get_string('noreplyaddressmissingorinvalid', 'error', get_config('wwwroot') . 'admin/site/options.php?fs=emailsettings');
}
// If the configurable themes bug 1760732 was triggered by a recent upgrade, provide a warning that the theme needs resaving.
$custom_themes = get_records_sql_array("SELECT i.displayname FROM {institution} i
JOIN {institution_config} ic ON ic.institution = i.name
WHERE ic.field = ? AND ic.value = ?
ORDER BY i.displayname", array('customthemeupdate', '1'));
if ($custom_themes) {
$warning = get_string('resavecustomthemes', 'error') . "<ul>";
foreach ($custom_themes as $theme) {
$warning .= "<li>" . hsc($theme->displayname) . "</li>";
}
$warning .= "</ul>";
$warnings[] = $warning;
}
safe_require('auth', 'saml');
if (PluginAuthSaml::is_active()) {
// Check if the saml plugin config needs updating
......
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2018061801;
$config->version = 2018070500;
$config->series = '18.10';
$config->release = '18.10dev';
$config->minupgradefrom = 2015030409;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment