From a9a37b5363e5f08013ab8b4b7bff02652c3a4d12 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Aug 2014 16:59:56 +0200 Subject: [PATCH 1/3] Don't automatically setup the filesystem the moment we load OC\Files\FileSystem --- lib/base.php | 1 + lib/private/files/filesystem.php | 2 -- lib/private/user.php | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/base.php b/lib/base.php index 176f799f94d..6ec5f69e45d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -776,6 +776,7 @@ class OC { if (OC_User::isLoggedIn()) { OC_App::loadApps(); OC_User::setupBackends(); + OC_Util::setupFS(); if (isset($_GET["logout"]) and ($_GET["logout"])) { OC_JSON::callCheck(); if (isset($_COOKIE['oc_token'])) { diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index 1dbe66143ac..db46bcfd1ea 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -794,5 +794,3 @@ class Filesystem { return self::$defaultInstance->getETag($path); } } - -\OC_Util::setupFS(); diff --git a/lib/private/user.php b/lib/private/user.php index c9b1522f85a..509a7c71209 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -232,7 +232,11 @@ class OC_User { */ public static function login($uid, $password) { session_regenerate_id(true); - return self::getUserSession()->login($uid, $password); + $result = self::getUserSession()->login($uid, $password); + if ($result) { + OC_Util::setupFS($uid); + } + return $result; } /** From 724ff6264abce5778065ebb77beda7a49777e48c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Aug 2014 17:00:35 +0200 Subject: [PATCH 2/3] Remove unneeded file initialization in encryption, already handled in a hook --- apps/files_encryption/appinfo/app.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index a90f618e245..922d9885164 100644 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -35,22 +35,6 @@ if (!OC_Config::getValue('maintenance', false)) { if(!in_array('crypt', stream_get_wrappers())) { stream_wrapper_register('crypt', 'OCA\Encryption\Stream'); } - - // check if we are logged in - if (OCP\User::isLoggedIn()) { - - // ensure filesystem is loaded - if (!\OC\Files\Filesystem::$loaded) { - \OC_Util::setupFS(); - } - - $view = new OC\Files\View('/'); - - $sessionReady = OCA\Encryption\Helper::checkRequirements(); - if($sessionReady) { - $session = new \OCA\Encryption\Session($view); - } - } } else { // logout user if we are in maintenance to force re-login OCP\User::logout(); From 3c618a0252384da7c7aef3ecfd8034e1fe559efd Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Aug 2014 17:58:23 +0200 Subject: [PATCH 3/3] Also setup the filesystem when matching routes --- lib/base.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/base.php b/lib/base.php index 6ec5f69e45d..1a99835040a 100644 --- a/lib/base.php +++ b/lib/base.php @@ -721,6 +721,7 @@ class OC { OC_App::loadApps(); } self::checkSingleUserMode(); + OC_Util::setupFS(); OC::$server->getRouter()->match(OC_Request::getRawPathInfo()); return; } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {