[Pkg-owncloud-commits] [owncloud] 01/03: Add oc version to app store requests in stable6
David Prévot
taffit at moszumanska.debian.org
Thu Jul 2 18:39:07 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v6.0.9RC1
in repository owncloud.
commit 6ef3fbe5908273b161eeddbc024b4b9ac7b9d6e8
Author: Joas Schilling <nickvergessen at owncloud.com>
Date: Mon Jun 29 15:45:50 2015 +0200
Add oc version to app store requests in stable6
---
lib/private/app.php | 8 ++++----
lib/private/installer.php | 2 +-
lib/private/ocsclient.php | 38 ++++++++++++++++++++++++++------------
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 d4683b3..9425c10 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 31da3f1..cbcd63e 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 d4a3e59..ed640fb 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 b68083f..8139a73 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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list