Go to the documentation of this file.
43 $this->db = $database;
51 private function out( $str ) {
52 call_user_func( $this->outputCallback, $str );
61 $info = $this->db->indexInfo(
'user',
'user_name', __METHOD__ );
63 $this->
out(
"WARNING: doesn't seem to have user_name index at all!\n" );
67 # Confusingly, 'Non_unique' is 0 for *unique* indexes,
68 # and 1 for *non-unique* indexes. Pass the crack, MySQL,
69 # it's obviously some good stuff!
70 return ( $info[0]->Non_unique == 0 );
104 echo
wfWikiID() .
" already has a unique index on its user table.\n";
110 $this->
out(
"Checking for duplicate accounts...\n" );
114 $this->
out(
"Found $count accounts with duplicate records on " .
wfWikiID() .
".\n" );
116 $this->reassigned = 0;
119 $this->
examine( $name, $doDelete );
126 if ( $this->reassigned > 0 ) {
128 $this->
out(
"$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n" );
130 $this->
out(
"$this->reassigned duplicate accounts need to have edits reassigned.\n" );
134 if ( $this->trimmed > 0 ) {
136 $this->
out(
"$this->trimmed duplicate user records were deleted from " .
wfWikiID() .
".\n" );
138 $this->
out(
"$this->trimmed duplicate user accounts were found on " .
wfWikiID() .
" which can be removed safely.\n" );
142 if ( $this->failed > 0 ) {
143 $this->
out(
"Something terribly awry; $this->failed duplicate accounts were not removed.\n" );
147 if ( $this->trimmed == 0 || $doDelete ) {
148 $this->
out(
"It is now safe to apply the unique index on user_name.\n" );
151 $this->
out(
"Run this script again with the --fix option to automatically delete them.\n" );
161 $set =
array(
'user',
'revision' );
162 $names = array_map(
array( $this,
'lockTable' ), $set );
163 $tables = implode(
',', $names );
165 $this->db->query(
"LOCK TABLES $tables", __METHOD__ );
169 return $this->db->tableName( $table ) .
' WRITE';
176 $this->db->query(
"UNLOCK TABLES", __METHOD__ );
185 $user = $this->db->tableName(
'user' );
187 "SELECT user_name,COUNT(*) AS n
190 HAVING n > 1", __METHOD__ );
194 $list[] = $row->user_name;
208 $result = $this->db->select(
'user',
213 $firstRow = $this->db->fetchObject(
$result );
214 $firstId = $firstRow->user_id;
215 $this->
out(
"Record that will be used for '$name' is user_id=$firstId\n" );
218 $dupeId = $row->user_id;
219 $this->
out(
"... dupe id $dupeId: " );
223 $this->
out(
"has $edits edits! " );
227 if ( $newEdits == 0 ) {
228 $this->
out(
"confirmed cleaned. " );
231 $this->
out(
"WARNING! $newEdits remaining edits for $dupeId; NOT deleting user.\n" );
235 $this->
out(
"(will need to reassign edits on fix)" );
238 $this->
out(
"ok, no edits. " );
257 return intval( $this->db->selectField(
260 array(
'rev_user' => $userid ),
270 $this->
out(
'reassigning... ' );
271 $this->db->update(
'revision',
272 array(
'rev_user' => $to ),
275 $this->
out(
"ok. " );
284 $this->
out(
"deleting..." );
285 $this->db->delete(
'user',
array(
'user_id' => $userid ), __METHOD__ );
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
lock()
We don't want anybody to mess with our stuff...
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
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
clearDupes()
Checks the database for duplicate user account records and remove them in preparation for application...
editCount( $userid)
Count the number of edits attributed to this user.
checkDupes( $doDelete=false)
Checks the database for duplicate user account records in preparation for application of a unique ind...
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
examine( $name, $doDelete)
Examine user records for the given name.
hasUniqueIndex()
Check if this database's user table has already had a unique user_name index applied.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
trimAccount( $userid)
Remove a user account line.
Allows to change the fields on the form that will be generated $name
getDupes()
Grab usernames for which multiple records are present in the database.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
out( $str)
Output some text via the output callback provided.
Look for duplicate user table entries and optionally prune them.
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
reassignEdits( $from, $to)
__construct(&$database, $outputCallback)