Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14397746
D21629.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D21629.id.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 11:57 AM (16 h, 56 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6920617
Default Alt Text
D21629.id.diff (2 KB)
Attached To
Mode
D21629: Modernize "mailKey" on AlamnacService
Attached
Detach File
Event Timeline
Log In to Comment