Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3216327
D25900.1741691922.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25900.1741691922.diff
View Options
diff --git a/resources/sql/autopatches/20250227.paste.01.mailkey.php b/resources/sql/autopatches/20250227.paste.01.mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20250227.paste.01.mailkey.php
@@ -0,0 +1,34 @@
+<?php
+
+$paste_table = new PhabricatorPaste();
+$paste_conn = $paste_table->establishConnection('w');
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator(
+ $paste_conn,
+ $paste_table->getTableName());
+
+foreach ($iterator as $row) {
+ // The mailKey field might be unpopulated.
+ // This should have happened in the 20130805.pastemailkeypop.php migration,
+ // but that will not work on newer installations, because the paste table
+ // was renamed in between.
+ $mailkey = $row['mailKey'] ?? Filesystem::readRandomCharacters(20);
+
+ queryfx(
+ $conn,
+ 'INSERT IGNORE INTO %T
+ (objectPHID, mailProperties, dateCreated, dateModified)
+ VALUES
+ (%s, %s, %d, %d)',
+ $properties_table->getTableName(),
+ $row['phid'],
+ phutil_json_encode(
+ array(
+ 'mailKey' => $mailkey,
+ )),
+ PhabricatorTime::getNow(),
+ PhabricatorTime::getNow());
+}
diff --git a/resources/sql/autopatches/20250227.paste.02.mailkey.sql b/resources/sql/autopatches/20250227.paste.02.mailkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20250227.paste.02.mailkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_paste.paste
+ DROP mailKey;
diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php
--- a/src/applications/paste/storage/PhabricatorPaste.php
+++ b/src/applications/paste/storage/PhabricatorPaste.php
@@ -22,7 +22,6 @@
protected $parentPHID;
protected $viewPolicy;
protected $editPolicy;
- protected $mailKey;
protected $status;
protected $spacePHID;
@@ -74,7 +73,6 @@
'status' => 'text32',
'title' => 'text255',
'language' => 'text64?',
- 'mailKey' => 'bytes20',
'parentPHID' => 'phid?',
// T6203/NULLABILITY
@@ -107,13 +105,6 @@
return ($this->getStatus() == self::STATUS_ARCHIVED);
}
- public function save() {
- if (!$this->getMailKey()) {
- $this->setMailKey(Filesystem::readRandomCharacters(20));
- }
- return parent::save();
- }
-
public function getFullName() {
$title = $this->getTitle();
if (!$title) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 11, 11:18 (1 d, 10 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1196759
Default Alt Text
D25900.1741691922.diff (2 KB)
Attached To
Mode
D25900: Remove the onboard "mailKey" from Paste
Attached
Detach File
Event Timeline
Log In to Comment