2015-05-06 20:11:38 +02:00
|
|
|
<?php
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Retro-naming unnamed events.')."\n";
|
2015-05-06 20:11:38 +02:00
|
|
|
|
|
|
|
$table = new PhabricatorCalendarEvent();
|
|
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
$iterator = new LiskMigrationIterator($table);
|
|
|
|
foreach ($iterator as $event) {
|
|
|
|
$id = $event->getID();
|
|
|
|
|
|
|
|
if (strlen($event->getName()) == 0) {
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Renaming event %d...', $id)."\n";
|
2015-05-06 20:11:38 +02:00
|
|
|
$viewer = PhabricatorUser::getOmnipotentUser();
|
2015-05-15 20:55:04 +02:00
|
|
|
|
|
|
|
// NOTE: This uses PeopleQuery directly, instead of HandleQuery, to avoid
|
|
|
|
// performing cache fills as a side effect; the caches were added by a
|
|
|
|
// later patch. See T8209.
|
|
|
|
$user = id(new PhabricatorPeopleQuery())
|
2015-05-06 20:11:38 +02:00
|
|
|
->setViewer($viewer)
|
2016-07-13 20:33:43 +02:00
|
|
|
->withPHIDs(array($event->getHostPHID()))
|
2015-05-06 20:11:38 +02:00
|
|
|
->executeOne();
|
2015-05-15 20:55:04 +02:00
|
|
|
|
|
|
|
if ($user) {
|
|
|
|
$new_name = $user->getUsername();
|
2015-05-06 20:11:38 +02:00
|
|
|
} else {
|
|
|
|
$new_name = pht('Unnamed Event');
|
|
|
|
}
|
|
|
|
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'UPDATE %T SET name = %s WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
$new_name,
|
|
|
|
$id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|