Proper logging for appstore updates

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2017-05-11 13:35:17 -05:00
parent 23b6f0e4d7
commit caa0ae94e8
3 changed files with 25 additions and 2 deletions

View file

@ -220,8 +220,14 @@ class Upgrade extends Command {
$updater->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use ($output) {
$output->writeln('<comment>Disabled 3rd-party app: ' . $app . '</comment>');
});
$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($output) {
$output->writeln('<info>Checking for update of app ' . $app . ' in appstore</info>');
});
$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($output) {
$output->writeln('<info>Update 3rd-party app: ' . $app . '</info>');
$output->writeln('<info>Update app ' . $app . ' from appstore</info>');
});
$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($output) {
$output->writeln('<info>Checked for update of app "' . $app . '" in appstore </info>');
});
$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($output) {
$output->writeln('<info>Checking updates of apps</info>');

View file

@ -160,6 +160,15 @@ if (OC::checkUpgrade(false)) {
$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking updates of apps'));
});
$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app]));
});
$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app]));
});
$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app]));
});
$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]));
});

View file

@ -447,10 +447,12 @@ class Updater extends BasicEmitter {
$this->log,
\OC::$server->getConfig()
);
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
if (Installer::isUpdateAvailable($app, \OC::$server->getAppFetcher())) {
$this->emit('\OC\Updater', 'upgradeAppStoreApp', [$app]);
$installer->updateAppstoreApp($app);
}
$this->emit('\OC\Updater', 'checkAppStoreApp', [$app]);
} catch (\Exception $ex) {
$this->log->logException($ex, ['app' => 'core']);
}
@ -578,8 +580,14 @@ class Updater extends BasicEmitter {
$this->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use ($log) {
$log->info('\OC\Updater::thirdPartyAppDisabled: Disabled 3rd-party app: ' . $app, ['app' => 'updater']);
});
$this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) {
$log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']);
});
$this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) {
$log->info('\OC\Updater::upgradeAppStoreApp: Update 3rd-party app: ' . $app, ['app' => 'updater']);
$log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']);
});
$this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) {
$log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']);
});
$this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) {
$log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']);