diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-29 16:35:24 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-06-29 16:35:24 +0200 |
commit | 4448c06f145349847faf061ad64394b9673928cc (patch) | |
tree | bcff30bbe4495f8bbfa93a2c30b5b225ef670d28 | |
parent | c1bed643a0698d8c5027e4c7dd54d9198e915e72 (diff) | |
parent | f5f92447e5696200a97cfc78cd8d703c88c82bf5 (diff) | |
download | nextcloud-server-4448c06f145349847faf061ad64394b9673928cc.tar.gz nextcloud-server-4448c06f145349847faf061ad64394b9673928cc.zip |
Merge pull request #17234 from owncloud/oc-version-to-app-store-stable7
Add oc version to app store requests in stable7
-rw-r--r-- | lib/private/app.php | 10 | ||||
-rw-r--r-- | lib/private/installer.php | 6 | ||||
-rw-r--r-- | lib/private/ocsclient.php | 18 | ||||
-rw-r--r-- | settings/ajax/apps/ocs.php | 4 |
4 files changed, 23 insertions, 15 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index 971277595e9..05842ed18ab 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -288,8 +288,8 @@ class OC_App { * @return int */ public static function downloadApp($app) { - $appData=OC_OCSClient::getApplication($app); - $download=OC_OCSClient::getApplicationDownload($app, 1); + $appData=OC_OCSClient::getApplication($app, \OC_Util::getVersion()); + $download=OC_OCSClient::getApplicationDownload($app, 1, \OC_Util::getVersion()); if(isset($download['downloadlink']) and $download['downloadlink']!='') { // Replace spaces in download link without encoding entire URL $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); @@ -928,7 +928,7 @@ class OC_App { * Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description */ public static function getAppstoreApps($filter = 'approved') { - $categoryNames = OC_OCSClient::getCategories(); + $categoryNames = OC_OCSClient::getCategories(\OC_Util::getVersion()); if (is_array($categoryNames)) { // Check that categories of apps were retrieved correctly if (!$categories = array_keys($categoryNames)) { @@ -936,7 +936,7 @@ class OC_App { } $page = 0; - $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter); + $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter, \OC_Util::getVersion()); $app1 = array(); $i = 0; foreach ($remoteApps as $app) { @@ -1141,7 +1141,7 @@ class OC_App { */ public static function installApp($app) { $l = OC_L10N::get('core'); - $appData=OC_OCSClient::getApplication($app); + $appData=OC_OCSClient::getApplication($app, \OC_Util::getVersion()); // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string if(!is_numeric($app)) { diff --git a/lib/private/installer.php b/lib/private/installer.php index dc9a3558b75..0295335fa51 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -206,8 +206,8 @@ class OC_Installer{ * @throws Exception */ public static function updateAppByOCSId($ocsid, $isShipped=false) { - $appdata = OC_OCSClient::getApplication($ocsid); - $download = OC_OCSClient::getApplicationDownload($ocsid, 1); + $appdata = OC_OCSClient::getApplication($ocsid, \OC_Util::getVersion()); + $download = OC_OCSClient::getApplicationDownload($ocsid, 1, \OC_Util::getVersion()); if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') { $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); @@ -369,7 +369,7 @@ class OC_Installer{ if($ocsid<>'') { - $ocsdata=OC_OCSClient::getApplication($ocsid); + $ocsdata=OC_OCSClient::getApplication($ocsid, \OC_Util::getVersion()); $ocsversion= (string) $ocsdata['version']; $currentversion=OC_App::getAppVersion($app); if (version_compare($ocsversion, $currentversion, '>')) { diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index dc147dea0c9..5c3ff0b3961 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -67,12 +67,15 @@ class OC_OCSClient{ * @return array|null an array of category ids or null * @note returns NULL if config value appstoreenabled is set to false * This function returns a list of all the application categories on the OCS server + * + * @param array $targetVersion The target ownCloud version */ - public static function getCategories() { + public static function getCategories(array $targetVersion) { if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { return null; @@ -103,8 +106,9 @@ class OC_OCSClient{ * @param array|string $categories * @param int $page * @param string $filter + * @param array $targetVersion The target ownCloud version */ - public static function getApplications($categories, $page, $filter) { + public static function getApplications($categories, $page, $filter, array $targetVersion) { if(!self::isAppstoreEnabled()) { return(array()); } @@ -115,7 +119,7 @@ class OC_OCSClient{ $categoriesstring=$categories; } - $version='&version='.implode('x', \OC_Util::getVersion()); + $version='&version='.implode('x', $targetVersion); $filterurl='&filter='.urlencode($filter); $url=OC_OCSClient::getAppStoreURL().'/content/data?categories='.urlencode($categoriesstring) .'&sortmode=new&page='.urlencode($page).'&pagesize=100'.$filterurl.$version; @@ -155,15 +159,17 @@ class OC_OCSClient{ /** * Get an the applications from the OCS server * @param string $id + * @param array $targetVersion The target ownCloud version * @return array|null an array of application data or null * * This function returns an applications from the OCS server */ - public static function getApplication($id) { + public static function getApplication($id, array $targetVersion) { if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id); + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { @@ -206,12 +212,14 @@ class OC_OCSClient{ * This function returns an download url for an applications from the OCS server * @param string $id * @param integer $item + * @param array $targetVersion The target ownCloud version */ - public static function getApplicationDownload($id, $item) { + public static function getApplicationDownload($id, $item, array $targetVersion) { if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item); + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { diff --git a/settings/ajax/apps/ocs.php b/settings/ajax/apps/ocs.php index b68083fca6b..8139a73c807 100644 --- a/settings/ajax/apps/ocs.php +++ b/settings/ajax/apps/ocs.php @@ -23,12 +23,12 @@ if(is_null($enabledApps)) { $apps=array(); // apps from external repo via OCS -$categoryNames=OC_OCSClient::getCategories(); +$categoryNames=OC_OCSClient::getCategories(\OC_Util::getVersion()); if(is_array($categoryNames)) { $categories=array_keys($categoryNames); $page=0; $filter='approved'; - $externalApps=OC_OCSClient::getApplications($categories, $page, $filter); + $externalApps=OC_OCSClient::getApplications($categories, $page, $filter, \OC_Util::getVersion()); foreach($externalApps as $app) { // show only external apps that aren't enabled yet $local=false; |