Avoid fetch ocs info if the appstore is disabled
This commit is contained in:
parent
06e20fe4b8
commit
2d2366bb57
|
@ -57,6 +57,9 @@ class OC_OCSClient{
|
||||||
* This function returns a list of all the application categories on the OCS server
|
* This function returns a list of all the application categories on the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getCategories(){
|
public static function getCategories(){
|
||||||
|
if(OC_Config::getValue('appstoreenabled', true)==false){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
|
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
|
||||||
|
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
|
@ -130,6 +133,9 @@ class OC_OCSClient{
|
||||||
* This function returns an applications from the OCS server
|
* This function returns an applications from the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getApplication($id){
|
public static function getApplication($id){
|
||||||
|
if(OC_Config::getValue('appstoreenabled', true)==false){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
|
$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
|
||||||
|
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
|
@ -157,31 +163,34 @@ class OC_OCSClient{
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the download url for an application from the OCS server
|
* @brief Get the download url for an application from the OCS server
|
||||||
* @returns array with application data
|
* @returns array with application data
|
||||||
*
|
*
|
||||||
* This function returns an download url for an applications from the OCS server
|
* This function returns an download url for an applications from the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getApplicationDownload($id,$item){
|
public static function getApplicationDownload($id,$item){
|
||||||
$url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
|
if(OC_Config::getValue('appstoreenabled', true)==false){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
$url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
|
||||||
|
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
if($xml==FALSE){
|
if($xml==FALSE){
|
||||||
OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
|
OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
$data=simplexml_load_string($xml);
|
$data=simplexml_load_string($xml);
|
||||||
|
|
||||||
$tmp=$data->data->content;
|
$tmp=$data->data->content;
|
||||||
$app=array();
|
$app=array();
|
||||||
if(isset($tmp->downloadlink)) {
|
if(isset($tmp->downloadlink)) {
|
||||||
$app['downloadlink']=$tmp->downloadlink;
|
$app['downloadlink']=$tmp->downloadlink;
|
||||||
}else{
|
}else{
|
||||||
$app['downloadlink']='';
|
$app['downloadlink']='';
|
||||||
}
|
}
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue