summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-29 11:15:56 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-29 12:14:07 +0200
commitae3d402dbc3c9620cea5b32bedc7f00874b12dd0 (patch)
tree8efd85897ad6ae4d138b4f191b31c4164ea9182e /lib/private
parentb55f71ee032a77105b823ee01653f39fe066977f (diff)
downloadnextcloud-server-ae3d402dbc3c9620cea5b32bedc7f00874b12dd0.tar.gz
nextcloud-server-ae3d402dbc3c9620cea5b32bedc7f00874b12dd0.zip
Send OC version to appstore so it can reply with the right links
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/app.php10
-rw-r--r--lib/private/installer.php6
-rw-r--r--lib/private/ocsclient.php25
3 files changed, 27 insertions, 14 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index 4814561baec..c506be1799b 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -312,8 +312,8 @@ class OC_App {
\OC::$server->getConfig(),
\OC::$server->getLogger()
);
- $appData = $ocsClient->getApplication($app);
- $download= $ocsClient->getApplicationDownload($app);
+ $appData = $ocsClient->getApplication($app, \OC_Util::getVersion());
+ $download= $ocsClient->getApplicationDownload($app, \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']);
@@ -918,7 +918,7 @@ class OC_App {
if (is_null($category)) {
- $categoryNames = $ocsClient->getCategories();
+ $categoryNames = $ocsClient->getCategories(\OC_Util::getVersion());
if (is_array($categoryNames)) {
// Check that categories of apps were retrieved correctly
if (!$categories = array_keys($categoryNames)) {
@@ -930,7 +930,7 @@ class OC_App {
}
$page = 0;
- $remoteApps = $ocsClient->getApplications($categories, $page, $filter);
+ $remoteApps = $ocsClient->getApplications($categories, $page, $filter, \OC_Util::getVersion());
$apps = [];
$i = 0;
$l = \OC::$server->getL10N('core');
@@ -1088,7 +1088,7 @@ class OC_App {
$config,
\OC::$server->getLogger()
);
- $appData = $ocsClient->getApplication($app);
+ $appData = $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 41f13f0f5f9..bd214be5667 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -227,8 +227,8 @@ class OC_Installer{
\OC::$server->getConfig(),
\OC::$server->getLogger()
);
- $appData = $ocsClient->getApplication($ocsId);
- $download = $ocsClient->getApplicationDownload($ocsId);
+ $appData = $ocsClient->getApplication($ocsId, \OC_Util::getVersion());
+ $download = $ocsClient->getApplicationDownload($ocsId, \OC_Util::getVersion());
if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') {
$download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']);
@@ -395,7 +395,7 @@ class OC_Installer{
\OC::$server->getConfig(),
\OC::$server->getLogger()
);
- $ocsdata = $ocsClient->getApplication($ocsid);
+ $ocsdata = $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 2868b407000..9fa4aebb5e4 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) {
@@ -290,10 +299,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;
}
@@ -304,6 +314,9 @@ class OCSClient {
$url,
[
'timeout' => 5,
+ 'query' => [
+ 'version' => implode('x', $targetVersion),
+ ],
]
);
} catch(\Exception $e) {