$statement = WCF::getDB()->prepareStatement("UPDATE wcf".WCF_N."_application SET landingPageID = (SELECT pageID FROM wcf".WCF_N."_page WHERE isLandingPage = 1 LIMIT 1) WHERE packageID = 1;");
$statement->execute();
}
+
+
+// remove duplicates in page_content
+$sql = "DELETE FROM wcf".WCF_N."_page_content
+ WHERE pageID = ?
+ AND languageID IS NULL
+ ORDER BY pageContentID DESC
+ LIMIT ?";
+$deleteStatement = WCF::getDB()->prepareStatement($sql);
+
+$sql = "SELECT COUNT(*) AS count, pageID
+ FROM wcf".WCF_N."_page_content
+ WHERE languageID IS NULL
+ GROUP BY pageID
+ HAVING count > 1";
+$statement = WCF::getDB()->prepareStatement($sql);
+$statement->execute();
+while ($row = $statement->fetchArray()) {
+ $deleteStatement->execute([$row['pageID'], $row['count'] - 1]);
+}
+
+// remove duplicates in box_content
+$sql = "DELETE FROM wcf".WCF_N."_box_content
+ WHERE boxID = ?
+ AND languageID IS NULL
+ ORDER BY boxContentID DESC
+ LIMIT ?";
+$deleteStatement = WCF::getDB()->prepareStatement($sql);
+
+$sql = "SELECT COUNT(*) AS count, boxID
+ FROM wcf".WCF_N."_box_content
+ WHERE languageID IS NULL
+ GROUP BY boxID
+ HAVING count > 1";
+$statement = WCF::getDB()->prepareStatement($sql);
+$statement->execute();
+while ($row = $statement->fetchArray()) {
+ $deleteStatement->execute([$row['boxID'], $row['count'] - 1]);
+}
\ No newline at end of file
*/
protected function postImport() {
if (!empty($this->content)) {
+ $sql = "SELECT COUNT(*) AS count
+ FROM wcf".WCF_N."_box_content
+ WHERE boxID = ?
+ AND languageID IS NULL";
+ $statement = WCF::getDB()->prepareStatement($sql);
+
$sql = "INSERT IGNORE INTO wcf".WCF_N."_box_content
(boxID, languageID, title, content)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $insertStatement = WCF::getDB()->prepareStatement($sql);
WCF::getDB()->beginTransaction();
foreach ($this->content as $boxID => $contentData) {
$languageID = $language->languageID;
}
- $statement->execute([
+ if ($languageID === null) {
+ $statement->execute([$boxID]);
+ if ($statement->fetchColumn()) continue;
+ }
+
+ $insertStatement->execute([
$boxID,
$languageID,
$content['title'],
*/
protected function postImport() {
if (!empty($this->content)) {
+ $sql = "SELECT COUNT(*) AS count
+ FROM wcf".WCF_N."_page_content
+ WHERE pageID = ?
+ AND languageID IS NULL";
+ $statement = WCF::getDB()->prepareStatement($sql);
+
$sql = "INSERT IGNORE INTO wcf".WCF_N."_page_content
(pageID, languageID, title, content, metaDescription, metaKeywords, customURL)
VALUES (?, ?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $insertStatement = WCF::getDB()->prepareStatement($sql);
WCF::getDB()->beginTransaction();
foreach ($this->content as $pageID => $contentData) {
$languageID = $language->languageID;
}
- $statement->execute([
+ if ($languageID === null) {
+ $statement->execute([$pageID]);
+ if ($statement->fetchColumn()) continue;
+ }
+
+ $insertStatement->execute([
$pageID,
$languageID,
$content['title'],