@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3$table = new PhabricatorUser();
4$conn_w = $table->establishConnection('w');
5
6echo pht('Trimming trailing whitespace from user real names...')."\n";
7foreach (new LiskMigrationIterator($table) as $user) {
8 $id = $user->getID();
9 $real = $user->getRealName();
10 $trim = rtrim($real);
11
12 if ($trim == $real) {
13 echo pht('User %d is already trim.', $id)."\n";
14 continue;
15 }
16
17 echo pht("Trimming user %d from '%s' to '%s'.", $id, $real, $trim)."\n";
18 qsprintf(
19 $conn_w,
20 'UPDATE %T SET realName = %s WHERE id = %d',
21 $table->getTableName(),
22 $real,
23 $id);
24}
25
26echo pht('Done.')."\n";