diff --git a/resources/sql/autopatches/20210316.almanac.13.event-mailkey.php b/resources/sql/autopatches/20210316.almanac.13.event-mailkey.php new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20210316.almanac.13.event-mailkey.php @@ -0,0 +1,28 @@ +establishConnection('w'); + +$properties_table = new PhabricatorMetaMTAMailProperties(); +$conn = $properties_table->establishConnection('w'); + +$iterator = new LiskRawMigrationIterator( + $event_conn, + $event_table->getTableName()); + +foreach ($iterator as $row) { + queryfx( + $conn, + 'INSERT IGNORE INTO %R + (objectPHID, mailProperties, dateCreated, dateModified) + VALUES + (%s, %s, %d, %d)', + $properties_table, + $row['phid'], + phutil_json_encode( + array( + 'mailKey' => $row['mailKey'], + )), + PhabricatorTime::getNow(), + PhabricatorTime::getNow()); +} diff --git a/resources/sql/autopatches/20210316.almanac.14.event-dropmailkey.sql b/resources/sql/autopatches/20210316.almanac.14.event-dropmailkey.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20210316.almanac.14.event-dropmailkey.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_calendar.calendar_event + DROP mailKey; diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -24,7 +24,6 @@ protected $isCancelled; protected $isAllDay; protected $icon; - protected $mailKey; protected $isStub; protected $isRecurring = 0; @@ -360,10 +359,6 @@ } public function save() { - if (!$this->mailKey) { - $this->mailKey = Filesystem::readRandomCharacters(20); - } - $import_uid = $this->getImportUID(); if ($import_uid !== null) { $index = PhabricatorHash::digestForIndex($import_uid); @@ -405,7 +400,6 @@ 'isCancelled' => 'bool', 'isAllDay' => 'bool', 'icon' => 'text32', - 'mailKey' => 'bytes20', 'isRecurring' => 'bool', 'seriesParentPHID' => 'phid?', 'instanceOfEventPHID' => 'phid?', @@ -442,9 +436,8 @@ ) + parent::getConfiguration(); } - public function generatePHID() { - return PhabricatorPHID::generateNewPHID( - PhabricatorCalendarEventPHIDType::TYPECONST); + public function getPHIDType() { + return PhabricatorCalendarEventPHIDType::TYPECONST; } public function getMonogram() {