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

Soften checks on a very old Maniphest transactionmigration

Summary:
Ref T9464. If an ancient transaction doesn't have array values for whatever reason, we fail here.

Instead, just recover as gracefully as we can. We may get the transaction "wrong" in some sense, but this only impacts what is rendered in the transaction log.

Test Plan: This is nearly a year old and there's no real way to test it.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9464

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

+32 -20
+32 -20
resources/sql/autopatches/20141222.maniphestprojtxn.php
··· 9 9 'edge:type' => PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, 10 10 ); 11 11 foreach (new LiskMigrationIterator($table) as $txn) { 12 - // ManiphestTransaction::TYPE_PROJECTS 13 - if ($txn->getTransactionType() == 'projects') { 14 - $old_value = mig20141222_build_edge_data( 15 - $txn->getOldValue(), 16 - $txn->getObjectPHID()); 17 - $new_value = mig20141222_build_edge_data( 18 - $txn->getNewvalue(), 19 - $txn->getObjectPHID()); 20 - queryfx( 21 - $conn_w, 22 - 'UPDATE %T SET '. 23 - 'transactionType = %s, oldValue = %s, newValue = %s, metaData = %s '. 24 - 'WHERE id = %d', 25 - $table->getTableName(), 26 - PhabricatorTransactions::TYPE_EDGE, 27 - json_encode($old_value), 28 - json_encode($new_value), 29 - json_encode($metadata), 30 - $txn->getID()); 12 + if ($txn->getTransactionType() != 'projects') { 13 + continue; 31 14 } 15 + 16 + $old_value = mig20141222_build_edge_data( 17 + $txn->getOldValue(), 18 + $txn->getObjectPHID()); 19 + 20 + $new_value = mig20141222_build_edge_data( 21 + $txn->getNewValue(), 22 + $txn->getObjectPHID()); 23 + 24 + queryfx( 25 + $conn_w, 26 + 'UPDATE %T SET '. 27 + 'transactionType = %s, oldValue = %s, newValue = %s, metaData = %s '. 28 + 'WHERE id = %d', 29 + $table->getTableName(), 30 + PhabricatorTransactions::TYPE_EDGE, 31 + json_encode($old_value), 32 + json_encode($new_value), 33 + json_encode($metadata), 34 + $txn->getID()); 32 35 } 33 36 34 37 echo pht('Done.')."\n"; 35 38 36 - function mig20141222_build_edge_data(array $project_phids, $task_phid) { 39 + function mig20141222_build_edge_data($project_phids, $task_phid) { 37 40 $edge_data = array(); 41 + 42 + // See T9464. If we didn't get a proper array value out of the transaction, 43 + // just return an empty value so we can move forward. 44 + if (!is_array($project_phids)) { 45 + return $edge_data; 46 + } 47 + 38 48 foreach ($project_phids as $project_phid) { 39 49 if (!is_scalar($project_phid)) { 40 50 continue; 41 51 } 52 + 42 53 $edge_data[$project_phid] = array( 43 54 'src' => $task_phid, 44 55 'type' => PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, 45 56 'dst' => $project_phid, 46 57 ); 47 58 } 59 + 48 60 return $edge_data; 49 61 }