Merge pull request #1034 from nextcloud/stable10_1033

[Stable10] Fix theming autoloader magic
This commit is contained in:
Roeland Jago Douma 2016-08-24 14:17:51 +02:00 committed by GitHub
commit 43ce8b13c1
2 changed files with 12 additions and 7 deletions

View File

@ -29,21 +29,20 @@ use OCP\IConfig;
use OCP\IL10N; use OCP\IL10N;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\Settings\ISettings; use OCP\Settings\ISettings;
use \OC_Defaults;
class Admin implements ISettings { class Admin implements ISettings {
/** @var IConfig */ /** @var IConfig */
private $config; private $config;
/** @var IL10N */ /** @var IL10N */
private $l; private $l;
/** @var ThemingDefaults|OC_Defaults */ /** @var ThemingDefaults */
private $themingDefaults; private $themingDefaults;
/** @var IURLGenerator */ /** @var IURLGenerator */
private $urlGenerator; private $urlGenerator;
public function __construct(IConfig $config, public function __construct(IConfig $config,
IL10N $l, IL10N $l,
OC_Defaults $themingDefaults, ThemingDefaults $themingDefaults,
IURLGenerator $urlGenerator) { IURLGenerator $urlGenerator) {
$this->config = $config; $this->config = $config;
$this->l = $l; $this->l = $l;

View File

@ -642,10 +642,16 @@ class Server extends ServerContainer implements IServerContainer {
return $factory->getManager(); return $factory->getManager();
}); });
$this->registerService('ThemingDefaults', function(Server $c) { $this->registerService('ThemingDefaults', function(Server $c) {
try { /*
$classExists = class_exists('OCA\Theming\ThemingDefaults'); * Dark magic for autoloader.
} catch (\OCP\AutoloadNotAllowedException $e) { * If we do a class_exists it will try to load the class which will
// App disabled or in maintenance mode * 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; $classExists = false;
} }