Commit 2eeef14c authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review

Merge "Bug 1571910: Set placeholder cacheversion before upgrade" into 16.04_STABLE

parents 5f0fc03e a26871c3
......@@ -452,7 +452,7 @@ $siteoptionform = array(
'type' => 'switchbox',
'title' => get_string('recaptchaonregisterform', 'admin'),
'description' => get_string('recaptchaonregisterformdesc1', 'admin'),
'defaultvalue' => get_config('recaptchaonregisterform', 'admin'),
'defaultvalue' => get_config('recaptchaonregisterform'),
'help' => true,
'disabled' => in_array('recaptchaonregisterform', $OVERRIDDEN)
),
......
......@@ -913,17 +913,18 @@ function load_config() {
/**
* This function returns a value from $CFG
* or null if it is not found
* or default value if supplied or null if it is not found
*
* @param string $key config setting to look for
* @param string $key Config setting to look for
* @param string $default Default value to return if setting not found
* @return mixed
*/
function get_config($key) {
function get_config($key, $default = null) {
global $CFG;
if (isset($CFG->$key)) {
return $CFG->$key;
}
return null;
return $default;
}
......
......@@ -687,7 +687,7 @@ EOF;
$smarty->assign_by_ref('JAVASCRIPT', $javascript_array);
$smarty->assign('RELEASE', get_config('release'));
$smarty->assign('SERIES', get_config('series'));
$smarty->assign('CACHEVERSION', get_config('cacheversion'));
$smarty->assign('CACHEVERSION', get_config('cacheversion', 0));
if (get_config('siteclosedforupgrade')) {
$smarty->assign('SITECLOSED', 'logindisabled');
}
......@@ -3604,7 +3604,7 @@ function clean_html($text, $xhtml=false) {
// $config->set('Cache.DefinitionImpl', null);
$config->set('HTML.DefinitionID', 'Mahara customisations to default config');
$config->set('HTML.DefinitionRev', get_config('cacheversion'));
$config->set('HTML.DefinitionRev', get_config('cacheversion', 0));
$config->set('Cache.SerializerPermissions', get_config('directorypermissions'));
$config->set('Cache.SerializerPath', get_config('dataroot') . 'htmlpurifier');
......@@ -3726,8 +3726,8 @@ function clean_css($input_css, $preserve_css=false) {
// $config->set('Cache.DefinitionImpl', null);
$config->set('HTML.DefinitionID', 'Mahara customisations to default config for CSS');
$config->set('HTML.DefinitionRev', get_config('cacheversion'));
$config->set('CSS.DefinitionRev', get_config('cacheversion'));
$config->set('HTML.DefinitionRev', get_config('cacheversion', 0));
$config->set('CSS.DefinitionRev', get_config('cacheversion', 0));
$config->set('Cache.SerializerPermissions', get_config('directorypermissions'));
$config->set('Cache.SerializerPath', get_config('dataroot') . 'htmlpurifier');
......@@ -4591,20 +4591,20 @@ function append_version_number($urls) {
$formattedurls = array();
foreach ($urls as $url) {
if (preg_match('/\?/',$url)) {
$url .= '&v=' . get_config('cacheversion');
$url .= '&v=' . get_config('cacheversion', 0);
}
else {
$url .= '?v=' . get_config('cacheversion');
$url .= '?v=' . get_config('cacheversion', 0);
}
$formattedurls[] = $url;
}
return $formattedurls;
}
if (preg_match('/\?/',$urls)) {
$urls .= '&v=' . get_config('cacheversion');
$urls .= '&v=' . get_config('cacheversion', 0);
}
else {
$urls .= '?v=' . get_config('cacheversion');
$urls .= '?v=' . get_config('cacheversion', 0);
}
return $urls;
}
......
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