Skip to content
Snippets Groups Projects
Commit 14241a37 authored by Peter Rotich's avatar Peter Rotich
Browse files

Fix regression on upgrader

parent f855f5aa
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,12 @@ class Upgrader {
return $this->getCurrentStream()->check_mysql();
}
function getTask() {
if($this->getCurrentStream())
return $this->getCurrentStream()->getTask();
}
function doTask() {
return $this->getCurrentStream()->doTask();
}
......@@ -263,7 +269,7 @@ class StreamUpgrader extends SetupWizard {
function isFinished() {
# TODO: 1. Check if current and target hashes match,
# 2. Any pending tasks
return !($this->getNextPatch() || $this->getPendingTasks());
return !($this->getNextPatch() || $this->getPendingTask());
}
function readPatchInfo($patch) {
......@@ -301,6 +307,8 @@ class StreamUpgrader extends SetupWizard {
}
function getTask() {
global $ost;
$task_file = $this->getSQLDir() . "{$this->phash}.task.php";
if (!file_exists($task_file))
return null;
......@@ -308,7 +316,7 @@ class StreamUpgrader extends SetupWizard {
if (!isset($this->task)) {
$class = (include $task_file);
if (!is_string($class) || !class_exists($class))
return $ost->logError("{$phash}:{$class}: Bogus migration task");
return $ost->logError("{$this->phash}:{$class}: Bogus migration task");
$this->task = new $class();
if (isset($_SESSION['ost_upgrader']['task'][$this->phash]))
$this->task->wakeup($_SESSION['ost_upgrader']['task'][$this->phash]);
......@@ -410,7 +418,7 @@ class StreamUpgrader extends SetupWizard {
return 0;
$ost->logDebug('Upgrader', sprintf("%s: Unable to process cleanup file",
$phash));
$this->phash));
return 0;
}
}
......
......@@ -32,11 +32,11 @@ if($_POST && $_POST['s'] && !$upgrader->isAborted()) {
$errors['err']='Config file rename required to continue!';
} else {
$upgrader->setState('upgrade');
}
}
break;
case 'upgrade': //Manual upgrade.... when JS (ajax) is not supported.
if($upgrader->getNumPendingTasks()) {
$upgrader->doTasks();
if($upgrader->getPendingTask()) {
$upgrader->doTask();
} elseif($ost->isUpgradePending() && $upgrader->isUpgradable()) {
$upgrader->upgrade();
} elseif(!$ost->isUpgradePending()) {
......
......@@ -63,10 +63,8 @@ class Test {
function assert($expr, $message) {
if ($expr)
$this->pass();
elseif ($message)
$this->fail('', '', $message);
else
$this->fail('', '', "assertion: {$a} != {$b}");
$this->fail('', '', $message);
}
function assertEqual($a, $b, $message=false) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment