Go to the documentation of this file.
47 'table' =>
'revision_actor_temp',
48 'pk' =>
'revactor_rev',
49 'field' =>
'revactor_actor',
52 'revactor_timestamp' =>
'rev_timestamp',
53 'revactor_page' =>
'rev_page',
71 'ipb_by' => [
'ipb_by_text',
'ipb_by_actor' ],
90 return MediaWikiServices::getInstance()->getActorMigration();
99 return $this->stage ===
MIGRATION_NEW ?
"$field IS NULL" :
"$field = 0";
108 return $this->stage ===
MIGRATION_NEW ?
"$field IS NOT NULL" :
"$field != 0";
117 if ( isset( self::$specialFields[$key] ) ) {
118 return self::$specialFields[$key];
121 return [ $key .
'_text', substr( $key, 0, -5 ) .
'_actor' ];
136 if ( !isset( $this->joinCache[$key] ) ) {
144 $fields[$key] = $key;
145 $fields[$text] = $text;
146 $fields[$actor] =
'NULL';
148 $join = $this->stage ===
MIGRATION_NEW ?
'JOIN' :
'LEFT JOIN';
150 if ( isset( self::$tempTables[$key] ) ) {
151 $t = self::$tempTables[$key];
152 $alias =
"temp_$key";
154 $joins[$alias] = [ $join,
"{$alias}.{$t['pk']} = {$t['joinPK']}" ];
155 $joinField =
"{$alias}.{$t['field']}";
160 $alias =
"actor_$key";
162 $joins[$alias] = [ $join,
"{$alias}.actor_id = {$joinField}" ];
165 $fields[$key] =
"{$alias}.actor_user";
166 $fields[$text] =
"{$alias}.actor_name";
168 $fields[$key] =
"COALESCE( {$alias}.actor_user, $key )";
169 $fields[$text] =
"COALESCE( {$alias}.actor_name, $text )";
171 $fields[$actor] = $joinField;
174 $this->joinCache[$key] = [
181 return $this->joinCache[$key];
194 if ( isset( self::$tempTables[$key] ) ) {
195 throw new InvalidArgumentException(
"Must use getInsertValuesWithTempTable() for $key" );
209 $ret[$actor] =
$user->getActorId( $dbw );
227 if ( isset( self::$formerTempTables[$key] ) ) {
228 wfDeprecated( __METHOD__ .
" for $key", self::$formerTempTables[$key] );
229 } elseif ( !isset( self::$tempTables[$key] ) ) {
230 throw new InvalidArgumentException(
"Must use getInsertValues() for $key" );
245 $id =
$user->getActorId( $dbw );
247 if ( isset( self::$tempTables[$key] ) ) {
249 $callback =
function ( $pk,
array $extra )
use ( $dbw, $key, $id, $func ) {
250 $t = self::$tempTables[$key];
251 $set = [
$t[
'field'] => $id ];
252 foreach (
$t[
'extra']
as $to => $from ) {
253 if ( !array_key_exists( $from, $extra ) ) {
254 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
256 $set[$to] = $extra[$from];
260 [
$t[
'pk'] => $pk ] + $set,
268 $callback =
function ( $pk,
array $extra ) {
271 } elseif ( isset( self::$tempTables[$key] ) ) {
273 $callback =
function ( $pk,
array $extra )
use ( $key, $func ) {
274 $t = self::$tempTables[$key];
275 foreach (
$t[
'extra']
as $to => $from ) {
276 if ( !array_key_exists( $from, $extra ) ) {
277 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
282 $callback =
function ( $pk,
array $extra ) {
285 return [
$ret, $callback ];
321 if ( $useId &&
$user->getId() ) {
322 $ids[] =
$user->getId();
324 $names[] =
$user->getName();
326 $actorId =
$user->getActorId();
328 $actors[] = $actorId;
339 } elseif ( isset( self::$tempTables[$key] ) ) {
340 $t = self::$tempTables[$key];
341 $alias =
"temp_$key";
345 "{$alias}.{$t['pk']} = {$t['joinPK']}"
347 $joinField =
"{$alias}.{$t['field']}";
348 $actorEmpty = [ $joinField => null ];
352 $actorNotEmpty = [
"$joinField IS NOT NULL" ];
356 $actorEmpty = [ $joinField => 0 ];
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
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
const MIGRATION_WRITE_BOTH
static newFromAnyId( $userId, $userName, $actorId)
Static factory method for creation from an ID, name, and/or actor ID.
This class handles the logic for the actor table migration.
static newMigration()
Static constructor.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
isAnon( $field)
Return an SQL condition to test if a user field is anonymous.
array null $joinCache
Cache for self::getJoin()
static getFieldNames( $key)
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
int $stage
One of the MIGRATION_* constants.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
isNotAnon( $field)
Return an SQL condition to test if a user field is non-anonymous.
static array $specialFields
Define fields that use non-standard mapping Keys are the user id column name, values are arrays with ...
getWhere(IDatabase $db, $key, $users, $useId=true)
Get WHERE condition for the actor.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
getJoin( $key)
Get SELECT fields and joins for the actor key.
getInsertValuesWithTempTable(IDatabase $dbw, $key, UserIdentity $user)
Get UPDATE fields for the actor.
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
static array $tempTables
Define fields that use temporary tables for transitional purposes Keys are '$key',...
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getInsertValues(IDatabase $dbw, $key, UserIdentity $user)
Get UPDATE fields for the actor.
the array() calling protocol came about after MediaWiki 1.4rc1.
static array $formerTempTables
Fields that formerly used $tempTables Key is '$key', value is the MediaWiki version in which it was r...