Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102366856
20130711.trimrealnames.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
Wed, Feb 19, 23:36
Size
611 B
Mime Type
text/x-php
Expires
Fri, Feb 21, 23:36 (2 d)
Engine
blob
Format
Raw Data
Handle
24339770
Attached To
rPH Phabricator
20130711.trimrealnames.php
View Options
<?php
$table
=
new
PhabricatorUser
();
$conn_w
=
$table
->
establishConnection
(
'w'
);
echo
pht
(
'Trimming trailing whitespace from user real names...'
).
"
\n
"
;
foreach
(
new
LiskMigrationIterator
(
$table
)
as
$user
)
{
$id
=
$user
->
getID
();
$real
=
$user
->
getRealName
();
$trim
=
rtrim
(
$real
);
if
(
$trim
==
$real
)
{
echo
pht
(
'User %d is already trim.'
,
$id
).
"
\n
"
;
continue
;
}
echo
pht
(
"Trimming user %d from '%s' to '%s'."
,
$id
,
$real
,
$trim
).
"
\n
"
;
qsprintf
(
$conn_w
,
'UPDATE %T SET realName = %s WHERE id = %d'
,
$table
->
getTableName
(),
$real
,
$id
);
}
echo
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment