mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 22:40:55 +01:00
27 lines
571 B
PHP
27 lines
571 B
PHP
|
<?php
|
||
|
|
||
|
$table = new PhabricatorUser();
|
||
|
$conn_w = $table->establishConnection('w');
|
||
|
|
||
|
echo "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 "User {$id} is already trim.\n";
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
echo "Trimming user {$id} from '{$real}' to '{$trim}'.\n";
|
||
|
qsprintf(
|
||
|
$conn_w,
|
||
|
'UPDATE %T SET realName = %s WHERE id = %d',
|
||
|
$table->getTableName(),
|
||
|
$real,
|
||
|
$id);
|
||
|
}
|
||
|
|
||
|
echo "Done.\n";
|