Skip to content

Commit 0ad6f55

Browse files
committed
Insert check if sharedTemplateGroupID already set
1 parent deab30a commit 0ad6f55

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

wcfsetup/install/files/lib/system/template/TemplateEngine.class.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,17 +1044,19 @@ protected function getCompileFilePrefix(string $templateName): string
10441044

10451045
private function getSharedTemplateGroupID(): int
10461046
{
1047-
$templateGroup = \array_find(
1048-
TemplateGroupCacheBuilder::getInstance()->getData(),
1049-
static fn (TemplateGroup $group) => $group->templateGroupFolderName === '_wcf_shared/'
1050-
);
1047+
if (!isset($this->sharedTemplateGroupID)) {
1048+
$templateGroup = \array_find(
1049+
TemplateGroupCacheBuilder::getInstance()->getData(),
1050+
static fn(TemplateGroup $group) => $group->templateGroupFolderName === '_wcf_shared/'
1051+
);
1052+
1053+
if ($templateGroup === null) {
1054+
throw new \RuntimeException('Shared template group not found');
1055+
}
10511056

1052-
if ($templateGroup === null) {
1053-
throw new \RuntimeException('Shared template group not found');
1057+
$this->sharedTemplateGroupID = $templateGroup->templateGroupID;
10541058
}
10551059

1056-
$this->sharedTemplateGroupID = $templateGroup->templateGroupID;
1057-
10581060
return $this->sharedTemplateGroupID;
10591061
}
10601062
}

0 commit comments

Comments
 (0)