Added failsafes for retrieving remote apps on settings->apps page, in case categories or app data are not found
This commit is contained in:
parent
842cd57fa7
commit
9df403f051
17
lib/app.php
17
lib/app.php
|
@ -563,7 +563,12 @@ class OC_App{
|
||||||
|
|
||||||
if ( is_array( $catagoryNames ) ) {
|
if ( is_array( $catagoryNames ) ) {
|
||||||
|
|
||||||
$categories = array_keys( $catagoryNames );
|
// Check that categories of apps were retrieved correctly
|
||||||
|
if ( ! $categories = array_keys( $catagoryNames ) ) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$page = 0;
|
$page = 0;
|
||||||
|
|
||||||
|
@ -589,7 +594,15 @@ class OC_App{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $app1;
|
if ( empty( $app1 ) ) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $app1;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,7 +53,7 @@ class OC_OCSClient{
|
||||||
/**
|
/**
|
||||||
* @brief Get all the categories from the OCS server
|
* @brief Get all the categories from the OCS server
|
||||||
* @returns array with category ids
|
* @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
|
* This function returns a list of all the application categories on the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getCategories() {
|
public static function getCategories() {
|
||||||
|
|
|
@ -31,10 +31,6 @@ OC_App::setActiveNavigationEntry( "core_apps" );
|
||||||
|
|
||||||
$installedApps = OC_App::getAllApps();
|
$installedApps = OC_App::getAllApps();
|
||||||
|
|
||||||
$remoteApps = OC_App::getAppstoreApps();
|
|
||||||
|
|
||||||
//$remoteApps = array();
|
|
||||||
|
|
||||||
//TODO which apps do we want to blacklist and how do we integrate blacklisting with the multi apps folder feature?
|
//TODO which apps do we want to blacklist and how do we integrate blacklisting with the multi apps folder feature?
|
||||||
|
|
||||||
$blacklist = array('files');//we dont want to show configuration for these
|
$blacklist = array('files');//we dont want to show configuration for these
|
||||||
|
@ -90,28 +86,38 @@ foreach ( $installedApps as $app ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicates
|
$remoteApps = OC_App::getAppstoreApps();
|
||||||
foreach ( $appList as $app ) {
|
|
||||||
|
|
||||||
foreach ( $remoteApps AS $key => $remote ) {
|
if ( $remoteApps ) {
|
||||||
|
|
||||||
if (
|
// Remove duplicates
|
||||||
$app['name'] == $remote['name']
|
foreach ( $appList as $app ) {
|
||||||
// To set duplicate detection to use OCS ID instead of string name,
|
|
||||||
// enable this code, remove the line of code above,
|
|
||||||
// and add <ocs_id>[ID]</ocs_id> to info.xml of each 3rd party app:
|
|
||||||
// OR $app['ocs_id'] == $remote['ocs_id']
|
|
||||||
) {
|
|
||||||
|
|
||||||
unset( $remoteApps[$key]);
|
foreach ( $remoteApps AS $key => $remote ) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
$app['name'] == $remote['name']
|
||||||
|
// To set duplicate detection to use OCS ID instead of string name,
|
||||||
|
// enable this code, remove the line of code above,
|
||||||
|
// and add <ocs_id>[ID]</ocs_id> to info.xml of each 3rd party app:
|
||||||
|
// OR $app['ocs_id'] == $remote['ocs_id']
|
||||||
|
) {
|
||||||
|
|
||||||
|
unset( $remoteApps[$key]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
$combinedApps = array_merge( $appList, $remoteApps );
|
||||||
|
|
||||||
$combinedApps = array_merge( $appList, $remoteApps );
|
} else {
|
||||||
|
|
||||||
|
$combinedApps = $appList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function app_sort( $a, $b ) {
|
function app_sort( $a, $b ) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue