Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15391402
D21842.id52057.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
D21842.id52057.diff
View Options
diff --git a/resources/sql/autopatches/20220525.slowvote.01.mailkey.php b/resources/sql/autopatches/20220525.slowvote.01.mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20220525.slowvote.01.mailkey.php
@@ -0,0 +1,28 @@
+<?php
+
+$poll_table = new PhabricatorSlowvotePoll();
+$poll_conn = $poll_table->establishConnection('w');
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator(
+ $poll_conn,
+ $poll_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/20220525.slowvote.02.mailkey-drop.sql b/resources/sql/autopatches/20220525.slowvote.02.mailkey-drop.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20220525.slowvote.02.mailkey-drop.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_slowvote.slowvote_poll
+ DROP mailKey;
diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
--- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
+++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
@@ -1,6 +1,7 @@
<?php
-final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
+final class PhabricatorSlowvotePoll
+ extends PhabricatorSlowvoteDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
@@ -25,7 +26,6 @@
protected $responseVisibility = 0;
protected $shuffle = 0;
protected $method;
- protected $mailKey;
protected $viewPolicy;
protected $isClosed = 0;
protected $spacePHID;
@@ -59,16 +59,14 @@
'method' => 'uint32',
'description' => 'text',
'isClosed' => 'bool',
- 'mailKey' => 'bytes20',
),
self::CONFIG_KEY_SCHEMA => array(
),
) + parent::getConfiguration();
}
- public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(
- PhabricatorSlowvotePollPHIDType::TYPECONST);
+ public function getPHIDType() {
+ return PhabricatorSlowvotePollPHIDType::TYPECONST;
}
public function getOptions() {
@@ -112,13 +110,6 @@
return '/'.$this->getMonogram();
}
- public function save() {
- if (!$this->getMailKey()) {
- $this->setMailKey(Filesystem::readRandomCharacters(20));
- }
- return parent::save();
- }
-
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 9:43 AM (5 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7652085
Default Alt Text
D21842.id52057.diff (2 KB)
Attached To
Mode
D21842: Migrate "SlowvotePoll" to modern mailkey storage
Attached
Detach File
Event Timeline
Log In to Comment