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

Remove explicit "mailKey" from Owners packages

Summary:
Depends on D19426. Ref T13130. Ref T13065. While I'm making changes to Owners for "Ignore generated paths", clean up the "mailKey" column.

We recently (D19399) added code to automatically generate and manage mail keys so we don't need a ton of `mailKey` properties in the future. Migrate existing mail keys and blow away the explicit column on packages.

Test Plan: Ran migration, manually looked at the database and saw sensible data. Edited a package to send some mail, which looked good.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13130, T13065

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

+30 -13
+26
resources/sql/autopatches/20180504.owners.01.mailkey.php
··· 1 + <?php 2 + 3 + $packages_table = new PhabricatorOwnersPackage(); 4 + $packages_conn = $packages_table->establishConnection('w'); 5 + $packages_name = $packages_table->getTableName(); 6 + 7 + $properties_table = new PhabricatorMetaMTAMailProperties(); 8 + $conn = $properties_table->establishConnection('w'); 9 + 10 + $iterator = new LiskRawMigrationIterator($packages_conn, $packages_name); 11 + foreach ($iterator as $package) { 12 + queryfx( 13 + $conn, 14 + 'INSERT IGNORE INTO %T 15 + (objectPHID, mailProperties, dateCreated, dateModified) 16 + VALUES 17 + (%s, %s, %d, %d)', 18 + $properties_table->getTableName(), 19 + $package['phid'], 20 + phutil_json_encode( 21 + array( 22 + 'mailKey' => $package['mailKey'], 23 + )), 24 + PhabricatorTime::getNow(), 25 + PhabricatorTime::getNow()); 26 + }
+2
resources/sql/autopatches/20180504.owners.02.rmkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_owners.owners_package 2 + DROP mailKey;
+2 -13
src/applications/owners/storage/PhabricatorOwnersPackage.php
··· 16 16 protected $auditingEnabled; 17 17 protected $autoReview; 18 18 protected $description; 19 - protected $mailKey; 20 19 protected $status; 21 20 protected $viewPolicy; 22 21 protected $editPolicy; ··· 122 121 'name' => 'sort', 123 122 'description' => 'text', 124 123 'auditingEnabled' => 'bool', 125 - 'mailKey' => 'bytes20', 126 124 'status' => 'text32', 127 125 'autoReview' => 'text32', 128 126 'dominion' => 'text32', ··· 130 128 ) + parent::getConfiguration(); 131 129 } 132 130 133 - public function generatePHID() { 134 - return PhabricatorPHID::generateNewPHID( 135 - PhabricatorOwnersPackagePHIDType::TYPECONST); 136 - } 137 - 138 - public function save() { 139 - if (!$this->getMailKey()) { 140 - $this->setMailKey(Filesystem::readRandomCharacters(20)); 141 - } 142 - 143 - return parent::save(); 131 + public function getPHIDType() { 132 + return PhabricatorOwnersPackagePHIDType::TYPECONST; 144 133 } 145 134 146 135 public function isArchived() {