mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40:56 +01:00
bcf60f1b05
Summary: Closes T8048, Calendar event detail view should show "Unnamed Event" as title for events with no title Test Plan: Open an old event created before titles were required, event detail view should display title as "Unnamed Event" instead of a blank title Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8048 Differential Revision: https://secure.phabricator.com/D12736
33 lines
799 B
PHP
33 lines
799 B
PHP
<?php
|
|
|
|
echo "Retro-naming unnamed events.\n";
|
|
|
|
$table = new PhabricatorCalendarEvent();
|
|
$conn_w = $table->establishConnection('w');
|
|
$iterator = new LiskMigrationIterator($table);
|
|
foreach ($iterator as $event) {
|
|
$id = $event->getID();
|
|
|
|
if (strlen($event->getName()) == 0) {
|
|
echo "Renaming event {$id}...\n";
|
|
$viewer = PhabricatorUser::getOmnipotentUser();
|
|
$handle = id(new PhabricatorHandleQuery())
|
|
->setViewer($viewer)
|
|
->withPHIDs(array($event->getUserPHID()))
|
|
->executeOne();
|
|
if ($handle->isComplete()) {
|
|
$new_name = $handle->getName();
|
|
} else {
|
|
$new_name = pht('Unnamed Event');
|
|
}
|
|
|
|
queryfx(
|
|
$conn_w,
|
|
'UPDATE %T SET name = %s WHERE id = %d',
|
|
$table->getTableName(),
|
|
$new_name,
|
|
$id);
|
|
}
|
|
}
|
|
|
|
echo "Done.\n";
|