From afbe50d09c7d9e5cbed2a09bc915ba4eaa8ced27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Feb 2014 09:44:13 +0100 Subject: [PATCH 1/9] remove global variable $RUNTIME_NOAPPS - it's just superfluous --- core/command/upgrade.php | 3 --- index.php | 2 -- lib/base.php | 3 +-- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/core/command/upgrade.php b/core/command/upgrade.php index 1d105b67a0..2eded15e9f 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -30,9 +30,6 @@ class Upgrade extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - global $RUNTIME_NOAPPS; - - $RUNTIME_NOAPPS = true; //no apps, yet require_once \OC::$SERVERROOT . '/lib/base.php'; diff --git a/index.php b/index.php index 0a2f15f9f5..bd94d0e908 100755 --- a/index.php +++ b/index.php @@ -21,8 +21,6 @@ * */ -$RUNTIME_NOAPPS = true; //no apps, yet - try { require_once 'lib/base.php'; diff --git a/lib/base.php b/lib/base.php index f2d9251294..b230ca2e54 100644 --- a/lib/base.php +++ b/lib/base.php @@ -569,9 +569,8 @@ class OC { // Load Apps // This includes plugins for users and filesystems as well - global $RUNTIME_NOAPPS; global $RUNTIME_APPTYPES; - if (!$RUNTIME_NOAPPS && !self::checkUpgrade(false)) { + if (!self::checkUpgrade(false)) { if ($RUNTIME_APPTYPES) { OC_App::loadApps($RUNTIME_APPTYPES); } else { From 21207c6a73bbaf43c6afaceda51690e77fad06f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Feb 2014 09:50:11 +0100 Subject: [PATCH 2/9] remove superfluous $RUNTIME_APPTYPES --- apps/files/ajax/download.php | 6 ------ apps/files/ajax/getstoragestats.php | 3 --- apps/files/ajax/list.php | 6 ------ apps/files/ajax/rawlist.php | 3 --- apps/files_trashbin/ajax/list.php | 6 ------ 5 files changed, 24 deletions(-) diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php index 6a34cbe4ef..58037cb0c8 100644 --- a/apps/files/ajax/download.php +++ b/apps/files/ajax/download.php @@ -21,12 +21,6 @@ * */ -// only need filesystem apps -$RUNTIME_APPTYPES=array('filesystem'); - -// Init owncloud - - // Check if we are a user OCP\User::checkLoggedIn(); diff --git a/apps/files/ajax/getstoragestats.php b/apps/files/ajax/getstoragestats.php index dd7c7dc557..69a26ed8eb 100644 --- a/apps/files/ajax/getstoragestats.php +++ b/apps/files/ajax/getstoragestats.php @@ -1,8 +1,5 @@ Date: Thu, 6 Feb 2014 10:04:18 +0100 Subject: [PATCH 3/9] remove some more global variable $RUNTIME_NOAPPS --- console.php | 1 - core/ajax/update.php | 1 - lib/base.php | 5 ----- lib/private/util.php | 4 +--- public.php | 1 - remote.php | 1 - status.php | 2 -- 7 files changed, 1 insertion(+), 14 deletions(-) diff --git a/console.php b/console.php index 25b8b31253..fc6957062b 100644 --- a/console.php +++ b/console.php @@ -8,7 +8,6 @@ use Symfony\Component\Console\Application; -$RUNTIME_NOAPPS = true; require_once 'lib/base.php'; // Don't do anything if ownCloud has not been installed yet diff --git a/core/ajax/update.php b/core/ajax/update.php index d6af84e95b..99e8f27531 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -1,6 +1,5 @@ Date: Thu, 6 Feb 2014 11:34:27 +0100 Subject: [PATCH 4/9] Within OC:init() the minimum set of apps is loaded - which is filesystem, authentication and logging --- apps/files/appinfo/remote.php | 6 ------ core/command/user/report.php | 3 +-- lib/base.php | 15 ++++----------- lib/private/user.php | 2 -- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index ef22fe9218..8d762d4e88 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -22,12 +22,6 @@ * License along with this library. If not, see . * */ -// load needed apps -$RUNTIME_APPTYPES = array('filesystem', 'authentication', 'logging'); - -OC_App::loadApps($RUNTIME_APPTYPES); - -OC_Util::obEnd(); // Backends $authBackend = new OC_Connector_Sabre_Auth(); diff --git a/core/command/user/report.php b/core/command/user/report.php index f95ba251bc..d6b7abacab 100644 --- a/core/command/user/report.php +++ b/core/command/user/report.php @@ -48,7 +48,6 @@ class Report extends Command { } private function countUsers() { - \OC_App::loadApps(array('authentication')); $userManager = \OC::$server->getUserManager(); return $userManager->countUsers(); } @@ -58,4 +57,4 @@ class Report extends Command { $userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory'); return count($userDirectories); } -} \ No newline at end of file +} diff --git a/lib/base.php b/lib/base.php index 18adfd3120..fb7baf86a5 100644 --- a/lib/base.php +++ b/lib/base.php @@ -567,15 +567,9 @@ class OC { OC_User::logout(); } - // Load Apps - // This includes plugins for users and filesystems as well - global $RUNTIME_APPTYPES; + // Load minimum set of apps - which is filesystem, authentication and logging if (!self::checkUpgrade(false)) { - if ($RUNTIME_APPTYPES) { - OC_App::loadApps($RUNTIME_APPTYPES); - } else { - OC_App::loadApps(); - } + OC_App::loadApps(array('filesystem', 'authentication', 'logging')); } //setup extra user backends @@ -866,7 +860,7 @@ class OC { ) { return false; } - OC_App::loadApps(array('authentication')); + if (defined("DEBUG") && DEBUG) { OC_Log::write('core', 'Trying to login from cookie', OC_Log::DEBUG); } @@ -938,7 +932,7 @@ class OC { ) { return false; } - OC_App::loadApps(array('authentication')); + if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); OC_User::unsetMagicInCookie(); @@ -967,4 +961,3 @@ if (!function_exists('get_temp_dir')) { } OC::init(); - diff --git a/lib/private/user.php b/lib/private/user.php index 98ebebbe5c..11f96aabf7 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -317,8 +317,6 @@ class OC_User { */ public static function isLoggedIn() { if (\OC::$session->get('user_id') && self::$incognitoMode === false) { - OC_App::loadApps(array('authentication')); - self::setupBackends(); return self::userExists(\OC::$session->get('user_id')); } return false; From 8f5c641cd854d27abc876db8dda4ec0025981186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 18 Feb 2014 14:51:59 +0100 Subject: [PATCH 5/9] load all apps in ocs/v1.php --- ocs/v1.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ocs/v1.php b/ocs/v1.php index 1c7d1c8976..93d9c67b04 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -21,12 +21,18 @@ * */ -require_once('../lib/base.php'); +require_once '../lib/base.php'; + use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; try { + // load all apps to get all api routes properly setup + OC_App::loadApps(); + + // match the request OC::getRouter()->match('/ocs'.OC_Request::getRawPathInfo()); + } catch (ResourceNotFoundException $e) { OC_OCS::notFound(); } catch (MethodNotAllowedException $e) { From e139f7c863d5971a6386070148496cb0f70ad04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 18 Feb 2014 17:17:08 +0100 Subject: [PATCH 6/9] load all apps to get all cron jobs executed --- cron.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cron.php b/cron.php index 0d2c07b2d9..1065a70028 100644 --- a/cron.php +++ b/cron.php @@ -48,6 +48,9 @@ try { require_once 'lib/base.php'; + // load all apps to get all api routes properly setup + OC_App::loadApps(); + session_write_close(); $logger = \OC_Log::$object; From 96e6cb3db4a97a1397dc56d3d1c1a5131e45b972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 21 Mar 2014 15:00:25 +0100 Subject: [PATCH 7/9] all authentication apps are loaded at first - everything else relies on these apps --- lib/base.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/base.php b/lib/base.php index d02d9e1d26..40729f0511 100644 --- a/lib/base.php +++ b/lib/base.php @@ -549,7 +549,8 @@ class OC { // Load minimum set of apps - which is filesystem, authentication and logging if (!self::checkUpgrade(false)) { - OC_App::loadApps(array('filesystem', 'authentication', 'logging')); + OC_App::loadApps(array('authentication')); + OC_App::loadApps(array('filesystem', 'logging')); } //setup extra user backends From f9279ac77ac8f4541bd0237fd5126f10cb7798a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 25 Mar 2014 17:42:41 +0100 Subject: [PATCH 8/9] killing some more calls to OC_App::loadApps(); - because we load all apps in handleRequest() --- apps/files/command/scan.php | 1 - core/ajax/share.php | 1 - search/ajax/search.php | 1 - settings/admin.php | 1 - settings/apps.php | 1 - settings/changepassword/controller.php | 6 ------ settings/help.php | 1 - settings/personal.php | 1 - settings/settings.php | 1 - settings/users.php | 1 - 10 files changed, 15 deletions(-) diff --git a/apps/files/command/scan.php b/apps/files/command/scan.php index f334f29a93..25ab70af36 100644 --- a/apps/files/command/scan.php +++ b/apps/files/command/scan.php @@ -58,7 +58,6 @@ class Scan extends Command { protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('all')) { - \OC_App::loadApps('authentication'); $users = $this->userManager->search(''); } else { $users = $input->getArgument('user_id'); diff --git a/core/ajax/share.php b/core/ajax/share.php index 3f04e1e4ad..e667d9b5fa 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -21,7 +21,6 @@ OC_JSON::checkLoggedIn(); OCP\JSON::callCheck(); -OC_App::loadApps(); $defaults = new \OCP\Defaults(); diff --git a/search/ajax/search.php b/search/ajax/search.php index f0ca5752b9..0cc1f9d30c 100644 --- a/search/ajax/search.php +++ b/search/ajax/search.php @@ -23,7 +23,6 @@ // Check if we are a user OC_JSON::checkLoggedIn(); -OC_App::loadApps(); $query=(isset($_GET['query']))?$_GET['query']:''; if($query) { diff --git a/settings/admin.php b/settings/admin.php index 80b038d2ef..5e04f34367 100755 --- a/settings/admin.php +++ b/settings/admin.php @@ -6,7 +6,6 @@ */ OC_Util::checkAdminUser(); -OC_App::loadApps(); OC_Util::addStyle( "settings", "settings" ); OC_Util::addScript( "settings", "admin" ); diff --git a/settings/apps.php b/settings/apps.php index 96b6d21b50..6fd2efc201 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -22,7 +22,6 @@ */ OC_Util::checkAdminUser(); -OC_App::loadApps(); // Load the files we need OC_Util::addStyle( "settings", "settings" ); diff --git a/settings/changepassword/controller.php b/settings/changepassword/controller.php index e8c2a1943f..9f1e732996 100644 --- a/settings/changepassword/controller.php +++ b/settings/changepassword/controller.php @@ -8,9 +8,6 @@ class Controller { \OC_JSON::callCheck(); \OC_JSON::checkLoggedIn(); - // Manually load apps to ensure hooks work correctly (workaround for issue 1503) - \OC_App::loadApps(); - $username = \OC_User::getUser(); $password = isset($_POST['personal-password']) ? $_POST['personal-password'] : null; $oldPassword = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : ''; @@ -32,9 +29,6 @@ class Controller { \OC_JSON::callCheck(); \OC_JSON::checkLoggedIn(); - // Manually load apps to ensure hooks work correctly (workaround for issue 1503) - \OC_App::loadApps(); - if (isset($_POST['username'])) { $username = $_POST['username']; } else { diff --git a/settings/help.php b/settings/help.php index 88693939b8..301f50592a 100644 --- a/settings/help.php +++ b/settings/help.php @@ -6,7 +6,6 @@ */ OC_Util::checkLoggedIn(); -OC_App::loadApps(); // Load the files we need OC_Util::addStyle( "settings", "settings" ); diff --git a/settings/personal.php b/settings/personal.php index cf1a496bdf..be1aa6400b 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -6,7 +6,6 @@ */ OC_Util::checkLoggedIn(); -OC_App::loadApps(); $defaults = new OC_Defaults(); // initialize themable default strings and urls diff --git a/settings/settings.php b/settings/settings.php index 1e05452ec4..c08732fcf6 100644 --- a/settings/settings.php +++ b/settings/settings.php @@ -6,7 +6,6 @@ */ OC_Util::checkLoggedIn(); -OC_App::loadApps(); OC_Util::addStyle( 'settings', 'settings' ); OC_App::setActiveNavigationEntry( 'settings' ); diff --git a/settings/users.php b/settings/users.php index 2f1c63a0b5..f09d0e90d3 100644 --- a/settings/users.php +++ b/settings/users.php @@ -6,7 +6,6 @@ */ OC_Util::checkSubAdminUser(); -OC_App::loadApps(); // We have some javascript foo! OC_Util::addScript( 'settings', 'users' ); From 8b86b94d47d7fa78669bdc4f17e4b1fa39079787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 25 Mar 2014 17:46:05 +0100 Subject: [PATCH 9/9] call OC_App::loadApps(); to load all commands of all apps and related functionality --- console.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/console.php b/console.php index fc6957062b..dd2c1026e4 100644 --- a/console.php +++ b/console.php @@ -21,6 +21,9 @@ if (!OC::$CLI) { exit(0); } +// load all apps to get all api routes properly setup +OC_App::loadApps(); + $defaults = new OC_Defaults; $application = new Application($defaults->getName(), \OC_Util::getVersionString()); require_once 'core/register_command.php';