1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 04:42:40 +01:00

Don't use handles in the Calendar event name migration

Summary:
Fixes T8209. Using handles can now cause cache fills as a side effect of T7707. Use a raw query instead.

I'll follow up on T8209 with some context and ideas for longer-term fixes.

Test Plan:
  - Set event names to `''`.
  - Reran migration with `--apply ... --trace`.
  - Saw migration work correctly without executing cache fills.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8209

Differential Revision: https://secure.phabricator.com/D12858
This commit is contained in:
epriestley 2015-05-15 11:55:04 -07:00
parent 7179def064
commit 27b78d2147

View file

@ -11,12 +11,17 @@ foreach ($iterator as $event) {
if (strlen($event->getName()) == 0) {
echo "Renaming event {$id}...\n";
$viewer = PhabricatorUser::getOmnipotentUser();
$handle = id(new PhabricatorHandleQuery())
// 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())
->setViewer($viewer)
->withPHIDs(array($event->getUserPHID()))
->executeOne();
if ($handle->isComplete()) {
$new_name = $handle->getName();
if ($user) {
$new_name = $user->getUsername();
} else {
$new_name = pht('Unnamed Event');
}