@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add mailKeys to Ponder Answer

Summary: Ref T3846. Adds mailkey generation and migration.

Test Plan: Ran the migration, see keys in mysql.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T3846

Differential Revision: https://secure.phabricator.com/D13785

+29
+2
resources/sql/autopatches/20150804.ponder.answer.mailkey.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_ponder.ponder_answer 2 + ADD mailKey binary(20) NOT NULL;
+18
resources/sql/autopatches/20150804.ponder.answer.mailkey.2.php
··· 1 + <?php 2 + 3 + $table = new PonderAnswer(); 4 + $conn_w = $table->establishConnection('w'); 5 + $iterator = new LiskMigrationIterator($table); 6 + foreach ($iterator as $answer) { 7 + $id = $answer->getID(); 8 + 9 + echo pht('Adding mail key for Answer %d...', $id); 10 + echo "\n"; 11 + 12 + queryfx( 13 + $conn_w, 14 + 'UPDATE %T SET mailKey = %s WHERE id = %d', 15 + $table->getTableName(), 16 + Filesystem::readRandomCharacters(20), 17 + $id); 18 + }
+9
src/applications/ponder/storage/PonderAnswer.php
··· 18 18 19 19 protected $content; 20 20 protected $contentSource; 21 + protected $mailKey; 21 22 22 23 protected $voteCount; 23 24 private $vote; ··· 71 72 self::CONFIG_COLUMN_SCHEMA => array( 72 73 'voteCount' => 'sint32', 73 74 'content' => 'text', 75 + 'mailKey' => 'bytes20', 74 76 75 77 // T6203/NULLABILITY 76 78 // This should always exist. ··· 111 113 112 114 public function getMarkupField() { 113 115 return self::MARKUP_FIELD_CONTENT; 116 + } 117 + 118 + public function save() { 119 + if (!$this->getMailKey()) { 120 + $this->setMailKey(Filesystem::readRandomCharacters(20)); 121 + } 122 + return parent::save(); 114 123 } 115 124 116 125