From e7c106d91e9970b95061eaa2812a0d0c5be72526 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 14 May 2012 00:28:22 +0200 Subject: [PATCH] selective app loading for remote/public --- apps/calendar/appinfo/remote.php | 4 ++++ apps/contacts/appinfo/remote.php | 4 ++++ apps/files/appinfo/info.xml | 3 +++ apps/files/appinfo/remote.php | 1 + apps/files_sharing/get.php | 4 ++++ apps/media/remote.php | 6 +++++- lib/app.php | 16 ++++++++++++---- public.php | 9 +++++++-- remote.php | 7 ++++++- 9 files changed, 46 insertions(+), 8 deletions(-) diff --git a/apps/calendar/appinfo/remote.php b/apps/calendar/appinfo/remote.php index 7ff6a2fbbe2..0673c36540f 100755 --- a/apps/calendar/appinfo/remote.php +++ b/apps/calendar/appinfo/remote.php @@ -7,6 +7,10 @@ */ OCP\App::checkAppEnabled('calendar'); +// only need authentication apps +$RUNTIME_APPTYPES=array('authentication'); +OC_App::loadApps($RUNTIME_APPTYPES); + // Backends $authBackend = new OC_Connector_Sabre_Auth(); $principalBackend = new OC_Connector_Sabre_Principal(); diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php index 67006b77f97..9a34ecd4a4c 100755 --- a/apps/contacts/appinfo/remote.php +++ b/apps/contacts/appinfo/remote.php @@ -22,6 +22,10 @@ OCP\App::checkAppEnabled('contacts'); +// only need authentication apps +$RUNTIME_APPTYPES=array('authentication'); +OC_App::loadApps($RUNTIME_APPTYPES); + // Backends $authBackend = new OC_Connector_Sabre_Auth(); $principalBackend = new OC_Connector_Sabre_Principal(); diff --git a/apps/files/appinfo/info.xml b/apps/files/appinfo/info.xml index 76a06a0cb4b..92d0a50814e 100644 --- a/apps/files/appinfo/info.xml +++ b/apps/files/appinfo/info.xml @@ -8,6 +8,9 @@ 2 + + + appinfo/remote.php appinfo/remote.php diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index 465e0c0a935..b66843556bb 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -24,6 +24,7 @@ */ // only need filesystem apps $RUNTIME_APPTYPES=array('filesystem','authentication'); +OC_App::loadApps($RUNTIME_APPTYPES); // Backends $authBackend = new OC_Connector_Sabre_Auth(); diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php index caf25d00cfd..e326a170075 100755 --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -1,6 +1,10 @@ \ No newline at end of file diff --git a/lib/app.php b/lib/app.php index bc4f9c87e96..04fa0ff495d 100644 --- a/lib/app.php +++ b/lib/app.php @@ -65,9 +65,7 @@ class OC_App{ $apps = self::getEnabledApps(); foreach( $apps as $app ){ if((is_null($types) or self::isType($app,$types))){ - if(is_file(OC::$APPSROOT.'/apps/'.$app.'/appinfo/app.php')){ - require( $app.'/appinfo/app.php' ); - } + self::loadApp($app); } } @@ -77,6 +75,16 @@ class OC_App{ return true; } + /** + * load a single app + * @param string app + */ + public static function loadApp($app){ + if(is_file(OC::$APPSROOT.'/apps/'.$app.'/appinfo/app.php')){ + require_once( $app.'/appinfo/app.php' ); + } + } + /** * check if an app is of a sepcific type * @param string $app @@ -115,7 +123,7 @@ class OC_App{ self::$appTypes[$app]=''; } - OC_Appconfig::setValue($app,'types',implode(',',self::$appTypes[$app])); + OC_Appconfig::setValue($app,'types',self::$appTypes[$app]); } return explode(',',self::$appTypes[$app]); diff --git a/public.php b/public.php index 27a75adec93..f974e1c50d2 100644 --- a/public.php +++ b/public.php @@ -1,10 +1,15 @@