diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-29 17:35:30 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-06-29 17:35:30 +0300 |
commit | d3d8a799d1729e6179d1d192cc07f30ab49a29c8 (patch) | |
tree | 9ba7153b61d2df39135895ef427b2a6afeb830ca | |
parent | f48fe48f19749a1b574150e3837acd22cc376072 (diff) | |
parent | 6ef3fbe5908273b161eeddbc024b4b9ac7b9d6e8 (diff) |
Merge pull request #17237 from owncloud/oc-version-to-app-store-stable6
Add oc version to app store requests in stable6
-rw-r--r-- | lib/private/app.php | 8 | ||||
-rw-r--r-- | lib/private/installer.php | 2 | ||||
-rw-r--r-- | lib/private/ocsclient.php | 38 | ||||
-rw-r--r-- | settings/ajax/apps/ocs.php | 4 |
4 files changed, 33 insertions, 19 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index d4683b3ba99..9425c109779 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -225,8 +225,8 @@ class OC_App{ if(!is_numeric($app)) { $app = OC_Installer::installShippedApp($app); }else{ - $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']!='') { $info = array('source'=>'http', 'href'=>$download['downloadlink'], 'appdata'=>$appdata); $app=OC_Installer::installApp($info); @@ -799,7 +799,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 ) ) { @@ -807,7 +807,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 ) { diff --git a/lib/private/installer.php b/lib/private/installer.php index 31da3f1d039..cbcd63e670d 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -274,7 +274,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($ocsversion<>$currentversion) { diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index d4a3e595a24..ed640fbf17c 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -61,12 +61,15 @@ class OC_OCSClient{ * @returns array with category ids * @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(OC_Config::getValue('appstoreenabled', true)==false) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { return null; @@ -94,8 +97,12 @@ class OC_OCSClient{ * @returns array with application data * * This function returns a list of all the applications on the OCS server + * @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(OC_Config::getValue('appstoreenabled', true)==false) { return(array()); } @@ -106,7 +113,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; @@ -144,16 +151,19 @@ class OC_OCSClient{ /** - * @brief Get an the applications from the OCS server - * @returns array with application data + * 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(OC_Config::getValue('appstoreenabled', true)==false) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id); + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { @@ -186,16 +196,20 @@ class OC_OCSClient{ } /** - * @brief Get the download url for an application from the OCS server - * @returns array with application data - * - * This function returns an download url for an applications from the OCS server - */ - public static function getApplicationDownload($id, $item) { + * Get the download url for an application from the OCS server + * @return array|null an array of application data or null + * + * 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, array $targetVersion) { if(OC_Config::getValue('appstoreenabled', true)==false) { 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; |