Fix check if theming defaults instance is available
The check in URLGenerator.php#169 and Server.php#945 are different and thus the DI container could return a \OC_Defaults object which does not provide the wanted method caising a PHP error. Fixes #8420 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
5f8c773b27
commit
eefbcb32ed
|
@ -35,6 +35,7 @@
|
|||
namespace OC;
|
||||
|
||||
|
||||
use OCA\Theming\ThemingDefaults;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
|
@ -170,7 +171,10 @@ class URLGenerator implements IURLGenerator {
|
|||
$themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming');
|
||||
$themingImagePath = false;
|
||||
if($themingEnabled) {
|
||||
$themingImagePath = \OC::$server->getThemingDefaults()->replaceImagePath($app, $image);
|
||||
$themingDefaults = \OC::$server->getThemingDefaults();
|
||||
if ($themingDefaults instanceof ThemingDefaults) {
|
||||
$themingImagePath = $themingDefaults->replaceImagePath($app, $image);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) {
|
||||
|
|
Loading…
Reference in New Issue