Page MenuHomePhabricator

D21632.id51495.diff
No OneTemporary

D21632.id51495.diff

diff --git a/resources/sql/autopatches/20210316.almanac.11.network-mailkey.php b/resources/sql/autopatches/20210316.almanac.11.network-mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.11.network-mailkey.php
@@ -0,0 +1,28 @@
+<?php
+
+$network_table = new AlmanacNetwork();
+$network_conn = $network_table->establishConnection('w');
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator(
+ $network_conn,
+ $network_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.12.network-dropmailkey.sql b/resources/sql/autopatches/20210316.almanac.12.network-dropmailkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20210316.almanac.12.network-dropmailkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_almanac.almanac_network
+ DROP mailKey;
diff --git a/src/applications/almanac/storage/AlmanacNetwork.php b/src/applications/almanac/storage/AlmanacNetwork.php
--- a/src/applications/almanac/storage/AlmanacNetwork.php
+++ b/src/applications/almanac/storage/AlmanacNetwork.php
@@ -10,7 +10,6 @@
PhabricatorConduitResultInterface {
protected $name;
- protected $mailKey;
protected $viewPolicy;
protected $editPolicy;
@@ -25,8 +24,6 @@
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'sort128',
- 'mailKey' => 'bytes20',
-
),
self::CONFIG_KEY_SCHEMA => array(
'key_name' => array(
@@ -37,20 +34,14 @@
) + parent::getConfiguration();
}
- public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(AlmanacNetworkPHIDType::TYPECONST);
- }
-
- public function save() {
- if (!$this->mailKey) {
- $this->mailKey = Filesystem::readRandomCharacters(20);
- }
-
- return parent::save();
+ public function getPHIDType() {
+ return AlmanacNetworkPHIDType::TYPECONST;
}
public function getURI() {
- return '/almanac/network/'.$this->getID().'/';
+ return urisprintf(
+ '/almanac/network/%s/',
+ $this->getID());
}

File Metadata

Mime Type
text/plain
Expires
Jun 7 2024, 2:30 PM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6290314
Default Alt Text
D21632.id51495.diff (2 KB)

Event Timeline