@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 a repair migration to fix legacy Calendar events without "utcInstanceEpoch"

Summary: Fixes T12488. Some events appear to have survived earlier migrations without getting completely fixed. Fix them.

Test Plan:
- Ran migration locally with `bin/storage upgrade` (but: I could not reproduce this problem locally).
- Ran migration in production and saw ICS import stop fataling.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12488

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

+42
+42
resources/sql/autopatches/20170410.calendar.01.repair.php
··· 1 + <?php 2 + 3 + // See T12488. Some events survived "20161004.cal.01.noepoch.php" without 4 + // having "utcInstanceEpoch" computed, which breaks ICS export. This appears 5 + // to be the result of some bug which has been fixed in the meantime, so just 6 + // redo this part of the migration. 7 + 8 + $table = new PhabricatorCalendarEvent(); 9 + $conn = $table->establishConnection('w'); 10 + $table_name = $table->getTableName(); 11 + 12 + $viewer = PhabricatorUser::getOmnipotentUser(); 13 + $all_events = id(new PhabricatorCalendarEventQuery()) 14 + ->setViewer($viewer) 15 + ->execute(); 16 + foreach ($all_events as $event) { 17 + $id = $event->getID(); 18 + 19 + if (!$event->getInstanceOfEventPHID()) { 20 + // Not a child event, so no instance epoch. 21 + continue; 22 + } 23 + 24 + if ($event->getUTCInstanceEpoch()) { 25 + // Already has an instance epoch. 26 + continue; 27 + } 28 + 29 + try { 30 + $event->updateUTCEpochs(); 31 + } catch (Exception $ex) { 32 + phlog($ex); 33 + continue; 34 + } 35 + 36 + queryfx( 37 + $conn, 38 + 'UPDATE %T SET utcInstanceEpoch = %nd WHERE id = %d', 39 + $table_name, 40 + $event->getUTCInstanceEpoch(), 41 + $id); 42 + }