2013-11-19 23:10:54 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$table = new ManiphestTask();
|
|
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
|
2014-02-07 18:17:11 +01:00
|
|
|
$user_table = new PhabricatorUser();
|
|
|
|
$user_conn = $user_table->establishConnection('r');
|
|
|
|
|
2013-11-19 23:10:54 +01:00
|
|
|
foreach (new LiskMigrationIterator($table) as $task) {
|
|
|
|
$id = $task->getID();
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Checking task %s...', "T{$id}")."\n";
|
2013-11-19 23:10:54 +01:00
|
|
|
$owner_phid = $task->getOwnerPHID();
|
|
|
|
|
|
|
|
if (!$owner_phid && !$task->getOwnerOrdering()) {
|
|
|
|
// No owner and no ordering; we're all set.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-02-07 18:17:11 +01:00
|
|
|
$owner_row = queryfx_one(
|
|
|
|
$user_conn,
|
|
|
|
'SELECT * FROM %T WHERE phid = %s',
|
|
|
|
$user_table->getTableName(),
|
|
|
|
$owner_phid);
|
2013-11-19 23:10:54 +01:00
|
|
|
|
2014-02-07 18:17:11 +01:00
|
|
|
if ($owner_row) {
|
|
|
|
$value = $owner_row['userName'];
|
2013-11-19 23:10:54 +01:00
|
|
|
} else {
|
|
|
|
$value = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($value !== $task->getOwnerOrdering()) {
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'UPDATE %T SET ownerOrdering = %ns WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
$value,
|
|
|
|
$task->getID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|