Page MenuHomePhabricator

D7602.diff
No OneTemporary

D7602.diff

Index: resources/sql/patches/20131118.ownerorder.php
===================================================================
--- /dev/null
+++ resources/sql/patches/20131118.ownerorder.php
@@ -0,0 +1,38 @@
+<?php
+
+$table = new ManiphestTask();
+$conn_w = $table->establishConnection('w');
+
+foreach (new LiskMigrationIterator($table) as $task) {
+ $id = $task->getID();
+
+ echo "Checking task T{$id}...\n";
+ $owner_phid = $task->getOwnerPHID();
+
+ if (!$owner_phid && !$task->getOwnerOrdering()) {
+ // No owner and no ordering; we're all set.
+ continue;
+ }
+
+ $owner_handle = id(new PhabricatorHandleQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withPHIDs(array($owner_phid))
+ ->executeOne();
+
+ if ($owner_handle) {
+ $value = $owner_handle->getName();
+ } else {
+ $value = null;
+ }
+
+ if ($value !== $task->getOwnerOrdering()) {
+ queryfx(
+ $conn_w,
+ 'UPDATE %T SET ownerOrdering = %ns WHERE id = %d',
+ $table->getTableName(),
+ $value,
+ $task->getID());
+ }
+}
+
+echo "Done.\n";
Index: src/applications/maniphest/editor/ManiphestTransactionEditor.php
===================================================================
--- src/applications/maniphest/editor/ManiphestTransactionEditor.php
+++ src/applications/maniphest/editor/ManiphestTransactionEditor.php
@@ -117,7 +117,26 @@
case ManiphestTransaction::TYPE_DESCRIPTION:
return $object->setDescription($xaction->getNewValue());
case ManiphestTransaction::TYPE_OWNER:
- return $object->setOwnerPHID($xaction->getNewValue());
+ $phid = $xaction->getNewValue();
+
+ // Update the "ownerOrdering" column to contain the full name of the
+ // owner, if the task is assigned.
+
+ $handle = null;
+ if ($phid) {
+ $handle = id(new PhabricatorHandleQuery())
+ ->setViewer($this->getActor())
+ ->withPHIDs(array($phid))
+ ->executeOne();
+ }
+
+ if ($handle) {
+ $object->setOwnerOrdering($handle->getName());
+ } else {
+ $object->setOwnerOrdering(null);
+ }
+
+ return $object->setOwnerPHID($phid);
case ManiphestTransaction::TYPE_CCS:
return $object->setCCPHIDs($xaction->getNewValue());
case ManiphestTransaction::TYPE_PROJECTS:
Index: src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
===================================================================
--- src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
+++ src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
@@ -1756,6 +1756,10 @@
'type' => 'php',
'name' => $this->getPatchPath('20131112.userverified.2.mig.php'),
),
+ '20131118.ownerorder.php' => array(
+ 'type' => 'php',
+ 'name' => $this->getPatchPath('20131118.ownerorder.php'),
+ ),
);
}
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 5:29 AM (11 h, 15 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6928557
Default Alt Text
D7602.diff (2 KB)

Event Timeline