From 4e1d50169651f608e4728d72c07e463c62a39b87 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 24 Aug 2016 13:22:21 +0200 Subject: [PATCH 1/2] Dark autoloader magic for ThemingDefaults --- lib/private/Server.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/private/Server.php b/lib/private/Server.php index 86eee54be7076..b651285e9a5ee 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -643,10 +643,16 @@ public function __construct($webRoot, \OC\Config $config) { return $factory->getManager(); }); $this->registerService('ThemingDefaults', function(Server $c) { - try { - $classExists = class_exists('OCA\Theming\ThemingDefaults'); - } catch (\OCP\AutoloadNotAllowedException $e) { - // App disabled or in maintenance mode + /* + * Dark magic for autoloader. + * If we do a class_exists it will try to load the class which will + * make composer cache the result. Resulting in errors when enabling + * the theming app. + */ + $prefixes = \OC::$composerAutoloader->getPrefixesPsr4(); + if (isset($prefixes['OCA\\Theming\\'])) { + $classExists = true; + } else { $classExists = false; } From 60974de97b8fd0b89f7660c78f82ee071c9e65ea Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 24 Aug 2016 13:22:44 +0200 Subject: [PATCH 2/2] Require a ThemingDefaults class again --- apps/theming/lib/Settings/Admin.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php index d0a9f554084d6..1f79449e65816 100644 --- a/apps/theming/lib/Settings/Admin.php +++ b/apps/theming/lib/Settings/Admin.php @@ -29,21 +29,20 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\Settings\ISettings; -use \OC_Defaults; class Admin implements ISettings { /** @var IConfig */ private $config; /** @var IL10N */ private $l; - /** @var ThemingDefaults|OC_Defaults */ + /** @var ThemingDefaults */ private $themingDefaults; /** @var IURLGenerator */ private $urlGenerator; public function __construct(IConfig $config, IL10N $l, - OC_Defaults $themingDefaults, + ThemingDefaults $themingDefaults, IURLGenerator $urlGenerator) { $this->config = $config; $this->l = $l;