Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93927177
20150506.calendarunnamedevents.1.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Dec 2, 13:57
Size
995 B
Mime Type
text/x-php
Expires
Wed, Dec 4, 13:57 (2 d)
Engine
blob
Format
Raw Data
Handle
22723465
Attached To
rPH Phabricator
20150506.calendarunnamedevents.1.php
View Options
<?php
echo
pht
(
'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
pht
(
'Renaming event %d...'
,
$id
).
"
\n
"
;
$viewer
=
PhabricatorUser
::
getOmnipotentUser
();
// 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
(
$user
)
{
$new_name
=
$user
->
getUsername
();
}
else
{
$new_name
=
pht
(
'Unnamed Event'
);
}
queryfx
(
$conn_w
,
'UPDATE %T SET name = %s WHERE id = %d'
,
$table
->
getTableName
(),
$new_name
,
$id
);
}
}
echo
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment