[Pkg-owncloud-commits] [owncloud] 62/199: Now showing disabled apps as upgrade status line

David Prévot taffit at moszumanska.debian.org
Sun Jun 1 18:53:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 02f682b156998a3f3f94fd506867c28eba878da9
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue May 27 15:20:33 2014 +0200

    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
---
 core/ajax/update.php            | 8 ++++++++
 core/command/upgrade.php        | 3 +++
 core/templates/update.admin.php | 4 ++--
 lib/base.php                    | 2 +-
 lib/private/app.php             | 8 ++++++++
 lib/private/updater.php         | 5 ++++-
 6 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/core/ajax/update.php b/core/ajax/update.php
index 55e8ab1..84d7a21 100644
--- a/core/ajax/update.php
+++ b/core/ajax/update.php
@@ -15,6 +15,14 @@ if (OC::checkUpgrade(false)) {
 	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
 		$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) {
 		$eventSource->send('failure', $message);
 		$eventSource->close();
diff --git a/core/command/upgrade.php b/core/command/upgrade.php
index ed72d13..8ce8ef9 100644
--- a/core/command/upgrade.php
+++ b/core/command/upgrade.php
@@ -56,6 +56,9 @@ class Upgrade extends Command {
 			$updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) {
 				$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) {
 				$output->writeln($message);
diff --git a/core/templates/update.admin.php b/core/templates/update.admin.php
index 0b1ae78..b9b0fdb 100644
--- a/core/templates/update.admin.php
+++ b/core/templates/update.admin.php
@@ -8,8 +8,8 @@
 		<div class="section">
 			<div class="title bold"><?php p($l->t('The following apps will be disabled during the upgrade:')) ?></div>
 			<ul class="content appList">
-			<?php foreach ($_['appList'] as $appName) { ?>
-			<li><?php p($appName) ?></li>
+			<?php foreach ($_['appList'] as $appInfo) { ?>
+			<li><?php p($appInfo['name']) ?> (<?php p($appInfo['id']) ?>)</li>
 			<?php } ?>
 			</ul>
 		</div>
diff --git a/lib/base.php b/lib/base.php
index 455e8ad..7bca1b7 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -298,7 +298,7 @@ class OC {
 				foreach ($apps as $appId) {
 					$info = OC_App::getAppInfo($appId);
 					if(!OC_App::isAppCompatible($version, $info)) {
-						$incompatibleApps[] = $info['name'];
+						$incompatibleApps[] = $info;
 					}
 				}
 				$tmpl->assign('appList', $incompatibleApps);
diff --git a/lib/private/app.php b/lib/private/app.php
index 5006519..ea0453e 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -889,8 +889,14 @@ class OC_App{
 	 * ownCloud version. disable them if not.
 	 * This is important if you upgrade ownCloud and have non ported 3rd
 	 * 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()) {
+		$disabledApps = array();
 		if (empty($apps)) {
 			$apps = OC_App::getEnabledApps();
 		}
@@ -905,8 +911,10 @@ class OC_App{
 					OC_Log::ERROR);
 				OC_App::disable( $app );
 				OC_Hook::emit('update', 'success', 'Disabled '.$info['name'].' app because it is not compatible');
+				$disabledApps[] = $app;
 			}
 		}
+		return $disabledApps;
 	}
 
 	/**
diff --git a/lib/private/updater.php b/lib/private/updater.php
index d8694ac..58d3cab 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -134,7 +134,10 @@ class Updater extends BasicEmitter {
 			$this->emit('\OC\Updater', 'failure', array($exception->getMessage()));
 		}
 		\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
 		\OC_App::loadApps();
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list