adamwill pushed to owncloud (f20). "backport some significant app store fixes from upstream stable8"

notifications at fedoraproject.org notifications at fedoraproject.org
Sat May 2 00:03:50 UTC 2015


>From 9be6c1e6f95257dca63c37b8f52bc74b6b5289db Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam at redhat.com>
Date: Fri, 6 Mar 2015 21:41:46 -0800
Subject: backport some significant app store fixes from upstream stable8


diff --git a/owncloud-8.0.1rc1-fix_appstore.patch b/owncloud-8.0.1rc1-fix_appstore.patch
new file mode 100644
index 0000000..a8cf5a8
--- /dev/null
+++ b/owncloud-8.0.1rc1-fix_appstore.patch
@@ -0,0 +1,146 @@
+diff --git a/lib/private/allconfig.php b/lib/private/allconfig.php
+index 00defd9..d729936 100644
+--- a/lib/private/allconfig.php
++++ b/lib/private/allconfig.php
+@@ -161,7 +161,6 @@ class AllConfig implements \OCP\IConfig {
+ 		\OC::$server->getAppConfig()->deleteApp($appName);
+ 	}
+ 
+-
+ 	/**
+ 	 * Set a user defined value
+ 	 *
+diff --git a/lib/private/app.php b/lib/private/app.php
+index 9e9a388..d3dcf1f 100644
+--- a/lib/private/app.php
++++ b/lib/private/app.php
+@@ -277,6 +277,7 @@ class OC_App {
+ 	 */
+ 	public static function enable($app, $groups = null) {
+ 		self::$enabledAppsCache = array(); // flush
++
+ 		if (!OC_Installer::isInstalled($app)) {
+ 			$app = self::installApp($app);
+ 		}
+@@ -327,6 +328,12 @@ class OC_App {
+ 		self::$enabledAppsCache = array(); // flush
+ 		// check if app is a shipped app or not. if not delete
+ 		\OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
++
++		// Convert OCS ID to regular application identifier
++		if(self::getInternalAppIdByOcs($app) !== false) {
++			$app = self::getInternalAppIdByOcs($app);
++		}
++
+ 		OC_Appconfig::setValue($app, 'enabled', 'no' );
+ 	}
+ 
+@@ -897,6 +904,21 @@ class OC_App {
+ 	}
+ 
+ 	/**
++	 * Returns the internal app ID or false
++	 * @param string $ocsID
++	 * @return string|false
++	 */
++	protected static function getInternalAppIdByOcs($ocsID) {
++		if(is_numeric($ocsID)) {
++			$idArray = \OC::$server->getAppConfig()->getValues(false, 'ocsid');
++			if(array_search($ocsID, $idArray)) {
++				return array_search($ocsID, $idArray);
++			}
++		}
++		return false;
++	}
++
++	/**
+ 	 * get a list of all apps on apps.owncloud.com
+ 	 * @return array, multi-dimensional array of apps.
+ 	 *     Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description
+@@ -921,11 +943,13 @@ class OC_App {
+ 		$i = 0;
+ 		$l = \OC::$server->getL10N('core');
+ 		foreach ($remoteApps as $app) {
++			$potentialCleanId = self::getInternalAppIdByOcs($app['id']);
+ 			// enhance app info (for example the description)
+ 			$app1[$i] = OC_App::parseAppInfo($app);
+ 			$app1[$i]['author'] = $app['personid'];
+ 			$app1[$i]['ocs_id'] = $app['id'];
+-			$app1[$i]['internal'] = $app1[$i]['active'] = 0;
++			$app1[$i]['internal'] = 0;
++			$app1[$i]['active'] = ($potentialCleanId !== false) ? self::isEnabled($potentialCleanId) : false;
+ 			$app1[$i]['update'] = false;
+ 			$app1[$i]['groups'] = false;
+ 			$app1[$i]['score'] = $app['score'];
+@@ -1055,7 +1079,6 @@ class OC_App {
+ 		}
+ 	}
+ 
+-
+ 	/**
+ 	 * @param mixed $app
+ 	 * @return bool
+@@ -1075,8 +1098,21 @@ class OC_App {
+ 			} else {
+ 				$app = OC_Installer::installShippedApp($app);
+ 			}
+-		}else{
+-			$app = self::downloadApp($app);
++		} else {
++			// Maybe the app is already installed - compare the version in this
++			// case and use the local already installed one.
++			// FIXME: This is a horrible hack. I feel sad. The god of code cleanness may forgive me.
++			$internalAppId = self::getInternalAppIdByOcs($app);
++			if($internalAppId !== false) {
++				if($appData && version_compare(\OC_App::getAppVersion($internalAppId), $appData['version'], '<')) {
++					$app = self::downloadApp($app);
++				} else {
++					self::enable($internalAppId);
++					$app = $internalAppId;
++				}
++			} else {
++				$app = self::downloadApp($app);
++			}
+ 		}
+ 
+ 		if($app!==false) {
+diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php
+index 868a413..96384ce 100644
+--- a/lib/public/iconfig.php
++++ b/lib/public/iconfig.php
+@@ -109,7 +109,6 @@ interface IConfig {
+ 	 */
+ 	public function deleteAppValues($appName);
+ 
+-
+ 	/**
+ 	 * Set a user defined value
+ 	 *
+diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php
+index 1a133ea..be717e2 100644
+--- a/settings/ajax/disableapp.php
++++ b/settings/ajax/disableapp.php
+@@ -11,8 +11,7 @@ $appId = $_POST['appid'];
+ $appId = OC_App::cleanAppId($appId);
+ 
+ // FIXME: Clear the cache - move that into some sane helper method
+-\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0');
+-\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1');
++\OC::$server->getMemCacheFactory()->create('settings')->clear('listApps-');
+ 
+ OC_App::disable($appId);
+ OC_JSON::success();
+diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php
+index 88abff4..fcfa278 100644
+--- a/settings/ajax/enableapp.php
++++ b/settings/ajax/enableapp.php
+@@ -8,8 +8,7 @@ $groups = isset($_POST['groups']) ? $_POST['groups'] : null;
+ try {
+ 	OC_App::enable(OC_App::cleanAppId($_POST['appid']), $groups);
+ 	// FIXME: Clear the cache - move that into some sane helper method
+-	\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0');
+-	\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1');
++	\OC::$server->getMemCacheFactory()->create('settings')->clear('listApps-');
+ 	OC_JSON::success();
+ } catch (Exception $e) {
+ 	OC_Log::write('core', $e->getMessage(), OC_Log::ERROR);
diff --git a/owncloud.spec b/owncloud.spec
index 66d49bd..c3eb2d3 100644
--- a/owncloud.spec
+++ b/owncloud.spec
@@ -1,6 +1,6 @@
 Name:           owncloud
 Version:        8.0.1
-Release:        0.1.rc1%{?dist}
+Release:        0.2.rc1%{?dist}
 Summary:        Private file sync and share server
 
 License:        AGPLv3+ and MIT and BSD and CC-BY and CC-BY-SA and GPLv3 and Public Domain and (MPLv1.1 or GPLv2+ or LGPLv2+) and (MIT or GPL+) and (MIT or GPLv2) and ASL 2.0 and LGPLv3
@@ -62,6 +62,9 @@ Patch7:        owncloud-8.0.0-disable_minify.patch
 # Stop OC from trying to do stuff to .htaccess files. Just calm down, OC.
 # Distributors are on the case.
 Patch8:         0001-setup-allow-disabling-all-htaccess-fiddling.patch
+# Fix significant app store bugs. Squashed backport of several commits from
+# upstream stable8 branch, just post-8.0.1 RC1.
+Patch9:         owncloud-8.0.1rc1-fix_appstore.patch
 
 BuildArch:      noarch
 
@@ -244,6 +247,7 @@ sed -i 's/\r$//' apps/files_encryption/lib/crypt.php
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
+%patch9 -p1
 
 # prepare package doc
 cp %{SOURCE3} README.fedora
@@ -465,6 +469,9 @@ fi
 
 
 %changelog
+* Fri Mar 06 2015 Adam Williamson <awilliam at redhat.com> - 8.0.1-0.2.rc1
+- backport some significant app store fixes from upstream stable8
+
 * Fri Mar 06 2015 Adam Williamson <awilliam at redhat.com> - 8.0.1-0.1.rc1
 - update to 8.0.1rc1
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/owncloud.git/commit/?h=f20&id=9be6c1e6f95257dca63c37b8f52bc74b6b5289db


More information about the scm-commits mailing list