2014-02-10 23:40:09 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$table = new HeraldCondition();
|
|
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht(
|
|
|
|
"Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n");
|
2014-02-10 23:40:09 +01:00
|
|
|
foreach (new LiskMigrationIterator($table) as $condition) {
|
2015-07-06 22:15:47 +02:00
|
|
|
if ($condition->getFieldName() != HeraldAnotherRuleField::FIELDCONST) {
|
2014-02-10 23:40:09 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$value = $condition->getValue();
|
|
|
|
if (!is_numeric($value)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$id = $condition->getID();
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Updating condition %s...', $id)."\n";
|
2014-02-10 23:40:09 +01:00
|
|
|
|
|
|
|
$rule = id(new HeraldRuleQuery())
|
|
|
|
->setViewer(PhabricatorUser::getOmnipotentUser())
|
|
|
|
->withIDs(array($value))
|
|
|
|
->executeOne();
|
|
|
|
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'UPDATE %T SET value = %s WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
json_encode($rule->getPHID()),
|
|
|
|
$id);
|
|
|
|
}
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|