@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" for Almanac Networks

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

Test Plan: Ran "bin/storage upgrade", got a clean report, saw keys migrate in mail properties table.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13641, T13065

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

+35 -14
+28
resources/sql/autopatches/20210316.almanac.11.network-mailkey.php
··· 1 + <?php 2 + 3 + $network_table = new AlmanacNetwork(); 4 + $network_conn = $network_table->establishConnection('w'); 5 + 6 + $properties_table = new PhabricatorMetaMTAMailProperties(); 7 + $conn = $properties_table->establishConnection('w'); 8 + 9 + $iterator = new LiskRawMigrationIterator( 10 + $network_conn, 11 + $network_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.12.network-dropmailkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_almanac.almanac_network 2 + DROP mailKey;
+5 -14
src/applications/almanac/storage/AlmanacNetwork.php
··· 10 10 PhabricatorConduitResultInterface { 11 11 12 12 protected $name; 13 - protected $mailKey; 14 13 protected $viewPolicy; 15 14 protected $editPolicy; 16 15 ··· 25 24 self::CONFIG_AUX_PHID => true, 26 25 self::CONFIG_COLUMN_SCHEMA => array( 27 26 'name' => 'sort128', 28 - 'mailKey' => 'bytes20', 29 - 30 27 ), 31 28 self::CONFIG_KEY_SCHEMA => array( 32 29 'key_name' => array( ··· 37 34 ) + parent::getConfiguration(); 38 35 } 39 36 40 - public function generatePHID() { 41 - return PhabricatorPHID::generateNewPHID(AlmanacNetworkPHIDType::TYPECONST); 42 - } 43 - 44 - public function save() { 45 - if (!$this->mailKey) { 46 - $this->mailKey = Filesystem::readRandomCharacters(20); 47 - } 48 - 49 - return parent::save(); 37 + public function getPHIDType() { 38 + return AlmanacNetworkPHIDType::TYPECONST; 50 39 } 51 40 52 41 public function getURI() { 53 - return '/almanac/network/'.$this->getID().'/'; 42 + return urisprintf( 43 + '/almanac/network/%s/', 44 + $this->getID()); 54 45 } 55 46 56 47