1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 19:02:41 +01:00
phorge-phorge/resources/sql/autopatches/20160720.calendar.invitetxn.php
Aviv Eyal b6bf0f6a3b Re-implement calendar.invite transactions
Summary:
Fix T11339.
Now, old and new are both simple lists of phids, and the rendering should make sense.

Test Plan: Viewed existing transaction with all 3 states.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T11339

Differential Revision: https://secure.phabricator.com/D16311
2016-07-22 18:03:28 +00:00

37 lines
890 B
PHP

<?php
$table = new PhabricatorCalendarEventTransaction();
$conn_w = $table->establishConnection('w');
echo pht(
"Restructuring calendar invite transactions...\n");
foreach (new LiskMigrationIterator($table) as $txn) {
$type = PhabricatorCalendarEventInviteTransaction::TRANSACTIONTYPE;
if ($txn->getTransactionType() != $type) {
continue;
}
$old_value = array_keys($txn->getOldValue());
$orig_new = $txn->getNewValue();
$status_uninvited = 'uninvited';
foreach ($orig_new as $key => $status) {
if ($status == $status_uninvited) {
unset($orig_new[$key]);
}
}
$new_value = array_keys($orig_new);
queryfx(
$conn_w,
'UPDATE %T SET '.
'oldValue = %s, newValue = %s'.
'WHERE id = %d',
$table->getTableName(),
phutil_json_encode($old_value),
phutil_json_encode($new_value),
$txn->getID());
}
echo pht('Done.')."\n";