forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20131118.ownerorder.php
42 lines (33 loc) · 918 Bytes
/
20131118.ownerorder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
$table = new ManiphestTask();
$conn_w = $table->establishConnection('w');
$user_table = new PhabricatorUser();
$user_conn = $user_table->establishConnection('r');
foreach (new LiskMigrationIterator($table) as $task) {
$id = $task->getID();
echo pht('Checking task %s...', "T{$id}")."\n";
$owner_phid = $task->getOwnerPHID();
if (!$owner_phid && !$task->getOwnerOrdering()) {
// No owner and no ordering; we're all set.
continue;
}
$owner_row = queryfx_one(
$user_conn,
'SELECT * FROM %T WHERE phid = %s',
$user_table->getTableName(),
$owner_phid);
if ($owner_row) {
$value = $owner_row['userName'];
} else {
$value = null;
}
if ($value !== $task->getOwnerOrdering()) {
queryfx(
$conn_w,
'UPDATE %T SET ownerOrdering = %ns WHERE id = %d',
$table->getTableName(),
$value,
$task->getID());
}
}
echo pht('Done.')."\n";