53 'table' =>
'revision_actor_temp',
54 'pk' =>
'revactor_rev',
55 'field' =>
'revactor_actor',
58 'revactor_timestamp' =>
'rev_timestamp',
59 'revactor_page' =>
'rev_page',
77 'ipb_by' => [
'ipb_by_text',
'ipb_by_actor' ],
89 throw new InvalidArgumentException(
'$stage must include a write mode' );
92 throw new InvalidArgumentException(
'$stage must include a read mode' );
95 throw new InvalidArgumentException(
'Cannot read both schemas' );
98 throw new InvalidArgumentException(
'Cannot read the old schema without also writing it' );
101 throw new InvalidArgumentException(
'Cannot read the new schema without also writing it' );
112 return MediaWikiServices::getInstance()->getActorMigration();
139 if ( isset( self::$specialFields[$key] ) ) {
140 return self::$specialFields[$key];
143 return [ $key .
'_text', substr( $key, 0, -5 ) .
'_actor' ];
158 if ( !isset( $this->joinCache[$key] ) ) {
163 list( $text, $actor ) = self::getFieldNames( $key );
166 $fields[$key] = $key;
167 $fields[$text] = $text;
168 $fields[$actor] =
'NULL';
170 if ( isset( self::$tempTables[$key] ) ) {
171 $t = self::$tempTables[$key];
172 $alias =
"temp_$key";
174 $joins[$alias] = [
'JOIN',
"{$alias}.{$t['pk']} = {$t['joinPK']}" ];
175 $joinField =
"{$alias}.{$t['field']}";
180 $alias =
"actor_$key";
182 $joins[$alias] = [
'JOIN',
"{$alias}.actor_id = {$joinField}" ];
184 $fields[$key] =
"{$alias}.actor_user";
185 $fields[$text] =
"{$alias}.actor_name";
186 $fields[$actor] = $joinField;
189 $this->joinCache[$key] = [
196 return $this->joinCache[$key];
209 if ( isset( self::$tempTables[$key] ) ) {
210 throw new InvalidArgumentException(
"Must use getInsertValuesWithTempTable() for $key" );
213 list( $text, $actor ) = self::getFieldNames( $key );
224 $ret[$actor] =
$user->getActorId( $dbw );
242 if ( isset( self::$formerTempTables[$key] ) ) {
243 wfDeprecated( __METHOD__ .
" for $key", self::$formerTempTables[$key] );
244 } elseif ( !isset( self::$tempTables[$key] ) ) {
245 throw new InvalidArgumentException(
"Must use getInsertValues() for $key" );
248 list( $text, $actor ) = self::getFieldNames( $key );
260 $id =
$user->getActorId( $dbw );
262 if ( isset( self::$tempTables[$key] ) ) {
264 $callback =
function ( $pk,
array $extra )
use ( $dbw, $key, $id, $func ) {
265 $t = self::$tempTables[$key];
266 $set = [
$t[
'field'] => $id ];
267 foreach (
$t[
'extra']
as $to => $from ) {
268 if ( !array_key_exists( $from, $extra ) ) {
269 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
271 $set[$to] = $extra[$from];
275 [
$t[
'pk'] => $pk ] + $set,
283 $callback =
function ( $pk,
array $extra ) {
286 } elseif ( isset( self::$tempTables[$key] ) ) {
288 $callback =
function ( $pk,
array $extra )
use ( $key, $func ) {
289 $t = self::$tempTables[$key];
290 foreach (
$t[
'extra']
as $to => $from ) {
291 if ( !array_key_exists( $from, $extra ) ) {
292 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
297 $callback =
function ( $pk,
array $extra ) {
300 return [
$ret, $callback ];
338 if ( $useId &&
$user->getId() ) {
339 $ids[] =
$user->getId();
341 $names[] =
$user->getName();
343 $actorId =
$user->getActorId();
345 $actors[] = $actorId;
349 list( $text, $actor ) = self::getFieldNames( $key );
354 if ( isset( self::$tempTables[$key] ) ) {
355 $t = self::$tempTables[$key];
356 $alias =
"temp_$key";
358 $joins[$alias] = [
'JOIN',
"{$alias}.{$t['pk']} = {$t['joinPK']}" ];
359 $joinField =
"{$alias}.{$t['field']}";
363 $conds[
'actor'] = $db->
makeList( [ $joinField => $actors ], IDatabase::LIST_AND );
367 $conds[
'userid'] = $db->
makeList( [ $key => $ids ], IDatabase::LIST_AND );
370 $conds[
'username'] = $db->
makeList( [ $text => $names ], IDatabase::LIST_AND );
376 'conds' => $conds ? $db->
makeList( array_values( $conds ), IDatabase::LIST_OR ) :
'1=0',
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
This class handles the logic for the actor table migration.
const MIGRATION_STAGE_SCHEMA_COMPAT
Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage expects MIGRATION_*...
static array $formerTempTables
Fields that formerly used $tempTables Key is '$key', value is the MediaWiki version in which it was r...
isAnon( $field)
Return an SQL condition to test if a user field is anonymous.
getInsertValues(IDatabase $dbw, $key, UserIdentity $user)
Get UPDATE fields for the actor.
static array $tempTables
Define fields that use temporary tables for transitional purposes Keys are '$key',...
static array $specialFields
Define fields that use non-standard mapping Keys are the user id column name, values are arrays with ...
static newMigration()
Static constructor.
array null $joinCache
Cache for self::getJoin()
getInsertValuesWithTempTable(IDatabase $dbw, $key, UserIdentity $user)
Get UPDATE fields for the actor.
int $stage
Combination of SCHEMA_COMPAT_* constants.
isNotAnon( $field)
Return an SQL condition to test if a user field is non-anonymous.
getWhere(IDatabase $db, $key, $users, $useId=true)
Get WHERE condition for the actor.
getJoin( $key)
Get SELECT fields and joins for the actor key.
static getFieldNames( $key)
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromAnyId( $userId, $userName, $actorId)
Static factory method for creation from an ID, name, and/or actor ID.
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
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
const SCHEMA_COMPAT_WRITE_BOTH
const SCHEMA_COMPAT_READ_NEW
const SCHEMA_COMPAT_READ_BOTH
const SCHEMA_COMPAT_WRITE_OLD
const SCHEMA_COMPAT_READ_OLD
const SCHEMA_COMPAT_WRITE_NEW
this hook is for auditing only 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
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
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 local account $user
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))