From: Marcel Werk Date: Wed, 22 May 2024 15:58:49 +0000 (+0200) Subject: Fix empty custom page urls when importing a new language X-Git-Tag: 6.0.14_dev_1~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e4a0c76f8f4d0fac6772d22ba45c48900bd08ea0;p=GitHub%2FWoltLab%2FWCF.git Fix empty custom page urls when importing a new language --- diff --git a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php index b58a1df575..e1480431c4 100644 --- a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php +++ b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php @@ -562,10 +562,13 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje $pageIDs[$row['identifier']] = $row['pageID']; } - $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_page_content - (pageID, languageID) - VALUES (?, ?)"; - $createLanguageVersionStatement = WCF::getDB()->prepareStatement($sql); + $sql = "INSERT IGNORE INTO wcf1_page_content + (pageID, languageID, title, content, metaDescription, customURL, hasEmbeddedObjects) + SELECT pageID, ?, title, content, metaDescription, CASE WHEN customURL <> '' THEN CONCAT(customURL, '_', ?) ELSE '' END, hasEmbeddedObjects + FROM wcf1_page_content + WHERE pageID = ? + AND languageID = ?"; + $createLanguageVersionStatement = WCF::getDB()->prepare($sql); $sql = "UPDATE wcf" . WCF_N . "_page_content SET title = ? WHERE pageID = ? @@ -582,7 +585,12 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje continue; // unknown page } - $createLanguageVersionStatement->execute([$pageIDs[$identifier], $this->languageID]); + $createLanguageVersionStatement->execute([ + $this->languageID, + $this->languageID, + $pageIDs[$identifier], + LanguageFactory::getInstance()->getDefaultLanguageID(), + ]); if (isset($pageContent['title'])) { $updateTitleStatement->execute([$pageContent['title'], $pageIDs[$identifier], $this->languageID]); }