Page MenuHomePhabricator

D21634.diff
No OneTemporary

D21634.diff

diff --git a/resources/sql/autopatches/20210316.almanac.15.intiative-mailkey.php b/resources/sql/autopatches/20210316.almanac.15.intiative-mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.15.intiative-mailkey.php
@@ -0,0 +1,28 @@
+<?php
+
+$initiative_table = new FundInitiative();
+$initiative_conn = $initiative_table->establishConnection('w');
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator(
+ $initiative_conn,
+ $initiative_table->getTableName());
+
+foreach ($iterator as $row) {
+ queryfx(
+ $conn,
+ 'INSERT IGNORE INTO %R
+ (objectPHID, mailProperties, dateCreated, dateModified)
+ VALUES
+ (%s, %s, %d, %d)',
+ $properties_table,
+ $row['phid'],
+ phutil_json_encode(
+ array(
+ 'mailKey' => $row['mailKey'],
+ )),
+ PhabricatorTime::getNow(),
+ PhabricatorTime::getNow());
+}
diff --git a/resources/sql/autopatches/20210316.almanac.16.initiative-dropmailkey.sql b/resources/sql/autopatches/20210316.almanac.16.initiative-dropmailkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.16.initiative-dropmailkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_fund.fund_initiative
+ DROP mailKey;
diff --git a/src/applications/fund/storage/FundInitiative.php b/src/applications/fund/storage/FundInitiative.php
--- a/src/applications/fund/storage/FundInitiative.php
+++ b/src/applications/fund/storage/FundInitiative.php
@@ -22,7 +22,6 @@
protected $editPolicy;
protected $status;
protected $totalAsCurrency;
- protected $mailKey;
private $projectPHIDs = self::ATTACHABLE;
@@ -62,7 +61,6 @@
'status' => 'text32',
'merchantPHID' => 'phid?',
'totalAsCurrency' => 'text64',
- 'mailKey' => 'bytes20',
),
self::CONFIG_APPLICATION_SERIALIZERS => array(
'totalAsCurrency' => new PhortuneCurrencySerializer(),
@@ -78,8 +76,8 @@
) + parent::getConfiguration();
}
- public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(FundInitiativePHIDType::TYPECONST);
+ public function getPHIDType() {
+ return FundInitiativePHIDType::TYPECONST;
}
public function getMonogram() {
@@ -103,13 +101,6 @@
return ($this->getStatus() == self::STATUS_CLOSED);
}
- public function save() {
- if (!$this->mailKey) {
- $this->mailKey = Filesystem::readRandomCharacters(20);
- }
- return parent::save();
- }
-
/* -( PhabricatorPolicyInterface )----------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 9, 2:03 AM (2 w, 18 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7385692
Default Alt Text
D21634.diff (2 KB)

Event Timeline