Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15425729
D14605.id35326.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14605.id35326.diff
View Options
diff --git a/resources/sql/autopatches/20151130.phurl.mailkey.1.sql b/resources/sql/autopatches/20151130.phurl.mailkey.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20151130.phurl.mailkey.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phurl.phurl_url
+ ADD mailKey binary(20) NOT NULL;
diff --git a/resources/sql/autopatches/20151130.phurl.mailkey.2.php b/resources/sql/autopatches/20151130.phurl.mailkey.2.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20151130.phurl.mailkey.2.php
@@ -0,0 +1,18 @@
+<?php
+
+$table = new PhabricatorPhurlURL();
+$conn_w = $table->establishConnection('w');
+$iterator = new LiskMigrationIterator($table);
+foreach ($iterator as $url) {
+ $id = $url->getID();
+
+ echo pht('Adding mail key for Phurl %d...', $id);
+ echo "\n";
+
+ queryfx(
+ $conn_w,
+ 'UPDATE %T SET mailKey = %s WHERE id = %d',
+ $table->getTableName(),
+ Filesystem::readRandomCharacters(20),
+ $id);
+}
diff --git a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php
--- a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php
+++ b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php
@@ -211,11 +211,9 @@
public function getMailTagsMap() {
return array(
- PhabricatorPhurlURLTransaction::MAILTAG_CONTENT =>
+ PhabricatorPhurlURLTransaction::MAILTAG_DETAILS =>
pht(
- "A URL's name or path changes."),
- PhabricatorPhurlURLTransaction::MAILTAG_OTHER =>
- pht('Other event activity not listed above occurs.'),
+ "A URL's details change."),
);
}
diff --git a/src/applications/phurl/storage/PhabricatorPhurlURL.php b/src/applications/phurl/storage/PhabricatorPhurlURL.php
--- a/src/applications/phurl/storage/PhabricatorPhurlURL.php
+++ b/src/applications/phurl/storage/PhabricatorPhurlURL.php
@@ -22,6 +22,8 @@
protected $authorPHID;
protected $spacePHID;
+ protected $mailKey;
+
const DEFAULT_ICON = 'fa-compress';
public static function initializeNewPhurlURL(PhabricatorUser $actor) {
@@ -45,6 +47,7 @@
'alias' => 'sort64?',
'longURL' => 'text',
'description' => 'text',
+ 'mailKey' => 'bytes20',
),
self::CONFIG_KEY_SCHEMA => array(
'key_instance' => array(
@@ -58,6 +61,13 @@
) + parent::getConfiguration();
}
+ public function save() {
+ if (!$this->getMailKey()) {
+ $this->setMailKey(Filesystem::readRandomCharacters(20));
+ }
+ return parent::save();
+ }
+
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPhurlURLPHIDType::TYPECONST);
diff --git a/src/applications/phurl/storage/PhabricatorPhurlURLTransaction.php b/src/applications/phurl/storage/PhabricatorPhurlURLTransaction.php
--- a/src/applications/phurl/storage/PhabricatorPhurlURLTransaction.php
+++ b/src/applications/phurl/storage/PhabricatorPhurlURLTransaction.php
@@ -8,8 +8,7 @@
const TYPE_ALIAS = 'phurl.alias';
const TYPE_DESCRIPTION = 'phurl.description';
- const MAILTAG_CONTENT = 'phurl:content';
- const MAILTAG_OTHER = 'phurl:other';
+ const MAILTAG_DETAILS = 'phurl-details';
public function getApplicationName() {
return 'phurl';
@@ -235,7 +234,7 @@
case self::TYPE_DESCRIPTION:
case self::TYPE_URL:
case self::TYPE_ALIAS:
- $tags[] = self::MAILTAG_CONTENT;
+ $tags[] = self::MAILTAG_DETAILS;
break;
}
return $tags;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 24, 5:44 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7683949
Default Alt Text
D14605.id35326.diff (3 KB)
Attached To
Mode
D14605: Correctly implementing mailkey for Phurl
Attached
Detach File
Event Timeline
Log In to Comment