@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 "mailKey" from "PhabricatorRepositoryCommit"

Summary: Ref T13197. Ref T13065. This continues the gradual purge of dedicated "mailKey" columns in favor of shared infrastructure.

Test Plan:
- Ran migration.
- Visually inspected database.
- Grepped for `mailKey`.
- Added some comments, saw the daemons generate corresponding mail.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13197, T13065

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

+28 -10
+26
resources/sql/autopatches/20180914.audit.01.mailkey.php
··· 1 + <?php 2 + 3 + $commit_table = new PhabricatorRepositoryCommit(); 4 + $commit_conn = $commit_table->establishConnection('w'); 5 + $commit_name = $commit_table->getTableName(); 6 + 7 + $properties_table = new PhabricatorMetaMTAMailProperties(); 8 + $conn = $properties_table->establishConnection('w'); 9 + 10 + $iterator = new LiskRawMigrationIterator($commit_conn, $commit_name); 11 + foreach ($iterator as $commit) { 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 + $commit['phid'], 20 + phutil_json_encode( 21 + array( 22 + 'mailKey' => $commit['mailKey'], 23 + )), 24 + PhabricatorTime::getNow(), 25 + PhabricatorTime::getNow()); 26 + }
+2
resources/sql/autopatches/20180914.audit.02.rmkey.sql
··· 1 + ALTER TABLE {$NAMESPACE}_repository.repository_commit 2 + DROP mailKey;
-10
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 25 25 protected $committerIdentityPHID; 26 26 protected $commitIdentifier; 27 27 protected $epoch; 28 - protected $mailKey; 29 28 protected $authorPHID; 30 29 protected $auditStatus = DiffusionCommitAuditStatus::NONE; 31 30 protected $summary = ''; ··· 116 115 self::CONFIG_TIMESTAMPS => false, 117 116 self::CONFIG_COLUMN_SCHEMA => array( 118 117 'commitIdentifier' => 'text40', 119 - 'mailKey' => 'bytes20', 120 118 'authorPHID' => 'phid?', 121 119 'authorIdentityPHID' => 'phid?', 122 120 'committerIdentityPHID' => 'phid?', ··· 321 319 return mpull($audits, 'getAuditorPHID'); 322 320 } 323 321 324 - public function save() { 325 - if (!$this->mailKey) { 326 - $this->mailKey = Filesystem::readRandomCharacters(20); 327 - } 328 - return parent::save(); 329 - } 330 - 331 322 public function delete() { 332 323 $data = $this->loadCommitData(); 333 324 $audits = id(new PhabricatorRepositoryAuditRequest()) ··· 605 596 'phid' => $this->getPHID(), 606 597 'commitIdentifier' => $this->getCommitIdentifier(), 607 598 'epoch' => $this->getEpoch(), 608 - 'mailKey' => $this->getMailKey(), 609 599 'authorPHID' => $this->getAuthorPHID(), 610 600 'auditStatus' => $this->getAuditStatus(), 611 601 'summary' => $this->getSummary(),