@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 Almanac Namespaces

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

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

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13641, T13065

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

+35 -10
+28
resources/sql/autopatches/20210316.almanac.09.namespace-mailkey.php
··· 1 + <?php 2 + 3 + $namespace_table = new AlmanacNamespace(); 4 + $namespace_conn = $namespace_table->establishConnection('w'); 5 + 6 + $properties_table = new PhabricatorMetaMTAMailProperties(); 7 + $conn = $properties_table->establishConnection('w'); 8 + 9 + $iterator = new LiskRawMigrationIterator( 10 + $namespace_conn, 11 + $namespace_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.10.namespace-dropmailkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_almanac.almanac_namespace 2 + DROP mailKey;
+5 -10
src/applications/almanac/storage/AlmanacNamespace.php
··· 12 12 13 13 protected $name; 14 14 protected $nameIndex; 15 - protected $mailKey; 16 15 protected $viewPolicy; 17 16 protected $editPolicy; 18 17 ··· 28 27 self::CONFIG_COLUMN_SCHEMA => array( 29 28 'name' => 'text128', 30 29 'nameIndex' => 'bytes12', 31 - 'mailKey' => 'bytes20', 32 30 ), 33 31 self::CONFIG_KEY_SCHEMA => array( 34 32 'key_nameindex' => array( ··· 42 40 ) + parent::getConfiguration(); 43 41 } 44 42 45 - public function generatePHID() { 46 - return PhabricatorPHID::generateNewPHID( 47 - AlmanacNamespacePHIDType::TYPECONST); 43 + public function getPHIDType() { 44 + return AlmanacNamespacePHIDType::TYPECONST; 48 45 } 49 46 50 47 public function save() { ··· 52 49 53 50 $this->nameIndex = PhabricatorHash::digestForIndex($this->getName()); 54 51 55 - if (!$this->mailKey) { 56 - $this->mailKey = Filesystem::readRandomCharacters(20); 57 - } 58 - 59 52 return parent::save(); 60 53 } 61 54 62 55 public function getURI() { 63 - return '/almanac/namespace/view/'.$this->getName().'/'; 56 + return urisprintf( 57 + '/almanac/namespace/view/%s/', 58 + $this->getName()); 64 59 } 65 60 66 61 public function getNameLength() {