Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15413925
D17642.id42436.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D17642.id42436.diff
View Options
diff --git a/resources/sql/autopatches/20170410.calendar.01.repair.php b/resources/sql/autopatches/20170410.calendar.01.repair.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170410.calendar.01.repair.php
@@ -0,0 +1,42 @@
+<?php
+
+// See T12488. Some events survived "20161004.cal.01.noepoch.php" without
+// having "utcInstanceEpoch" computed, which breaks ICS export. This appears
+// to be the result of some bug which has been fixed in the meantime, so just
+// redo this part of the migration.
+
+$table = new PhabricatorCalendarEvent();
+$conn = $table->establishConnection('w');
+$table_name = $table->getTableName();
+
+$viewer = PhabricatorUser::getOmnipotentUser();
+$all_events = id(new PhabricatorCalendarEventQuery())
+ ->setViewer($viewer)
+ ->execute();
+foreach ($all_events as $event) {
+ $id = $event->getID();
+
+ if (!$event->getInstanceOfEventPHID()) {
+ // Not a child event, so no instance epoch.
+ continue;
+ }
+
+ if ($event->getUTCInstanceEpoch()) {
+ // Already has an instance epoch.
+ continue;
+ }
+
+ try {
+ $event->updateUTCEpochs();
+ } catch (Exception $ex) {
+ phlog($ex);
+ continue;
+ }
+
+ queryfx(
+ $conn,
+ 'UPDATE %T SET utcInstanceEpoch = %nd WHERE id = %d',
+ $table_name,
+ $event->getUTCInstanceEpoch(),
+ $id);
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 10:01 PM (3 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704294
Default Alt Text
D17642.id42436.diff (1 KB)
Attached To
Mode
D17642: Add a repair migration to fix legacy Calendar events without "utcInstanceEpoch"
Attached
Detach File
Event Timeline
Log In to Comment