56 'table' =>
'revision_actor_temp',
57 'pk' =>
'revactor_rev',
58 'field' =>
'revactor_actor',
61 'revactor_timestamp' =>
'rev_timestamp',
62 'revactor_page' =>
'rev_page',
102 'ipb_by' => [
'ipb_by_text',
'ipb_by_actor' ],
114 throw new InvalidArgumentException(
'$stage must include a write mode' );
117 throw new InvalidArgumentException(
'$stage must include a read mode' );
120 throw new InvalidArgumentException(
'Cannot read both schemas' );
123 throw new InvalidArgumentException(
'Cannot read the old schema without also writing it' );
126 throw new InvalidArgumentException(
'Cannot read the new schema without also writing it' );
137 return MediaWikiServices::getInstance()->getActorMigration();
145 if ( isset( self::$removed[$key] ) ) {
146 throw new InvalidArgumentException(
147 "Use of " . static::class .
" for '$key' was removed in MediaWiki " . self::$removed[$key]
150 if ( !empty( self::$deprecated[$key] ) ) {
151 wfDeprecated( static::class .
" for '$key'", self::$deprecated[$key],
false, 3 );
179 return self::$specialFields[$key] ?? [ $key .
'_text', substr( $key, 0, -5 ) .
'_actor' ];
197 if ( !isset( $this->joinCache[$key] ) ) {
205 $fields[$key] = $key;
206 $fields[$text] = $text;
207 $fields[$actor] =
'NULL';
209 if ( isset( self::$tempTables[$key] ) ) {
210 $t = self::$tempTables[$key];
211 $alias =
"temp_$key";
212 $tables[$alias] =
$t[
'table'];
213 $joins[$alias] = [
'JOIN',
"{$alias}.{$t['pk']} = {$t['joinPK']}" ];
214 $joinField =
"{$alias}.{$t['field']}";
219 $alias =
"actor_$key";
220 $tables[$alias] =
'actor';
221 $joins[$alias] = [
'JOIN',
"{$alias}.actor_id = {$joinField}" ];
223 $fields[$key] =
"{$alias}.actor_user";
224 $fields[$text] =
"{$alias}.actor_name";
225 $fields[$actor] = $joinField;
228 $this->joinCache[$key] = [
235 return $this->joinCache[$key];
250 if ( isset( self::$tempTables[$key] ) ) {
251 throw new InvalidArgumentException(
"Must use getInsertValuesWithTempTable() for $key" );
257 $ret[$key] = $user->
getId();
258 $ret[$text] = $user->
getName();
285 if ( isset( self::$formerTempTables[$key] ) ) {
286 wfDeprecated( __METHOD__ .
" for $key", self::$formerTempTables[$key] );
287 } elseif ( !isset( self::$tempTables[$key] ) ) {
288 throw new InvalidArgumentException(
"Must use getInsertValues() for $key" );
295 $ret[$key] = $user->
getId();
296 $ret[$text] = $user->
getName();
305 if ( isset( self::$tempTables[$key] ) ) {
307 $callback =
function ( $pk, array $extra ) use ( $dbw, $key, $id, $func ) {
308 $t = self::$tempTables[$key];
309 $set = [
$t[
'field'] => $id ];
310 foreach (
$t[
'extra'] as $to => $from ) {
311 if ( !array_key_exists( $from, $extra ) ) {
312 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
314 $set[$to] = $extra[$from];
318 [
$t[
'pk'] => $pk ] + $set,
326 $callback =
function ( $pk, array $extra ) {
329 } elseif ( isset( self::$tempTables[$key] ) ) {
331 $callback =
function ( $pk, array $extra ) use ( $key, $func ) {
332 $t = self::$tempTables[$key];
333 foreach (
$t[
'extra'] as $to => $from ) {
334 if ( !array_key_exists( $from, $extra ) ) {
335 throw new InvalidArgumentException(
"$func callback: \$extra[$from] is not provided" );
340 $callback =
function ( $pk, array $extra ) {
343 return [ $ret, $callback ];
382 foreach ( $users as $user ) {
383 if ( $useId && $user->getId() ) {
384 $ids[] = $user->getId();
386 $names[] = $user->getName();
388 $actorId = $user->getActorId();
390 $actors[] = $actorId;
399 if ( isset( self::$tempTables[$key] ) ) {
400 $t = self::$tempTables[$key];
401 $alias =
"temp_$key";
402 $tables[$alias] =
$t[
'table'];
403 $joins[$alias] = [
'JOIN',
"{$alias}.{$t['pk']} = {$t['joinPK']}" ];
404 $joinField =
"{$alias}.{$t['field']}";