From: Marcel Werk Date: Tue, 17 Mar 2020 17:50:26 +0000 (+0100) Subject: fixed issue when creating language variables in monolingual installations X-Git-Tag: 5.2.4~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ee1cfc9ac605cadf2c606b3104ece430f4c275b3;p=GitHub%2FWoltLab%2FWCF.git fixed issue when creating language variables in monolingual installations --- diff --git a/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php b/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php index 3d4cde2a90..b048db29f3 100644 --- a/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php +++ b/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php @@ -54,13 +54,27 @@ class LanguageItemAction extends AbstractDatabaseObjectAction { $this->parameters['data']['packageID'] = 1; } - foreach ($this->parameters['languageItemValue_i18n'] as $languageID => $value) { + if (!empty($this->parameters['languageItemValue_i18n'])) { + // multiple languages + foreach ($this->parameters['languageItemValue_i18n'] as $languageID => $value) { + (new LanguageItemAction([], 'create', [ + 'data' => array_merge( + $this->parameters['data'], + [ + 'languageID' => $languageID, + 'languageItemValue' => $value + ] + ) + ]))->executeAction(); + } + } + else { + // single language (new LanguageItemAction([], 'create', [ 'data' => array_merge( $this->parameters['data'], [ - 'languageID' => $languageID, - 'languageItemValue' => $value + 'languageID' => LanguageFactory::getInstance()->getDefaultLanguageID() ] ) ]))->executeAction();