2013-07-11 19:10:06 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$table = new PhabricatorUser();
|
|
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Trimming trailing whitespace from user real names...')."\n";
|
2013-07-11 19:10:06 +02:00
|
|
|
foreach (new LiskMigrationIterator($table) as $user) {
|
|
|
|
$id = $user->getID();
|
|
|
|
$real = $user->getRealName();
|
|
|
|
$trim = rtrim($real);
|
|
|
|
|
|
|
|
if ($trim == $real) {
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('User %d is already trim.', $id)."\n";
|
2013-07-11 19:10:06 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht("Trimming user %d from '%s' to '%s'.", $id, $real, $trim)."\n";
|
2013-07-11 19:10:06 +02:00
|
|
|
qsprintf(
|
|
|
|
$conn_w,
|
|
|
|
'UPDATE %T SET realName = %s WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
$real,
|
|
|
|
$id);
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|