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 return self::$specialFields[$key] ?? [ $key .
'_text',
substr( $key, 0, -5 ) .
'_actor' ];
154 if ( !
isset( $this->joinCache[$key] ) ) {
159 list( $text, $actor ) = self::getFieldNames( $key );
162 $fields[$key] = $key;
163 $fields[$text] = $text;
164 $fields[$actor] =
'NULL';
166 if (
isset( self::$tempTables[$key] ) ) {
167 $t = self::$tempTables[$key];
168 $alias =
"temp_$key";
170 $joins[$alias] = [
'JOIN',
"{$alias}.{$t['pk']} = {$t['joinPK']}" ];
171 $joinField =
"{$alias}.{$t['field']}";
176 $alias =
"actor_$key";
178 $joins[$alias] = [
'JOIN',
"{$alias}.actor_id = {$joinField}" ];
180 $fields[$key] =
"{$alias}.actor_user";
181 $fields[$text] =
"{$alias}.actor_name";
185 $this->joinCache[$key] = [
192 return $this->joinCache[$key];
205 if (
isset( self::$tempTables[$key] ) ) {
206 throw new InvalidArgumentException(
"Must use getInsertValuesWithTempTable() for $key" );
209 list( $text, $actor ) = self::getFieldNames( $key );
212 $ret[$key] = $user->getId();
213 $ret[$text] = $user->getName();
220 $ret[$actor] = $user->getActorId( $dbw );
238 if (
isset( self::$formerTempTables[$key] ) ) {
239 wfDeprecated( __METHOD__ .
" for $key", self::$formerTempTables[$key] );
241 throw new InvalidArgumentException(
"Must use getInsertValues() for $key" );
244 list( $text, $actor ) = self::getFieldNames( $key );
248 $ret[$key] = $user->getId();
249 $ret[$text] = $user->getName();
256 $id = $user->getActorId( $dbw );
258 if (
isset( self::$tempTables[$key] ) ) {
260 $callback =
function (
$pk,
array $extra ) use ( $dbw, $key, $id, $func ) {
261 $t = self::$tempTables[$key];
262 $set = [
$t[
'field'] => $id ];
263 foreach (
$t[
'extra'] as $to => $from ) {
265 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
267 $set[$to] = $extra[$from];
271 [
$t[
'pk'] => $pk ] + $set,
279 $callback =
function (
$pk,
array $extra ) {
284 $callback =
function (
$pk,
array $extra ) use ( $key, $func ) {
285 $t = self::$tempTables[$key];
286 foreach (
$t[
'extra'] as $to => $from ) {
288 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
293 $callback =
function (
$pk,
array $extra ) {
296 return [
$ret, $callback ];
333 foreach ( $users as $user ) {
334 if ( $useId && $user->getId() ) {
335 $ids[] = $user->getId();
337 $names[] = $user->getName();
339 $actorId = $user->getActorId();
345 list( $text, $actor ) = self::getFieldNames( $key );
350 if (
isset( self::$tempTables[$key] ) ) {
351 $t = self::$tempTables[$key];
352 $alias =
"temp_$key";
354 $joins[$alias] = [
'JOIN',
"{$alias}.{$t['pk']} = {$t['joinPK']}" ];
355 $joinField =
"{$alias}.{$t['field']}";
359 $conds[
'actor'] = $db->
makeList( [ $joinField => $actors ], IDatabase::LIST_AND );
363 $conds[
'userid'] = $db->
makeList( [ $key => $ids ], IDatabase::LIST_AND );
366 $conds[
'username'] = $db->
makeList( [ $text => $names ], IDatabase::LIST_AND );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
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.
getActorId(IDatabase $dbw=null)
Get the user's 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 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
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
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))