summaryrefslogtreecommitdiffstats
path: root/lib/app.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.php')
-rwxr-xr-xlib/app.php33
1 files changed, 28 insertions, 5 deletions
diff --git a/lib/app.php b/lib/app.php
index db2df7c2434..5fccf1fe68f 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -35,6 +35,7 @@ class OC_App{
static private $adminForms = array();
static private $personalForms = array();
static private $appInfo = array();
+ static private $appTypes = array();
/**
* @brief loads all apps
@@ -85,11 +86,7 @@ class OC_App{
if(is_string($types)){
$types=array($types);
}
- $appData=self::getAppInfo($app);
- if(!isset($appData['types'])){
- return false;
- }
- $appTypes=$appData['types'];
+ $appTypes=self::getAppTypes($app);
foreach($types as $type){
if(array_search($type,$appTypes)!==false){
return true;
@@ -97,6 +94,32 @@ class OC_App{
}
return false;
}
+
+ /**
+ * get the types of an app
+ * @param string $app
+ * @return array
+ */
+ private static function getAppTypes($app){
+ //load the cache
+ if(count(self::$appTypes)==0){
+ self::$appTypes=OC_Appconfig::getValues(false,'types');
+ }
+
+ //get it from info.xml if we haven't cached it
+ if(!isset(self::$appTypes[$app])){
+ $appData=self::getAppInfo($app);
+ if(isset($appData['types'])){
+ self::$appTypes[$app]=$appData['types'];
+ }else{
+ self::$appTypes[$app]=array();
+ }
+
+ OC_Appconfig::setValue($app,'types',implode(',',self::$appTypes[$app]));
+ }
+
+ return explode(',',self::$appTypes[$app]);
+ }
/**
* get all enabled apps