diff --git a/setup/upgrade.php b/setup/upgrade.php index f535498..8b2fce7 100644 --- a/setup/upgrade.php +++ b/setup/upgrade.php @@ -55,15 +55,15 @@ function generateUpgradeTable () { function showResult($res) { if (PEAR::isError($res)) { if (is_a($res, 'Upgrade_Already_Applied')) { - return "Already applied"; + return 'Already applied'; } - return $res->toString(); + return sprintf('%s', htmlspecialchars($res->toString())); } if ($res === true) { - return "Success"; + return 'Success'; } if ($res === false) { - return "Failure"; + return 'Failure'; } return $res; } @@ -76,15 +76,23 @@ function performAllUpgrades () { $upgrades = describeUpgrade($lastVersion, $currentVersion); - print "\n"; - print "\n"; foreach ($upgrades as $upgrade) { + printf('
%s
', htmlspecialchars($upgrade->getDescription())); $res = $upgrade->performUpgrade(); - printf("\n", - htmlspecialchars($upgrade->getDescription()), - htmlspecialchars(showResult($res))); + printf('
%s
', showResult($res)); + print '
' . "\n"; + ob_flush(); + flush(); + if (PEAR::isError($res)) { + if (!is_a($res, 'Upgrade_Already_Applied')) { + break; + } + } + if ($res === false) { + break; + } + } - print '
DescriptionResult
%s%s
'; return $ret; }