@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 the onboard "mailKey" from Paste

Summary:
See T13065 and rP1e2bc7775bc4.

Intended to cover the gap left by D25899.
The actual amount of impacted installations should
be 0, but the migration makes sure all pastes have
a mail key regardless.

Test Plan:
* Create a paste
* Check `SELECT * FROM phabricator_paste.paste;` and `SELECT * FROM phabricator_metamta.metamta_mailproperties;` on the database
* Run `./bin/storage upgrade`
* Check that the mailKeys have been moved to `mailProperties` in the `phabricator_metamta.metamta_mailproperties` table and the `mailKey` column is gone from the `phabricator_paste.paste` table

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25900

+36 -9
+34
resources/sql/autopatches/20250227.paste.01.mailkey.php
··· 1 + <?php 2 + 3 + $paste_table = new PhabricatorPaste(); 4 + $paste_conn = $paste_table->establishConnection('w'); 5 + 6 + $properties_table = new PhabricatorMetaMTAMailProperties(); 7 + $conn = $properties_table->establishConnection('w'); 8 + 9 + $iterator = new LiskRawMigrationIterator( 10 + $paste_conn, 11 + $paste_table->getTableName()); 12 + 13 + foreach ($iterator as $row) { 14 + // The mailKey field might be unpopulated. 15 + // This should have happened in the 20130805.pastemailkeypop.php migration, 16 + // but that will not work on newer installations, because the paste table 17 + // was renamed in between. 18 + $mailkey = $row['mailKey'] ?? Filesystem::readRandomCharacters(20); 19 + 20 + queryfx( 21 + $conn, 22 + 'INSERT IGNORE INTO %T 23 + (objectPHID, mailProperties, dateCreated, dateModified) 24 + VALUES 25 + (%s, %s, %d, %d)', 26 + $properties_table->getTableName(), 27 + $row['phid'], 28 + phutil_json_encode( 29 + array( 30 + 'mailKey' => $mailkey, 31 + )), 32 + PhabricatorTime::getNow(), 33 + PhabricatorTime::getNow()); 34 + }
+2
resources/sql/autopatches/20250227.paste.02.mailkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_paste.paste 2 + DROP mailKey;
-9
src/applications/paste/storage/PhabricatorPaste.php
··· 22 22 protected $parentPHID; 23 23 protected $viewPolicy; 24 24 protected $editPolicy; 25 - protected $mailKey; 26 25 protected $status; 27 26 protected $spacePHID; 28 27 ··· 74 73 'status' => 'text32', 75 74 'title' => 'text255', 76 75 'language' => 'text64?', 77 - 'mailKey' => 'bytes20', 78 76 'parentPHID' => 'phid?', 79 77 80 78 // T6203/NULLABILITY ··· 105 103 106 104 public function isArchived() { 107 105 return ($this->getStatus() == self::STATUS_ARCHIVED); 108 - } 109 - 110 - public function save() { 111 - if (!$this->getMailKey()) { 112 - $this->setMailKey(Filesystem::readRandomCharacters(20)); 113 - } 114 - return parent::save(); 115 106 } 116 107 117 108 public function getFullName() {