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