<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>
+ <instruction type="script" run="standalone" flushCache="false">acp/update_com.woltlab.wcf_3.0_dropColumns.php</instruction>
<instruction type="sql" run="standalone">update_3.sql</instruction>
<instruction type="sql" run="standalone">update_4.sql</instruction>
<instruction type="sql" run="standalone">update_5.sql</instruction>
ALTER TABLE wcf1_package_update_version DROP COLUMN isCritical;
DROP TABLE IF EXISTS wcf1_page_menu_item;
-
-ALTER TABLE wcf1_session DROP COLUMN controller;
-ALTER TABLE wcf1_session DROP COLUMN parentObjectType;
-ALTER TABLE wcf1_session DROP COLUMN parentObjectID;
-ALTER TABLE wcf1_session DROP COLUMN objectType;
-ALTER TABLE wcf1_session DROP COLUMN objectID;
-ALTER TABLE wcf1_session DROP COLUMN sessionVariables;
-
-ALTER TABLE wcf1_session ADD pageID INT(10);
-ALTER TABLE wcf1_session ADD pageObjectID INT(10);
-ALTER TABLE wcf1_session ADD parentPageID INT(10);
-ALTER TABLE wcf1_session ADD parentPageObjectID INT(10);
-ALTER TABLE wcf1_session ADD KEY pageID (pageID, pageObjectID);
-ALTER TABLE wcf1_session ADD KEY parentPageID (parentPageID, parentPageObjectID);
-
-ALTER TABLE wcf1_session_virtual ADD sessionVariables MEDIUMTEXT;
-
-DROP TABLE IF EXISTS wcf1_sitemap;
-
-ALTER TABLE wcf1_smiley ADD smileyPath2x VARCHAR(255) NOT NULL DEFAULT '';
-
-ALTER TABLE wcf1_style ADD packageName VARCHAR(255) NOT NULL DEFAULT '';
-ALTER TABLE wcf1_style ADD isTainted TINYINT(1) NOT NULL DEFAULT 0;
-
-ALTER TABLE wcf1_template_listener ADD permissions TEXT;
-ALTER TABLE wcf1_template_listener ADD options TEXT;
-
-ALTER TABLE wcf1_user CHANGE lostPasswordKey lostPasswordKey CHAR(40) DEFAULT NULL;
\ No newline at end of file
-ALTER TABLE wcf1_user DROP COLUMN signatureEnableBBCodes;
-ALTER TABLE wcf1_user DROP COLUMN signatureEnableSmilies;
-ALTER TABLE wcf1_user DROP COLUMN socialNetworkPrivacySettings;
+ALTER TABLE wcf1_session ADD pageID INT(10);
+ALTER TABLE wcf1_session ADD pageObjectID INT(10);
+ALTER TABLE wcf1_session ADD parentPageID INT(10);
+ALTER TABLE wcf1_session ADD parentPageObjectID INT(10);
+ALTER TABLE wcf1_session ADD KEY pageID (pageID, pageObjectID);
+ALTER TABLE wcf1_session ADD KEY parentPageID (parentPageID, parentPageObjectID);
+
+ALTER TABLE wcf1_session_virtual ADD sessionVariables MEDIUMTEXT;
+
+DROP TABLE IF EXISTS wcf1_sitemap;
+
+ALTER TABLE wcf1_smiley ADD smileyPath2x VARCHAR(255) NOT NULL DEFAULT '';
+
+ALTER TABLE wcf1_style ADD packageName VARCHAR(255) NOT NULL DEFAULT '';
+ALTER TABLE wcf1_style ADD isTainted TINYINT(1) NOT NULL DEFAULT 0;
+
+ALTER TABLE wcf1_template_listener ADD permissions TEXT;
+ALTER TABLE wcf1_template_listener ADD options TEXT;
+
+ALTER TABLE wcf1_user CHANGE lostPasswordKey lostPasswordKey CHAR(40) DEFAULT NULL;
-ALTER TABLE wcf1_user_avatar DROP COLUMN cropX;
-ALTER TABLE wcf1_user_avatar DROP COLUMN cropY;
-
ALTER TABLE wcf1_user_notification ADD KEY (confirmTime);
DELETE FROM wcf1_user_profile_visitor WHERE userID IS NULL OR ownerID IS NULL;
--- /dev/null
+<?php
+use wcf\system\package\SplitNodeException;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
+
+/**
+ * @author Alexander Ebert
+ * @copyright 2001-2015 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core
+ */
+$data = <<<DATA
+ALTER TABLE wcf1_session DROP COLUMN controller, DROP COLUMN parentObjectType, DROP COLUMN parentObjectID, DROP COLUMN objectType, DROP COLUMN objectID, DROP COLUMN sessionVariables;
+ALTER TABLE wcf1_user DROP COLUMN signatureEnableBBCodes, DROP COLUMN signatureEnableSmilies, DROP COLUMN socialNetworkPrivacySettings;
+ALTER TABLE wcf1_user_avatar DROP COLUMN cropX, DROP COLUMN cropY;
+DATA;
+
+$lines = explode("\n", StringUtil::trim($data));
+
+$rebuildData = WCF::getSession()->getVar('__wcfUpdateDropColumns');
+if ($rebuildData === null) {
+ $rebuildData = [
+ 'i' => 0,
+ 'max' => count($lines)
+ ];
+}
+
+// MySQL drops a column by creating a new table in the
+// background, copying over all data except from the
+// deleted column and uses this table afterwards.
+//
+// Using a single `ALTER TABLE` to drop multiple columns
+// results in the same runtime, because copying the table
+// is what actually takes ages.
+$statement = WCF::getDB()->prepareStatement($lines[$rebuildData['i']]);
+$statement->execute();
+
+$rebuildData['i']++;
+
+if ($rebuildData['i'] === $rebuildData['max']) {
+ WCF::getSession()->unregister('__wcfUpdateDropColumns');
+}
+else {
+ WCF::getSession()->register('__wcfUpdateDropColumns', $rebuildData);
+
+ // call this script again
+ throw new SplitNodeException();
+}