diff --git a/apps/files_archive/appinfo/info.xml b/apps/files_archive/appinfo/info.xml index df767d39f6b602d297fb040c3017737b870dfa50..236b5a64b0586b8f27025dd7ac68a4700792f81e 100644 --- a/apps/files_archive/appinfo/info.xml +++ b/apps/files_archive/appinfo/info.xml @@ -7,4 +7,7 @@ <licence>AGPL</licence> <author>Robin Appelman</author> <require>3</require> + <types> + <filesystem/> + </types> </info> diff --git a/apps/files_encryption/appinfo/info.xml b/apps/files_encryption/appinfo/info.xml index 053044aaed25a74d2def50f69259fa33fc9696ff..691b265bf60721ca3d0914633d78edd48cd48ebb 100644 --- a/apps/files_encryption/appinfo/info.xml +++ b/apps/files_encryption/appinfo/info.xml @@ -7,4 +7,7 @@ <licence>AGPL</licence> <author>Robin Appelman</author> <require>3</require> + <types> + <filesystem/> + </types> </info> diff --git a/apps/files_remote/appinfo/info.xml b/apps/files_remote/appinfo/info.xml index 0720b6095b918ff6ef5107f2b37e37989ac734db..8cf66ddbc3742c251f7d8da6f161246926fc2c15 100644 --- a/apps/files_remote/appinfo/info.xml +++ b/apps/files_remote/appinfo/info.xml @@ -7,4 +7,7 @@ <licence>AGPL</licence> <author>Robin Appelman</author> <require>3</require> + <types> + <filesystem/> + </types> </info> diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml index abf847b4483a2ccf6a8d747f2b5f9148608790fa..8fda775520b602ae4b217b975aeeb0fb221f811c 100644 --- a/apps/files_sharing/appinfo/info.xml +++ b/apps/files_sharing/appinfo/info.xml @@ -8,4 +8,7 @@ <author>Michael Gapczynski</author> <require>2</require> <default_enable/> + <types> + <filesystem/> + </types> </info> diff --git a/files/ajax/download.php b/files/ajax/download.php index 198069f3fa1c212a83360a13443fdfe39f867c97..39852613ab95ae10dd86fd86b7e07e029dc1d7db 100644 --- a/files/ajax/download.php +++ b/files/ajax/download.php @@ -21,6 +21,9 @@ * */ +// only need filesystem apps +$RUNTIME_APPTYPES=array('filesystem'); + // Init owncloud require_once('../../lib/base.php'); diff --git a/files/ajax/list.php b/files/ajax/list.php index 8a414827e1c8c43db3dee18a0005ea89e87c17c9..ec9ab7342dd94df17585afc359de882816c375c0 100644 --- a/files/ajax/list.php +++ b/files/ajax/list.php @@ -1,5 +1,8 @@ <?php +// only need filesystem apps +$RUNTIME_APPTYPES=array('filesystem'); + // Init owncloud require_once('../../lib/base.php'); diff --git a/files/ajax/mimeicon.php b/files/ajax/mimeicon.php index 8724016b3a190b25e2010dcd78fbebe05cfdad18..ff72ba0f5b76af7142000c5b981a7f60dc6f6d22 100644 --- a/files/ajax/mimeicon.php +++ b/files/ajax/mimeicon.php @@ -1,5 +1,8 @@ <?php +// no need for apps +$RUNTIME_NOAPPS=false; + // Init owncloud require_once('../../lib/base.php'); diff --git a/files/webdav.php b/files/webdav.php index 6fae33a8f719bc50f65d9584616b936e442533d7..1120973787c8bce721c4ee39bcd2163b9f15e877 100644 --- a/files/webdav.php +++ b/files/webdav.php @@ -26,6 +26,9 @@ // Do not load FS ... $RUNTIME_NOSETUPFS = true; +// only need filesystem apps +$RUNTIME_APPTYPES=array('filesystem'); + require_once('../lib/base.php'); // Backends diff --git a/lib/app.php b/lib/app.php index fa0a1d22d15bd1f9c006d9a2e39141b7f354e422..6c882963a0231091c925a2ed4518933be4d40f6c 100755 --- a/lib/app.php +++ b/lib/app.php @@ -34,16 +34,20 @@ class OC_App{ static private $settingsForms = array(); static private $adminForms = array(); static private $personalForms = array(); + static private $appInfo = array(); /** * @brief loads all apps + * @param array $types * @returns true/false * * This function walks through the owncloud directory and loads all apps * it can find. A directory contains an app if the file /appinfo/app.php * exists. + * + * if $types is set, only apps of those types will be loaded */ - public static function loadApps(){ + public static function loadApps($types=null){ // Did we allready load everything? if( self::$init ){ return true; @@ -51,14 +55,18 @@ class OC_App{ // Our very own core apps are hardcoded foreach( array('files', 'settings') as $app ){ - require( $app.'/appinfo/app.php' ); + if(is_null($types) or self::isType($app,$types)){ + require( $app.'/appinfo/app.php' ); + } } // The rest comes here $apps = self::getEnabledApps(); foreach( $apps as $app ){ - if(is_file(OC::$APPSROOT.'/apps/'.$app.'/appinfo/app.php')){ - require( $app.'/appinfo/app.php' ); + if(is_null($types) or self::isType($app,$types)){ + if(is_file(OC::$APPSROOT.'/apps/'.$app.'/appinfo/app.php')){ + require( $app.'/appinfo/app.php' ); + } } } @@ -68,6 +76,28 @@ class OC_App{ return true; } + /** + * check if an app is of a sepcific type + * @param string $app + * @param string/array $types + */ + public static function isType($app,$types){ + if(is_string($types)){ + $types=array($types); + } + $appData=self::getAppInfo($app); + if(!isset($appData['types'])){ + return false; + } + $appTypes=$appData['types']; + foreach($types as $type){ + if(array_search($type,$appTypes)!==false){ + return true; + } + } + return false; + } + /** * get all enabled apps */ @@ -283,6 +313,9 @@ class OC_App{ if($path){ $file=$appid; }else{ + if(isset(self::$appInfo[$appid])){ + return self::$appInfo[$appid]; + } $file=OC::$APPSROOT.'/apps/'.$appid.'/appinfo/info.xml'; } $data=array(); @@ -293,8 +326,16 @@ class OC_App{ $xml = new SimpleXMLElement($content); $data['info']=array(); foreach($xml->children() as $child){ - $data[$child->getName()]=(string)$child; + if($child->getName()=='types'){ + $data['types']=array(); + foreach($child->children() as $type){ + $data['types'][]=$type->getName(); + } + }else{ + $data[$child->getName()]=(string)$child; + } } + self::$appInfo[$appid]=$data; return $data; } diff --git a/lib/base.php b/lib/base.php index b07ac5af416bb3901d616683b8ab28eeae9d7ff5..b031572f177728be9a1c52ff032b1251e8a2795e 100644 --- a/lib/base.php +++ b/lib/base.php @@ -333,8 +333,13 @@ class OC{ // Load Apps // This includes plugins for users and filesystems as well global $RUNTIME_NOAPPS; + global $RUNTIME_APPTYPES; if(!$RUNTIME_NOAPPS ){ - OC_App::loadApps(); + if($RUNTIME_APPTYPES){ + OC_App::loadApps($RUNTIME_APPTYPES); + }else{ + OC_App::loadApps(); + } } //make sure temporary files are cleaned up