Skip to content

Commit

Permalink
Merge pull request #1033 from nextcloud/fix_theming_autoloader_magic
Browse files Browse the repository at this point in the history
Fix theming autoloader magic
  • Loading branch information
rullzer committed Aug 24, 2016
2 parents b124647 + 60974de commit 42ef336
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 2 additions & 3 deletions apps/theming/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 10 additions & 4 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 42ef336

Please sign in to comment.