From: Alexander Ebert <ebert@woltlab.com>
Date: Wed, 11 Jan 2017 11:26:06 +0000 (+0100)
Subject: Added work-around for upgrade 2.1 -> 3.0
X-Git-Tag: 3.0.0~1
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ce55a5294dcce2fcc562ebf75eef1fecf66f0a8b;p=GitHub%2FWoltLab%2FWCF.git

Added work-around for upgrade 2.1 -> 3.0
---

diff --git a/com.woltlab.wcf/files_pre_update.tar b/com.woltlab.wcf/files_pre_update.tar
index 9753f42013..e2b50d596e 100644
Binary files a/com.woltlab.wcf/files_pre_update.tar and b/com.woltlab.wcf/files_pre_update.tar differ
diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml
index 55bb2150ca..e2e051e035 100644
--- a/com.woltlab.wcf/package.xml
+++ b/com.woltlab.wcf/package.xml
@@ -48,7 +48,11 @@
 		<instruction type="script">acp/update_com.woltlab.wcf_3.0_pre_sql.php</instruction>
 		<instruction type="sql">update_part1.sql</instruction>
 		
-		<instruction type="file" run="standalone">files.tar</instruction>
+		<instruction type="script" run="standalone" flushCache="false">acp/update_com.woltlab.wcf_3.0_noop.php</instruction>
+		
+		<instruction type="file">files.tar</instruction>
+		<instruction type="script" flushCache="false">acp/update_com.woltlab.wcf_3.0_appConfig.php</instruction>
+		
 		<instruction type="script" run="standalone" flushCache="false">acp/update_com.woltlab.wcf_3.0_columnLength.php</instruction>
 		<instruction type="sql" run="standalone">update_1.sql</instruction>
 		<instruction type="sql" run="standalone">update_2.sql</instruction>
diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0.0_rc_3.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0.0_rc_3.php
deleted file mode 100644
index d84819e107..0000000000
--- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0.0_rc_3.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-use wcf\system\WCF;
-
-/**
- * @author	Alexander Ebert
- * @copyright	2001-2017 WoltLab GmbH
- * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package	WoltLabSuite\Core
- */
-$columns = WCF::getDB()->getEditor()->getColumns("wcf".WCF_N."_application");
-$hasLandingPageID = false;
-foreach ($columns as $column) {
-	if ($column['name'] == 'landingPageID') {
-		$hasLandingPageID = true;
-		break;
-	}
-}
-
-if (!$hasLandingPageID) {
-	$statement = WCF::getDB()->prepareStatement("ALTER TABLE wcf".WCF_N."_application ADD COLUMN landingPageID INT(10) NULL");
-	$statement->execute();
-	
-	$statement = WCF::getDB()->prepareStatement("ALTER TABLE wcf".WCF_N."_application ADD CONSTRAINT `8a7fc72db2348bc5695394ffd616cbf5_fk` FOREIGN KEY (landingPageID) REFERENCES wcf".WCF_N."_page (pageID) ON DELETE SET NULL;");
-	$statement->execute();
-	
-	$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]);
-}
diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_appConfig.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_appConfig.php
new file mode 100644
index 0000000000..ad3055d9cf
--- /dev/null
+++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_appConfig.php
@@ -0,0 +1,10 @@
+<?php
+use wcf\data\package\Package;
+
+/**
+ * @author	Alexander Ebert
+ * @copyright	2001-2017 WoltLab GmbH
+ * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package	WoltLabSuite\Core
+ */
+Package::writeConfigFile(1);
diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_noop.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_noop.php
new file mode 100644
index 0000000000..403a41ceb7
--- /dev/null
+++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_noop.php
@@ -0,0 +1,2 @@
+<?php
+/* DO NOT REMOVE THIS FILE! -- As strange as it looks, this is a necessary work-around */