Page MenuHomePhabricator

D19670.id47009.diff
No OneTemporary

D19670.id47009.diff

diff --git a/resources/sql/autopatches/20180914.audit.01.mailkey.php b/resources/sql/autopatches/20180914.audit.01.mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180914.audit.01.mailkey.php
@@ -0,0 +1,26 @@
+<?php
+
+$commit_table = new PhabricatorRepositoryCommit();
+$commit_conn = $commit_table->establishConnection('w');
+$commit_name = $commit_table->getTableName();
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator($commit_conn, $commit_name);
+foreach ($iterator as $commit) {
+ queryfx(
+ $conn,
+ 'INSERT IGNORE INTO %T
+ (objectPHID, mailProperties, dateCreated, dateModified)
+ VALUES
+ (%s, %s, %d, %d)',
+ $properties_table->getTableName(),
+ $commit['phid'],
+ phutil_json_encode(
+ array(
+ 'mailKey' => $commit['mailKey'],
+ )),
+ PhabricatorTime::getNow(),
+ PhabricatorTime::getNow());
+}
diff --git a/resources/sql/autopatches/20180914.audit.02.rmkey.sql b/resources/sql/autopatches/20180914.audit.02.rmkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180914.audit.02.rmkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_repository.repository_commit
+ DROP mailKey;
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
--- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -25,7 +25,6 @@
protected $committerIdentityPHID;
protected $commitIdentifier;
protected $epoch;
- protected $mailKey;
protected $authorPHID;
protected $auditStatus = DiffusionCommitAuditStatus::NONE;
protected $summary = '';
@@ -116,7 +115,6 @@
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'commitIdentifier' => 'text40',
- 'mailKey' => 'bytes20',
'authorPHID' => 'phid?',
'authorIdentityPHID' => 'phid?',
'committerIdentityPHID' => 'phid?',
@@ -321,13 +319,6 @@
return mpull($audits, 'getAuditorPHID');
}
- public function save() {
- if (!$this->mailKey) {
- $this->mailKey = Filesystem::readRandomCharacters(20);
- }
- return parent::save();
- }
-
public function delete() {
$data = $this->loadCommitData();
$audits = id(new PhabricatorRepositoryAuditRequest())
@@ -605,7 +596,6 @@
'phid' => $this->getPHID(),
'commitIdentifier' => $this->getCommitIdentifier(),
'epoch' => $this->getEpoch(),
- 'mailKey' => $this->getMailKey(),
'authorPHID' => $this->getAuthorPHID(),
'auditStatus' => $this->getAuditStatus(),
'summary' => $this->getSummary(),

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 1:39 PM (12 h, 41 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6789655
Default Alt Text
D19670.id47009.diff (2 KB)

Event Timeline