3 * This script verifies that database usernames are actually valid.
4 * An existing usernames can become invalid if User::isValidUserName()
5 * is altered or if we change the $wgMaxNameChars
10 error_reporting(E_ALL ^ E_NOTICE
);
11 require_once 'commandLine.inc';
13 class checkUsernames
{
16 function checkUsernames() {
17 $this->stderr
= fopen( 'php://stderr', 'wt' );
20 $fname = 'checkUsernames::main';
22 $dbr = wfGetDB( DB_SLAVE
);
24 $res = $dbr->select( 'user',
25 array( 'user_id', 'user_name' ),
30 while ( $row = $dbr->fetchObject( $res ) ) {
31 if ( ! User
::isValidUserName( $row->user_name
) ) {
32 $out = sprintf( "%s: %6d: '%s'\n", wfWikiID(), $row->user_id
, $row->user_name
);
33 fwrite( $this->stderr
, $out );
34 wfDebugLog( 'checkUsernames', $out );
40 $cun = new checkUsernames();