@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.

Migrate "SlowvotePoll" to modern mailkey storage

Summary:
Ref T13682. Ref T13065. Migrate and update "SlowvotePoll" to use more modern mailkey storage (in the mail application, rather than onboard).

Also make other minor modernization changes.

Test Plan: Created a new poll. Ran migration, verified mail key copied properly in database.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13682, T13065

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

+34 -13
+28
resources/sql/autopatches/20220525.slowvote.01.mailkey.php
··· 1 + <?php 2 + 3 + $poll_table = new PhabricatorSlowvotePoll(); 4 + $poll_conn = $poll_table->establishConnection('w'); 5 + 6 + $properties_table = new PhabricatorMetaMTAMailProperties(); 7 + $conn = $properties_table->establishConnection('w'); 8 + 9 + $iterator = new LiskRawMigrationIterator( 10 + $poll_conn, 11 + $poll_table->getTableName()); 12 + 13 + foreach ($iterator as $row) { 14 + queryfx( 15 + $conn, 16 + 'INSERT IGNORE INTO %R 17 + (objectPHID, mailProperties, dateCreated, dateModified) 18 + VALUES 19 + (%s, %s, %d, %d)', 20 + $properties_table, 21 + $row['phid'], 22 + phutil_json_encode( 23 + array( 24 + 'mailKey' => $row['mailKey'], 25 + )), 26 + PhabricatorTime::getNow(), 27 + PhabricatorTime::getNow()); 28 + }
+2
resources/sql/autopatches/20220525.slowvote.02.mailkey-drop.sql
··· 1 + ALTER TABLE {$NAMESPACE}_slowvote.slowvote_poll 2 + DROP mailKey;
+4 -13
src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
··· 1 1 <?php 2 2 3 - final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO 3 + final class PhabricatorSlowvotePoll 4 + extends PhabricatorSlowvoteDAO 4 5 implements 5 6 PhabricatorApplicationTransactionInterface, 6 7 PhabricatorPolicyInterface, ··· 25 26 protected $responseVisibility = 0; 26 27 protected $shuffle = 0; 27 28 protected $method; 28 - protected $mailKey; 29 29 protected $viewPolicy; 30 30 protected $isClosed = 0; 31 31 protected $spacePHID; ··· 59 59 'method' => 'uint32', 60 60 'description' => 'text', 61 61 'isClosed' => 'bool', 62 - 'mailKey' => 'bytes20', 63 62 ), 64 63 self::CONFIG_KEY_SCHEMA => array( 65 64 ), 66 65 ) + parent::getConfiguration(); 67 66 } 68 67 69 - public function generatePHID() { 70 - return PhabricatorPHID::generateNewPHID( 71 - PhabricatorSlowvotePollPHIDType::TYPECONST); 68 + public function getPHIDType() { 69 + return PhabricatorSlowvotePollPHIDType::TYPECONST; 72 70 } 73 71 74 72 public function getOptions() { ··· 110 108 111 109 public function getURI() { 112 110 return '/'.$this->getMonogram(); 113 - } 114 - 115 - public function save() { 116 - if (!$this->getMailKey()) { 117 - $this->setMailKey(Filesystem::readRandomCharacters(20)); 118 - } 119 - return parent::save(); 120 111 } 121 112 122 113