MediaWiki  REL1_20
checkUsernames.php
Go to the documentation of this file.
00001 <?php
00025 require_once( __DIR__ . '/Maintenance.php' );
00026 
00035 class CheckUsernames extends Maintenance {
00036 
00037         public function __construct() {
00038                 parent::__construct();
00039                 $this->mDescription = "Verify that database usernames are actually valid";
00040         }
00041 
00042         function execute() {
00043                 $dbr = wfGetDB( DB_SLAVE );
00044 
00045                 $res = $dbr->select( 'user',
00046                         array( 'user_id', 'user_name' ),
00047                         null,
00048                         __METHOD__
00049                 );
00050 
00051                 foreach ( $res as $row ) {
00052                         if ( ! User::isValidUserName( $row->user_name ) ) {
00053                                 $this->error( sprintf( "%s: %6d: '%s'\n", wfWikiID(), $row->user_id, $row->user_name ) );
00054                                 wfDebugLog( 'checkUsernames', $row->user_name );
00055                         }
00056                 }
00057         }
00058 }
00059 
00060 $maintClass = "CheckUsernames";
00061 require_once( RUN_MAINTENANCE_IF_MAIN );