MediaWiki  1.23.1
checkUsernames.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/Maintenance.php';
25 
34 class CheckUsernames extends Maintenance {
35 
36  public function __construct() {
37  parent::__construct();
38  $this->mDescription = "Verify that database usernames are actually valid";
39  $this->setBatchSize( 1000 );
40  }
41 
42  function execute() {
43  $dbr = wfGetDB( DB_SLAVE );
44 
45  $maxUserId = 0;
46  do {
47  $res = $dbr->select( 'user',
48  array( 'user_id', 'user_name' ),
49  array( 'user_id > ' . $maxUserId ),
50  __METHOD__,
51  array(
52  'ORDER BY' => 'user_id',
53  'LIMIT' => $this->mBatchSize,
54  )
55  );
56 
57  foreach ( $res as $row ) {
58  if ( ! User::isValidUserName( $row->user_name ) ) {
59  $this->error( sprintf( "%s: %6d: '%s'\n", wfWikiID(), $row->user_id, $row->user_name ) );
60  wfDebugLog( 'checkUsernames', $row->user_name );
61  }
62  }
63  $maxUserId = $row->user_id;
64  } while ( $res->numRows() );
65  }
66 }
67 
68 $maintClass = "CheckUsernames";
69 require_once RUN_MAINTENANCE_IF_MAIN;
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1040
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
User\isValidUserName
static isValidUserName( $name)
Is the input a valid username?
Definition: User.php:569
$dbr
$dbr
Definition: testCompression.php:48
CheckUsernames
Maintenance script to check that database usernames are actually valid.
Definition: checkUsernames.php:34
CheckUsernames\execute
execute()
Do the actual work.
Definition: checkUsernames.php:42
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
wfWikiID
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition: GlobalFunctions.php:3604
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$maintClass
$maintClass
Definition: checkUsernames.php:68
Maintenance\error
error( $err, $die=0)
Throw an error to the user.
Definition: Maintenance.php:333
CheckUsernames\__construct
__construct()
Default constructor.
Definition: checkUsernames.php:36
$res
$res
Definition: database.txt:21
Maintenance\setBatchSize
setBatchSize( $s=0)
Set the batch size.
Definition: Maintenance.php:254