@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.

Retroactively populate Phriction mailKey column

Summary:
Fixes T6487. Ref T1191. Ref T4029. D10756 introduced, but did not populate, this column. This can cause it to fill with `"\0\0\0..."` after adjustment.

Regardless of the adjustment issue, it's nice to populate this column anyway because there's no fundamental reason an object can't have mail sent about it without being saved first, even though it may not practically be possible in the codebase today.

Test Plan:
- Ran `storage upgrade`, saw the column populate for older documents.
- Forced a couple of keys to bad values (too short or with "\0") and saw the migration fix them.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4029, T1191, T6487

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

+29
+29
resources/sql/autopatches/20141107.phriction.popkeys.php
··· 1 + <?php 2 + 3 + $table = new PhrictionDocument(); 4 + $conn_w = $table->establishConnection('w'); 5 + 6 + echo "Populating Phriction mailkeys.\n"; 7 + 8 + foreach (new LiskMigrationIterator($table) as $doc) { 9 + $id = $doc->getID(); 10 + 11 + $key = $doc->getMailKey(); 12 + if ((strlen($key) == 20) && (strpos($key, "\0") === false)) { 13 + // To be valid, keys must have length 20 and not contain any null bytes. 14 + // See T6487. 15 + echo "Document has valid mailkey.\n"; 16 + continue; 17 + } else { 18 + echo "Populating mailkey for document {$id}...\n"; 19 + $mail_key = Filesystem::readRandomCharacters(20); 20 + queryfx( 21 + $conn_w, 22 + 'UPDATE %T SET mailKey = %s WHERE id = %d', 23 + $table->getTableName(), 24 + $mail_key, 25 + $id); 26 + } 27 + } 28 + 29 + echo "Done.\n";