1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-15 18:10:53 +01:00
phorge-phorge/resources/sql/patches/20131118.ownerorder.php

39 lines
837 B
PHP
Raw Normal View History

<?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";