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

Modernize "mailKey" on Fund initiatives

Summary: Ref T13065. Migrate "mailKey" and drop the column.

Test Plan: Ran "bin/storage upgrade", got a clean upgrade, saw migrated values in mail properties table.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13065

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

+32 -11
+28
resources/sql/autopatches/20210316.almanac.15.intiative-mailkey.php
··· 1 + <?php 2 + 3 + $initiative_table = new FundInitiative(); 4 + $initiative_conn = $initiative_table->establishConnection('w'); 5 + 6 + $properties_table = new PhabricatorMetaMTAMailProperties(); 7 + $conn = $properties_table->establishConnection('w'); 8 + 9 + $iterator = new LiskRawMigrationIterator( 10 + $initiative_conn, 11 + $initiative_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/20210316.almanac.16.initiative-dropmailkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_fund.fund_initiative 2 + DROP mailKey;
+2 -11
src/applications/fund/storage/FundInitiative.php
··· 22 22 protected $editPolicy; 23 23 protected $status; 24 24 protected $totalAsCurrency; 25 - protected $mailKey; 26 25 27 26 private $projectPHIDs = self::ATTACHABLE; 28 27 ··· 62 61 'status' => 'text32', 63 62 'merchantPHID' => 'phid?', 64 63 'totalAsCurrency' => 'text64', 65 - 'mailKey' => 'bytes20', 66 64 ), 67 65 self::CONFIG_APPLICATION_SERIALIZERS => array( 68 66 'totalAsCurrency' => new PhortuneCurrencySerializer(), ··· 78 76 ) + parent::getConfiguration(); 79 77 } 80 78 81 - public function generatePHID() { 82 - return PhabricatorPHID::generateNewPHID(FundInitiativePHIDType::TYPECONST); 79 + public function getPHIDType() { 80 + return FundInitiativePHIDType::TYPECONST; 83 81 } 84 82 85 83 public function getMonogram() { ··· 101 99 102 100 public function isClosed() { 103 101 return ($this->getStatus() == self::STATUS_CLOSED); 104 - } 105 - 106 - public function save() { 107 - if (!$this->mailKey) { 108 - $this->mailKey = Filesystem::readRandomCharacters(20); 109 - } 110 - return parent::save(); 111 102 } 112 103 113 104