Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14095807
D7896.id17870.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
D7896.id17870.diff
View Options
Index: resources/sql/autopatches/20140106.macromailkey.1.sql
===================================================================
--- /dev/null
+++ resources/sql/autopatches/20140106.macromailkey.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_file.file_imagemacro
+ ADD mailKey VARCHAR(20) NOT NULL COLLATE utf8_bin;
Index: resources/sql/autopatches/20140106.macromailkey.2.php
===================================================================
--- /dev/null
+++ resources/sql/autopatches/20140106.macromailkey.2.php
@@ -0,0 +1,23 @@
+<?php
+
+echo "Adding mailkeys to macros.\n";
+
+$table = new PhabricatorFileImageMacro();
+$conn_w = $table->establishConnection('w');
+$iterator = new LiskMigrationIterator($table);
+foreach ($iterator as $macro) {
+ $id = $macro->getID();
+
+ echo "Populating macro {$id}...\n";
+
+ if (!$macro->getMailKey()) {
+ queryfx(
+ $conn_w,
+ 'UPDATE %T SET mailKey = %s WHERE id = %d',
+ $table->getTableName(),
+ Filesystem::readRandomCharacters(20),
+ $id);
+ }
+}
+
+echo "Done.\n";
Index: src/applications/macro/storage/PhabricatorFileImageMacro.php
===================================================================
--- src/applications/macro/storage/PhabricatorFileImageMacro.php
+++ src/applications/macro/storage/PhabricatorFileImageMacro.php
@@ -13,6 +13,7 @@
protected $isDisabled = 0;
protected $audioPHID;
protected $audioBehavior = self::AUDIO_BEHAVIOR_NONE;
+ protected $mailKey;
private $file = self::ATTACHABLE;
private $audio = self::ATTACHABLE;
@@ -50,10 +51,18 @@
PhabricatorMacroPHIDTypeMacro::TYPECONST);
}
- public function isAutomaticallySubscribed($phid) {
- return false;
+
+ public function save() {
+ if (!$this->getMailKey()) {
+ $this->setMailKey(Filesystem::readRandomCharacters(20));
+ }
+ return parent::save();
}
+
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
public function getApplicationTransactionEditor() {
return new PhabricatorMacroEditor();
}
@@ -62,6 +71,18 @@
return new PhabricatorMacroTransaction();
}
+
+/* -( PhabricatorSubscribableInterface )----------------------------------- */
+
+
+ public function isAutomaticallySubscribed($phid) {
+ return false;
+ }
+
+
+/* -( PhabricatorPolicyInterface )----------------------------------------- */
+
+
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 11:49 PM (14 h, 56 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6791246
Default Alt Text
D7896.id17870.diff (2 KB)
Attached To
Mode
D7896: Add mailKey to macros
Attached
Detach File
Event Timeline
Log In to Comment