Now showing disabled apps as upgrade status line

- Added app id in update overview.
- Added status message for disabled app for CLI upgrade and web upgrade
This commit is contained in:
Vincent Petry 2014-05-27 15:20:33 +02:00
parent 146583a98d
commit 02f682b156
6 changed files with 26 additions and 4 deletions

View File

@ -15,6 +15,14 @@ if (OC::checkUpgrade(false)) {
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated database')); $eventSource->send('success', (string)$l->t('Updated database'));
}); });
$updater->listen('\OC\Updater', 'disabledApps', function ($appList) use ($eventSource, $l) {
$list = array();
foreach ($appList as $appId) {
$info = OC_App::getAppInfo($appId);
$list[] = $info['name'] . ' (' . $info['id'] . ')';
}
$eventSource->send('success', (string)$l->t('Disabled incompatible apps: %s', implode(', ', $list)));
});
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) { $updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) {
$eventSource->send('failure', $message); $eventSource->send('failure', $message);
$eventSource->close(); $eventSource->close();

View File

@ -56,6 +56,9 @@ class Upgrade extends Command {
$updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) { $updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) {
$output->writeln('<info>Updated database</info>'); $output->writeln('<info>Updated database</info>');
}); });
$updater->listen('\OC\Updater', 'disabledApps', function ($appList) use($output) {
$output->writeln('<info>Disabled incompatible apps: ' . implode(', ', $appList) . '</info>');
});
$updater->listen('\OC\Updater', 'failure', function ($message) use($output) { $updater->listen('\OC\Updater', 'failure', function ($message) use($output) {
$output->writeln($message); $output->writeln($message);

View File

@ -8,8 +8,8 @@
<div class="section"> <div class="section">
<div class="title bold"><?php p($l->t('The following apps will be disabled during the upgrade:')) ?></div> <div class="title bold"><?php p($l->t('The following apps will be disabled during the upgrade:')) ?></div>
<ul class="content appList"> <ul class="content appList">
<?php foreach ($_['appList'] as $appName) { ?> <?php foreach ($_['appList'] as $appInfo) { ?>
<li><?php p($appName) ?></li> <li><?php p($appInfo['name']) ?> (<?php p($appInfo['id']) ?>)</li>
<?php } ?> <?php } ?>
</ul> </ul>
</div> </div>

View File

@ -298,7 +298,7 @@ class OC {
foreach ($apps as $appId) { foreach ($apps as $appId) {
$info = OC_App::getAppInfo($appId); $info = OC_App::getAppInfo($appId);
if(!OC_App::isAppCompatible($version, $info)) { if(!OC_App::isAppCompatible($version, $info)) {
$incompatibleApps[] = $info['name']; $incompatibleApps[] = $info;
} }
} }
$tmpl->assign('appList', $incompatibleApps); $tmpl->assign('appList', $incompatibleApps);

View File

@ -889,8 +889,14 @@ class OC_App{
* ownCloud version. disable them if not. * ownCloud version. disable them if not.
* This is important if you upgrade ownCloud and have non ported 3rd * This is important if you upgrade ownCloud and have non ported 3rd
* party apps installed. * party apps installed.
*
* @param array $apps optional app id list to check, uses all enabled apps
* when not specified
*
* @return array containing the list of ids of the disabled apps
*/ */
public static function checkAppsRequirements($apps = array()) { public static function checkAppsRequirements($apps = array()) {
$disabledApps = array();
if (empty($apps)) { if (empty($apps)) {
$apps = OC_App::getEnabledApps(); $apps = OC_App::getEnabledApps();
} }
@ -905,8 +911,10 @@ class OC_App{
OC_Log::ERROR); OC_Log::ERROR);
OC_App::disable( $app ); OC_App::disable( $app );
OC_Hook::emit('update', 'success', 'Disabled '.$info['name'].' app because it is not compatible'); OC_Hook::emit('update', 'success', 'Disabled '.$info['name'].' app because it is not compatible');
$disabledApps[] = $app;
} }
} }
return $disabledApps;
} }
/** /**

View File

@ -134,7 +134,10 @@ class Updater extends BasicEmitter {
$this->emit('\OC\Updater', 'failure', array($exception->getMessage())); $this->emit('\OC\Updater', 'failure', array($exception->getMessage()));
} }
\OC_Config::setValue('version', implode('.', \OC_Util::getVersion())); \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
\OC_App::checkAppsRequirements(); $disabledApps = \OC_App::checkAppsRequirements();
if (!empty($disabledApps)) {
$this->emit('\OC\Updater', 'disabledApps', array($disabledApps));
}
// load all apps to also upgrade enabled apps // load all apps to also upgrade enabled apps
\OC_App::loadApps(); \OC_App::loadApps();