From: Tim Düsterhus Date: Wed, 11 May 2022 09:45:42 +0000 (+0200) Subject: Drop obsolete upgrade instructions from 5.4 to 5.5 X-Git-Tag: 6.0.0_Alpha_1~57 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=859c7934b8ff208603b02281b9678a54e86ec6c2;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Drop obsolete upgrade instructions from 5.4 to 5.5 --- diff --git a/files/acp/database/update_com.woltlab.wcf.conversation_5.5_step1.php b/files/acp/database/update_com.woltlab.wcf.conversation_5.5_step1.php deleted file mode 100644 index 650db8d..0000000 --- a/files/acp/database/update_com.woltlab.wcf.conversation_5.5_step1.php +++ /dev/null @@ -1,11 +0,0 @@ - - */ - -// Reuse the install script to create the indices with the correct names. - -return require(__DIR__ . '/install_com.woltlab.wcf.conversation.php'); diff --git a/files/acp/database/update_com.woltlab.wcf.conversation_5.5_step2.php b/files/acp/database/update_com.woltlab.wcf.conversation_5.5_step2.php deleted file mode 100644 index 3ecc7ec..0000000 --- a/files/acp/database/update_com.woltlab.wcf.conversation_5.5_step2.php +++ /dev/null @@ -1,70 +0,0 @@ - - */ - -use wcf\system\database\table\index\DatabaseTableIndex; -use wcf\system\database\table\index\DatabaseTablePrimaryIndex; -use wcf\system\database\table\PartialDatabaseTable; - -// 1) Generate a blueprint to fill in the generated index names. - -$blueprint = [ - PartialDatabaseTable::create('wcf1_conversation') - ->indices([ - // DatabaseTablePrimaryIndex::create() - // ->columns(['conversationID']), - DatabaseTableIndex::create() - ->columns(['userID', 'isDraft']), - ]), - PartialDatabaseTable::create('wcf1_conversation_to_user') - ->indices([ - DatabaseTableIndex::create() - ->columns(['participantID', 'conversationID']) - ->type(DatabaseTableIndex::UNIQUE_TYPE), - // DatabaseTableIndex::create() - // ->columns(['participantID', 'hideConversation']), - ]), - PartialDatabaseTable::create('wcf1_conversation_message') - ->indices([ - // DatabaseTablePrimaryIndex::create() - // ->columns(['messageID']), - DatabaseTableIndex::create() - ->columns(['conversationID', 'userID']), - DatabaseTableIndex::create() - ->columns(['ipAddress']), - ]), - PartialDatabaseTable::create('wcf1_conversation_label') - ->indices([ - // DatabaseTablePrimaryIndex::create() - // ->columns(['labelID']), - ]), - PartialDatabaseTable::create('wcf1_conversation_label_to_object') - ->indices([ - DatabaseTableIndex::create() - ->columns(['labelID', 'conversationID']) - ->type(DatabaseTableIndex::UNIQUE_TYPE), - ]), -]; - -// 2) Use this blueprint to recreate the index objects with ->generatedName() set to false. -// Simply dropping the indices with ->generatedName() set to true does not work, because it will -// also remove named indices as the fact that a name was generated does not persist to the database. - -$data = []; -foreach ($blueprint as $blueprintTable) { - $data[] = PartialDatabaseTable::create($blueprintTable->getName()) - ->indices(\array_map(static function ($index) { - \assert($index instanceof DatabaseTableIndex); - - return DatabaseTableIndex::create($index->getName()) - ->columns($index->getColumns()) - ->type($index->getType()) - ->drop(); - }, $blueprintTable->getIndices())); -} - -return $data; diff --git a/files/acp/update_com.woltlab.wcf.conversation_5.5_cleanup_orphaned_attachments.php b/files/acp/update_com.woltlab.wcf.conversation_5.5_cleanup_orphaned_attachments.php deleted file mode 100644 index 7dc5759..0000000 --- a/files/acp/update_com.woltlab.wcf.conversation_5.5_cleanup_orphaned_attachments.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @package WoltLabSuite\Core - */ - -use wcf\data\attachment\AttachmentAction; -use wcf\data\object\type\ObjectTypeCache; -use wcf\system\package\SplitNodeException; -use wcf\system\WCF; - -$objectType = ObjectTypeCache::getInstance() - ->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', 'com.woltlab.wcf.conversation.message'); - -$sql = "SELECT attachmentID - FROM wcf1_attachment - WHERE objectTypeID = ? - AND objectID NOT IN ( - SELECT messageID - FROM wcf1_conversation_message - )"; -$statement = WCF::getDB()->prepare($sql, 100); -$statement->execute([$objectType->objectTypeID]); -$attachmentIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); - -if (empty($attachmentIDs)) { - return; -} - -(new AttachmentAction($attachmentIDs, 'delete'))->executeAction(); - -// If we reached this location we processed at least one attachment. -// If this was the final attachment the next iteration will abort this -// script early, thus not splitting the node. -throw new SplitNodeException();