mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Trim trailing whitespace from user realnames
Summary: Fixes T3069. Ref T3516. For a long time, LDAP import added trailing whitespace to real names when importing them (for example, `"John Smith"` would be imported as `"John Smith "`). We no longer do this, but should clean up the database since it seems highly unlikely that any user wants trailing whitespace in their real name. Test Plan: $ ./bin/storage upgrade -f --apply phabricator:20130711.trimrealnames.php Applying patch 'phabricator:20130711.trimrealnames.php'... Trimming trailing whitespace from user real names... Trimming user 1 from 'Evan Priestley ' to 'Evan Priestley'. User 4 is already trim. User 5 is already trim. User 6 is already trim. User 7 is already trim. User 8 is already trim. User 9 is already trim. User 10 is already trim. User 11 is already trim. User 12 is already trim. User 13 is already trim. User 14 is already trim. User 15 is already trim. User 21 is already trim. User 22 is already trim. User 26 is already trim. User 28 is already trim. User 29 is already trim. User 32 is already trim. User 33 is already trim. User 35 is already trim. User 39 is already trim. User 51 is already trim. User 53 is already trim. User 54 is already trim. User 55 is already trim. Done. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3069, T3516 Differential Revision: https://secure.phabricator.com/D6426
This commit is contained in:
parent
cff8c50903
commit
237ca095a6
4 changed files with 31 additions and 3 deletions
26
resources/sql/patches/20130711.trimrealnames.php
Normal file
26
resources/sql/patches/20130711.trimrealnames.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?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";
|
|
@ -2235,7 +2235,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-pholio-mock-view' =>
|
||||
array(
|
||||
'uri' => '/res/983e2e81/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
|
||||
'uri' => '/res/014eb2bd/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
|
|
@ -1253,7 +1253,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMetaMTAReceivedMailProcessingException' => 'applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php',
|
||||
'PhabricatorMetaMTAReceivedMailTestCase' => 'applications/metamta/storage/__tests__/PhabricatorMetaMTAReceivedMailTestCase.php',
|
||||
'PhabricatorMetaMTASendGridReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php',
|
||||
'PhabricatorMetaMTAViewController' => 'applications/metamta/controller/PhabricatorMetaMTAViewController.php',
|
||||
'PhabricatorMetaMTAWorker' => 'applications/metamta/PhabricatorMetaMTAWorker.php',
|
||||
'PhabricatorMultiColumnExample' => 'applications/uiexample/examples/PhabricatorMultiColumnExample.php',
|
||||
'PhabricatorMustVerifyEmailController' => 'applications/auth/controller/PhabricatorMustVerifyEmailController.php',
|
||||
|
@ -3201,7 +3200,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMetaMTAReceivedMailProcessingException' => 'Exception',
|
||||
'PhabricatorMetaMTAReceivedMailTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController',
|
||||
'PhabricatorMetaMTAViewController' => 'PhabricatorMetaMTAController',
|
||||
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
|
||||
'PhabricatorMultiColumnExample' => 'PhabricatorUIExample',
|
||||
'PhabricatorMustVerifyEmailController' => 'PhabricatorAuthController',
|
||||
|
|
|
@ -1438,6 +1438,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
|
|||
'type' => 'sql',
|
||||
'name' => $this->getPatchPath('20130709.droptimeline.sql'),
|
||||
),
|
||||
'20130711.trimrealnames.php' => array(
|
||||
'type' => 'php',
|
||||
'name' => $this->getPatchPath('20130711.trimrealnames.php'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue