Commit 1771980e authored by Penny Leach's avatar Penny Leach
Browse files

added mechamism for check_upgrades to disable logins.

parent 5a9ad47d
......@@ -30,6 +30,10 @@ define('INSTALLER', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require(get_config('libroot') . 'upgrade.php');
$upgrade = check_upgrades($name);
if (empty($upgrade->disablelogin)) {
auth_setup();
}
$install = param_boolean('install');
if (!$install) {
$name = param_variable('name');
......@@ -57,7 +61,6 @@ if ($install) {
json_reply(false, $message);
}
$upgrade = check_upgrades($name);
$data = array(
'key' => $name
);
......
......@@ -34,6 +34,10 @@ require(get_config('libroot') . 'upgrade.php');
$smarty = smarty();
$upgrades = check_upgrades();
if (empty($upgrades['disablelogin'])) {
auth_setup();
}
if (!$upgrades) {
die_info(get_string('noupgrades', 'admin'));
}
......
......@@ -45,8 +45,12 @@ function check_upgrades($name=null) {
$toupgrade = array();
$installing = false;
$disablelogin = false;
require('version.php');
if (isset($config->disablelogin) && !empty($config->disablelogin)) {
$disablelogin = true;
}
// check core first...
if (empty($name) || $name == 'core') {
try {
......@@ -64,6 +68,10 @@ function check_upgrades($name=null) {
$installing = true;
}
else if ($config->version > $coreversion) {
if (isset($config->minupgradefrom) && $coreversion < $config->minupgradefrom) {
throw new SanityException("Must upgrade to $config->minupgradefrom first "
." (you have $coreversion)");
}
$core = new StdClass;
$core->upgrade = true;
$core->from = $coreversion;
......@@ -126,6 +134,9 @@ function check_upgrades($name=null) {
}
require(get_config('docroot') . $pluginpath . '/version.php');
if (isset($config->disablelogin) && !empty($config->disablelogin)) {
$disablelogin = true;
}
}
if (empty($pluginversion)) {
......@@ -139,6 +150,10 @@ function check_upgrades($name=null) {
$toupgrade[$pluginkey] = $plugininfo;
}
else if ($config->version > $pluginversion) {
if (isset($config->minupgradefrom) && $pluginversion < $config->minupgradefrom) {
throw new SanityException("Must upgrade to $config->minupgradefrom first "
." (you have $pluginversion)");
}
$plugininfo = new StdClass;
$plugininfo->upgrade = true;
$plugininfo->from = $pluginversion;
......@@ -156,8 +171,10 @@ function check_upgrades($name=null) {
foreach ((array)$toupgrade[$name] as $key => $value) {
$upgrade->{$key} = $value;
}
$upgrade->disablelogin = $disablelogin;
return $upgrade;
}
$toupgrade['disablelogin'] = $disablelogin;
return $toupgrade;
}
......
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