Merge pull request #19918 from owncloud/send-begin-message

Update: state which step we are going to start and warn if it might b…
This commit is contained in:
Thomas Müller 2015-10-21 14:52:19 +02:00
commit f7f2a160dd
3 changed files with 30 additions and 0 deletions

View file

@ -68,12 +68,24 @@ if (OC::checkUpgrade(false)) {
$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
});
$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updating database schema'));
});
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated database'));
});
$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
});
$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked database schema update'));
});
$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking updates of apps'));
});
$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
});
$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
});

View file

@ -155,9 +155,15 @@ class Upgrade extends Command {
}
$output->writeln($message);
});
$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use($output) {
$output->writeln('<info>Updating database schema</info>');
});
$updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) {
$output->writeln('<info>Updated database</info>');
});
$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($output) {
$output->writeln('<info>Checking whether the database schema can be updated (this can take a long time depending on the database size)</info>');
});
$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($output) {
$output->writeln('<info>Checked database schema update</info>');
});
@ -176,6 +182,12 @@ class Upgrade extends Command {
$updater->listen('\OC\Updater', 'repairError', function ($app) use($output) {
$output->writeln('<error>Repair error: ' . $app . '</error>');
});
$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($output) {
$output->writeln('<info>Checking updates of apps</info>');
});
$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($output) {
$output->writeln("<info>Checking whether the database schema for <$app> can be updated (this can take a long time depending on the database size)</info>");
});
$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($output) {
$output->writeln('<info>Checked database schema update for apps</info>');
});

View file

@ -340,6 +340,8 @@ class Updater extends BasicEmitter {
}
protected function checkCoreUpgrade() {
$this->emit('\OC\Updater', 'dbSimulateUpgradeBefore');
// simulate core DB upgrade
\OC_DB::simulateUpdateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
@ -347,6 +349,8 @@ class Updater extends BasicEmitter {
}
protected function doCoreUpgrade() {
$this->emit('\OC\Updater', 'dbUpgradeBefore');
// do the real upgrade
\OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
@ -358,6 +362,7 @@ class Updater extends BasicEmitter {
*/
protected function checkAppUpgrade($version) {
$apps = \OC_App::getEnabledApps();
$this->emit('\OC\Updater', 'appUpgradeCheckBefore');
foreach ($apps as $appId) {
$info = \OC_App::getAppInfo($appId);
@ -375,6 +380,7 @@ class Updater extends BasicEmitter {
$this->includePreUpdate($appId);
}
if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
$this->emit('\OC\Updater', 'appSimulateUpdate', array($appId));
\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
}
}