diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-06-29 15:07:00 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-06-29 15:07:00 +0200 |
commit | b56af26199aaaf5ca2a2969b0886e6b9b1ae622f (patch) | |
tree | 3aef003fb719aa28ce13d54c561593121e395b51 /lib/private/ocsclient.php | |
parent | 70eb20e3a7b65759cdea99279c53953379898d6f (diff) | |
parent | ae3d402dbc3c9620cea5b32bedc7f00874b12dd0 (diff) | |
download | nextcloud-server-b56af26199aaaf5ca2a2969b0886e6b9b1ae622f.tar.gz nextcloud-server-b56af26199aaaf5ca2a2969b0886e6b9b1ae622f.zip |
Merge pull request #17222 from owncloud/issue-17101-send-oc-version-to-app-store
Send OC version to appstore so it can reply with the right links
Diffstat (limited to 'lib/private/ocsclient.php')
-rw-r--r-- | lib/private/ocsclient.php | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index 7b5be4ac504..9fd3bb13733 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -106,11 +106,12 @@ class OCSClient { /** * Get all the categories from the OCS server * + * @param array $targetVersion The target ownCloud version * @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 */ - public function getCategories() { + public function getCategories($targetVersion) { if (!$this->isAppStoreEnabled()) { return null; } @@ -121,6 +122,9 @@ class OCSClient { $this->getAppStoreUrl() . '/content/categories', [ 'timeout' => 5, + 'query' => [ + 'version' => implode('x', $targetVersion), + ], ] ); } catch(\Exception $e) { @@ -155,9 +159,10 @@ class OCSClient { * @param array $categories * @param int $page * @param string $filter + * @param array $targetVersion The target ownCloud version * @return array An array of application data */ - public function getApplications(array $categories, $page, $filter) { + public function getApplications(array $categories, $page, $filter, $targetVersion) { if (!$this->isAppStoreEnabled()) { return []; } @@ -169,7 +174,7 @@ class OCSClient { [ 'timeout' => 5, 'query' => [ - 'version' => implode('x', \OC_Util::getVersion()), + 'version' => implode('x', $targetVersion), 'filter' => $filter, 'categories' => implode('x', $categories), 'sortmode' => 'new', @@ -229,11 +234,12 @@ class 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 function getApplication($id) { + public function getApplication($id, $targetVersion) { if (!$this->isAppStoreEnabled()) { return null; } @@ -244,6 +250,9 @@ class OCSClient { $this->getAppStoreUrl() . '/content/data/' . urlencode($id), [ 'timeout' => 5, + 'query' => [ + 'version' => implode('x', $targetVersion), + ], ] ); } catch(\Exception $e) { @@ -291,10 +300,11 @@ class OCSClient { /** * Get the download url for an application from the OCS server - * @param $id + * @param string $id + * @param array $targetVersion The target ownCloud version * @return array|null an array of application data or null */ - public function getApplicationDownload($id) { + public function getApplicationDownload($id, $targetVersion) { if (!$this->isAppStoreEnabled()) { return null; } @@ -305,6 +315,9 @@ class OCSClient { $url, [ 'timeout' => 5, + 'query' => [ + 'version' => implode('x', $targetVersion), + ], ] ); } catch(\Exception $e) { |