Page MenuHomePhabricator

D21629.diff
No OneTemporary

D21629.diff

diff --git a/resources/sql/autopatches/20210316.almanac.05.service-mailkey.php b/resources/sql/autopatches/20210316.almanac.05.service-mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.05.service-mailkey.php
@@ -0,0 +1,28 @@
+<?php
+
+$service_table = new AlmanacService();
+$service_conn = $service_table->establishConnection('w');
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator(
+ $service_conn,
+ $service_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.06.service-dropmailkey.sql b/resources/sql/autopatches/20210316.almanac.06.service-dropmailkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.06.service-dropmailkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_almanac.almanac_service
+ DROP mailKey;
diff --git a/src/applications/almanac/storage/AlmanacService.php b/src/applications/almanac/storage/AlmanacService.php
--- a/src/applications/almanac/storage/AlmanacService.php
+++ b/src/applications/almanac/storage/AlmanacService.php
@@ -14,7 +14,6 @@
protected $name;
protected $nameIndex;
- protected $mailKey;
protected $viewPolicy;
protected $editPolicy;
protected $serviceType;
@@ -49,7 +48,6 @@
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text128',
'nameIndex' => 'bytes12',
- 'mailKey' => 'bytes20',
'serviceType' => 'text64',
),
self::CONFIG_KEY_SCHEMA => array(
@@ -67,8 +65,8 @@
) + parent::getConfiguration();
}
- public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(AlmanacServicePHIDType::TYPECONST);
+ public function getPHIDType() {
+ return AlmanacServicePHIDType::TYPECONST;
}
public function save() {
@@ -76,10 +74,6 @@
$this->nameIndex = PhabricatorHash::digestForIndex($this->getName());
- if (!$this->mailKey) {
- $this->mailKey = Filesystem::readRandomCharacters(20);
- }
-
return parent::save();
}

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 5:34 AM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6290026
Default Alt Text
D21629.diff (2 KB)

Event Timeline