@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Php schema patch to update channel id's of past events.

Summary: Php schema patch to update channel id's of past events.

Test Plan: Having some proxy issues here due to which connection is timing out and bot is not able to log into IRC. Bot connects to IRC in my home though ! So I wasn't able to quite to test this by running storage upgrade.

Reviewers: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5000

authored by

Afaque Hussain and committed by
epriestley
61c26463 cd41b834

+54
+50
resources/sql/patches/20130218.updatechannelid.php
··· 1 + <?php 2 + 3 + echo "Updating channel IDs of previous chatlog events...\n"; 4 + $event_table = new PhabricatorChatLogEvent(); 5 + $channel_table = new PhabricatorChatLogChannel(); 6 + 7 + $event_table->openTransaction(); 8 + $channel_table->openTransaction(); 9 + 10 + $event_table->beginReadLocking(); 11 + $channel_table->beginReadLocking(); 12 + 13 + $events = new LiskMigrationIterator($event_table); 14 + 15 + foreach ($events as $event) { 16 + if ($event->getChannelID()) { 17 + continue; 18 + } 19 + 20 + $matched = $channel_table->loadOneWhere( 21 + "channelName = %s AND serviceName = %s AND serviceType = %s", 22 + $event->getChannel(), 23 + '', 24 + ''); 25 + 26 + if (!$matched) { 27 + $matched = id(new PhabricatorChatLogChannel()) 28 + ->setChannelName($event->getChannel()) 29 + ->setServiceType('') 30 + ->setServiceName('') 31 + ->setViewPolicy(PhabricatorPolicies::POLICY_USER) 32 + ->setEditPolicy(PhabricatorPolicies::POLICY_USER) 33 + ->save(); 34 + } 35 + 36 + queryfx( 37 + $event->establishConnection('w'), 38 + 'UPDATE %T SET channelID = %d WHERE id = %d', 39 + $event->getTableName(), 40 + $matched->getID(), 41 + $event->getID()); 42 + } 43 + 44 + $event_table->endReadLocking(); 45 + $channel_table->endReadLocking(); 46 + 47 + $event_table->saveTransaction(); 48 + $channel_table->saveTransaction(); 49 + 50 + echo "\nDone.\n";
+4
src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
··· 1129 1129 'type' => 'sql', 1130 1130 'name' => $this->getPatchPath('20130217.cachettl.sql'), 1131 1131 ), 1132 + '20130218.updatechannelid.php' => array( 1133 + 'type' => 'php', 1134 + 'name' => $this->getPatchPath('20130218.updatechannelid.php'), 1135 + ), 1132 1136 ); 1133 1137 } 1134 1138