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

Restore population of `ownerOrdering` to ManiphestTasks

Summary:
Ref T4110. This denormalized field used to power "Group By: Assigned" got dropped in the T2217 migration at some point.

Restore its population, and fix all the data in the database.

Test Plan: Ran migration, verified database came out reasonable-looking. Reassigned a task, verified database. Ran a "Group By: assigned" query.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4110

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

+62 -1
+38
resources/sql/patches/20131118.ownerorder.php
··· 1 + <?php 2 + 3 + $table = new ManiphestTask(); 4 + $conn_w = $table->establishConnection('w'); 5 + 6 + foreach (new LiskMigrationIterator($table) as $task) { 7 + $id = $task->getID(); 8 + 9 + echo "Checking task T{$id}...\n"; 10 + $owner_phid = $task->getOwnerPHID(); 11 + 12 + if (!$owner_phid && !$task->getOwnerOrdering()) { 13 + // No owner and no ordering; we're all set. 14 + continue; 15 + } 16 + 17 + $owner_handle = id(new PhabricatorHandleQuery()) 18 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 19 + ->withPHIDs(array($owner_phid)) 20 + ->executeOne(); 21 + 22 + if ($owner_handle) { 23 + $value = $owner_handle->getName(); 24 + } else { 25 + $value = null; 26 + } 27 + 28 + if ($value !== $task->getOwnerOrdering()) { 29 + queryfx( 30 + $conn_w, 31 + 'UPDATE %T SET ownerOrdering = %ns WHERE id = %d', 32 + $table->getTableName(), 33 + $value, 34 + $task->getID()); 35 + } 36 + } 37 + 38 + echo "Done.\n";
+20 -1
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 117 117 case ManiphestTransaction::TYPE_DESCRIPTION: 118 118 return $object->setDescription($xaction->getNewValue()); 119 119 case ManiphestTransaction::TYPE_OWNER: 120 - return $object->setOwnerPHID($xaction->getNewValue()); 120 + $phid = $xaction->getNewValue(); 121 + 122 + // Update the "ownerOrdering" column to contain the full name of the 123 + // owner, if the task is assigned. 124 + 125 + $handle = null; 126 + if ($phid) { 127 + $handle = id(new PhabricatorHandleQuery()) 128 + ->setViewer($this->getActor()) 129 + ->withPHIDs(array($phid)) 130 + ->executeOne(); 131 + } 132 + 133 + if ($handle) { 134 + $object->setOwnerOrdering($handle->getName()); 135 + } else { 136 + $object->setOwnerOrdering(null); 137 + } 138 + 139 + return $object->setOwnerPHID($phid); 121 140 case ManiphestTransaction::TYPE_CCS: 122 141 return $object->setCCPHIDs($xaction->getNewValue()); 123 142 case ManiphestTransaction::TYPE_PROJECTS:
+4
src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
··· 1756 1756 'type' => 'php', 1757 1757 'name' => $this->getPatchPath('20131112.userverified.2.mig.php'), 1758 1758 ), 1759 + '20131118.ownerorder.php' => array( 1760 + 'type' => 'php', 1761 + 'name' => $this->getPatchPath('20131118.ownerorder.php'), 1762 + ), 1759 1763 ); 1760 1764 } 1761 1765 }