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

Summary: Ref T13641. Ref T13065. Migrate and drop the onboard "mailKey" column for Almanac Services.

Test Plan: Ran storage migration, got clean report, saw migrated value in mail properties table.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13641, T13065

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

+32 -8
+28
resources/sql/autopatches/20210316.almanac.05.service-mailkey.php
··· 1 + <?php 2 + 3 + $service_table = new AlmanacService(); 4 + $service_conn = $service_table->establishConnection('w'); 5 + 6 + $properties_table = new PhabricatorMetaMTAMailProperties(); 7 + $conn = $properties_table->establishConnection('w'); 8 + 9 + $iterator = new LiskRawMigrationIterator( 10 + $service_conn, 11 + $service_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.06.service-dropmailkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_almanac.almanac_service 2 + DROP mailKey;
+2 -8
src/applications/almanac/storage/AlmanacService.php
··· 14 14 15 15 protected $name; 16 16 protected $nameIndex; 17 - protected $mailKey; 18 17 protected $viewPolicy; 19 18 protected $editPolicy; 20 19 protected $serviceType; ··· 49 48 self::CONFIG_COLUMN_SCHEMA => array( 50 49 'name' => 'text128', 51 50 'nameIndex' => 'bytes12', 52 - 'mailKey' => 'bytes20', 53 51 'serviceType' => 'text64', 54 52 ), 55 53 self::CONFIG_KEY_SCHEMA => array( ··· 67 65 ) + parent::getConfiguration(); 68 66 } 69 67 70 - public function generatePHID() { 71 - return PhabricatorPHID::generateNewPHID(AlmanacServicePHIDType::TYPECONST); 68 + public function getPHIDType() { 69 + return AlmanacServicePHIDType::TYPECONST; 72 70 } 73 71 74 72 public function save() { 75 73 AlmanacNames::validateName($this->getName()); 76 74 77 75 $this->nameIndex = PhabricatorHash::digestForIndex($this->getName()); 78 - 79 - if (!$this->mailKey) { 80 - $this->mailKey = Filesystem::readRandomCharacters(20); 81 - } 82 76 83 77 return parent::save(); 84 78 }