Page MenuHomePhabricator

D21842.diff
No OneTemporary

D21842.diff

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

Mime Type
text/plain
Expires
Tue, May 14, 5:48 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284965
Default Alt Text
D21842.diff (2 KB)

Event Timeline