Commit 13aa53b1 authored by catch's avatar catch
Browse files

Issue #2872611 by alexpott: Optimise...

Issue #2872611 by alexpott: Optimise \Drupal\Core\Extension\ThemeHandler::refreshInfo() for the early installer
parent 3a6a71a9
...@@ -216,10 +216,16 @@ public function addTheme(Extension $theme) { ...@@ -216,10 +216,16 @@ public function addTheme(Extension $theme) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function refreshInfo() { public function refreshInfo() {
$this->reset();
$extension_config = $this->configFactory->get('core.extension'); $extension_config = $this->configFactory->get('core.extension');
$installed = $extension_config->get('theme'); $installed = $extension_config->get('theme');
// Only refresh the info if a theme has been installed. Modules are
// installed before themes by the installer and this method is called during
// module installation.
if (empty($installed) && empty($this->list)) {
return;
}
$this->reset();
// @todo Avoid re-scanning all themes by retaining the original (unaltered) // @todo Avoid re-scanning all themes by retaining the original (unaltered)
// theme info somewhere. // theme info somewhere.
$list = $this->rebuildThemeData(); $list = $this->rebuildThemeData();
......
...@@ -42,6 +42,7 @@ class TwigWhiteListTest extends KernelTestBase { ...@@ -42,6 +42,7 @@ class TwigWhiteListTest extends KernelTestBase {
*/ */
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
\Drupal::service('theme_handler')->install(['test_theme']);
$this->installSchema('system', ['sequences']); $this->installSchema('system', ['sequences']);
$this->installEntitySchema('node'); $this->installEntitySchema('node');
$this->installEntitySchema('user'); $this->installEntitySchema('user');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment