Probably good to start testing this in CI sometime soon.
The unit tests being changed here are:
* Hacky importing of a revision in MessageCacheTest, changed to use an
interwiki username.
* WikiPageDbTestBase will get null rather than 0 for ar_user.
* DumpTestCase was using a custom IP $wgUser when creating its test
revisions, which was winding up referring to an actor_id that had been
deleted from the database. Fixed by having it use a registered user
instead.
Also this has MediaWikiTestCase reset the $wgUser User object when the
actor table is truncated, as various tests were otherwise failing because
it was caching a later-deleted actor ID for User:127.0.0.1.
Bug: T188327
Change-Id: Ic483d0fda931810ac639b9de1cc5e5a4ef8161cc
Depends-On: I1bd0288cc132627d75b4001219522ec5e952eda7
argon2 to be used, by default, it will automatically choose the best available
algorithm depending on which version of PHP you have available. To use this,
you can set `$wgPasswordDefault = 'argon2';`.
argon2 to be used, by default, it will automatically choose the best available
algorithm depending on which version of PHP you have available. To use this,
you can set `$wgPasswordDefault = 'argon2';`.
+* $wgActorTableSchemaMigrationStage now defaults to reading the new schema.
+ update.php will back-populate the new database fields due to the changed
+ setting, which may take some time on large wikis. You can avoid downtime by
+ following a process like that described in T188327.
==== Removed configuration ====
* $wgTagStatisticsNewTable (T199334) — This temporary setting, added in
==== Removed configuration ====
* $wgTagStatisticsNewTable (T199334) — This temporary setting, added in
* @since 1.32 changed allowed flags
* @var int An appropriate combination of SCHEMA_COMPAT_XXX flags.
*/
* @since 1.32 changed allowed flags
* @var int An appropriate combination of SCHEMA_COMPAT_XXX flags.
*/
-$wgActorTableSchemaMigrationStage = SCHEMA_COMPAT_OLD;
+$wgActorTableSchemaMigrationStage = SCHEMA_COMPAT_WRITE_BOTH | SCHEMA_COMPAT_READ_NEW;
/**
* Flag to enable Partial Blocks. This allows an admin to prevent a user from editing specific pages
/**
* Flag to enable Partial Blocks. This allows an admin to prevent a user from editing specific pages
if ( array_intersect( $tablesUsed, $userTables ) ) {
$tablesUsed = array_unique( array_merge( $tablesUsed, $userTables ) );
TestUserRegistry::clear();
if ( array_intersect( $tablesUsed, $userTables ) ) {
$tablesUsed = array_unique( array_merge( $tablesUsed, $userTables ) );
TestUserRegistry::clear();
+
+ // Reset $wgUser, which is probably 127.0.0.1, as its loaded data is probably not valid
+ // @todo Should we start setting $wgUser to something nondeterministic
+ // to encourage tests to be updated to not depend on it?
+ global $wgUser;
+ $wgUser->clearInstanceCache( $wgUser->mFrom );
}
if ( array_intersect( $tablesUsed, $pageTables ) ) {
$tablesUsed = array_unique( array_merge( $tablesUsed, $pageTables ) );
}
if ( array_intersect( $tablesUsed, $pageTables ) ) {
$tablesUsed = array_unique( array_merge( $tablesUsed, $pageTables ) );
$importRevision->setComment( 'Imported edit' );
$importRevision->setTimestamp( '19991122001122' );
$importRevision->setText( 'IMPORTED OLD TEST' );
$importRevision->setComment( 'Imported edit' );
$importRevision->setTimestamp( '19991122001122' );
$importRevision->setText( 'IMPORTED OLD TEST' );
- $importRevision->setUsername( 'Alan Smithee' );
+ $importRevision->setUsername( 'ext>Alan Smithee' );
$importer = MediaWikiServices::getInstance()->getWikiRevisionOldRevisionImporterNoUpdates();
$importer->import( $importRevision );
$importer = MediaWikiServices::getInstance()->getWikiRevisionOldRevisionImporterNoUpdates();
$importer->import( $importRevision );
'delete',
'delete',
'testing user 0 deletion',
'delete',
'delete',
'testing user 0 deletion',
'127.0.0.1',
(string)$page->getTitle()->getNamespace(),
$page->getTitle()->getDBkey(),
'127.0.0.1',
(string)$page->getTitle()->getNamespace(),
$page->getTitle()->getDBkey(),
$this->assertNodeStart( "contributor" );
$this->skipWhitespace();
$this->assertNodeStart( "contributor" );
$this->skipWhitespace();
- $this->assertTextNode( "ip", false );
+ $this->assertTextNode( "username", false );
+ $this->assertTextNode( "id", false );
$this->assertNodeEnd( "contributor" );
$this->skipWhitespace();
$this->assertNodeEnd( "contributor" );
$this->skipWhitespace();
) {
$status = $page->doEditContent(
ContentHandler::makeContent( $text, $page->getTitle(), $model ),
) {
$status = $page->doEditContent(
ContentHandler::makeContent( $text, $page->getTitle(), $model ),
+ $summary, 0, false, $this->getTestUser()->getUser()
);
if ( $status->isGood() ) {
);
if ( $status->isGood() ) {
$content = $header;
$iterations = intval( $iterations );
$content = $header;
$iterations = intval( $iterations );
+ $username = $this->getTestUser()->getUser()->getName();
+ $userid = $this->getTestUser()->getUser()->getId();
for ( $i = 0; $i < $iterations; $i++ ) {
$page1 = ' <page>
<title>BackupDumperTestP1</title>
for ( $i = 0; $i < $iterations; $i++ ) {
$page1 = ' <page>
<title>BackupDumperTestP1</title>
<id>' . ( $this->revId1_1 + $i * self::$numOfRevs ) . '</id>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
<id>' . ( $this->revId1_1 + $i * self::$numOfRevs ) . '</id>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
+ <username>' . $username . '</username>
+ <id>' . $userid . '</id>
</contributor>
<comment>BackupDumperTestP1Summary1</comment>
<model>wikitext</model>
</contributor>
<comment>BackupDumperTestP1Summary1</comment>
<model>wikitext</model>
<id>' . ( $this->revId2_1 + $i * self::$numOfRevs ) . '</id>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
<id>' . ( $this->revId2_1 + $i * self::$numOfRevs ) . '</id>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
+ <username>' . $username . '</username>
+ <id>' . $userid . '</id>
</contributor>
<comment>BackupDumperTestP2Summary1</comment>
<model>wikitext</model>
</contributor>
<comment>BackupDumperTestP2Summary1</comment>
<model>wikitext</model>
<parentid>' . ( $this->revId2_1 + $i * self::$numOfRevs ) . '</parentid>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
<parentid>' . ( $this->revId2_1 + $i * self::$numOfRevs ) . '</parentid>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
+ <username>' . $username . '</username>
+ <id>' . $userid . '</id>
</contributor>
<comment>BackupDumperTestP2Summary2</comment>
<model>wikitext</model>
</contributor>
<comment>BackupDumperTestP2Summary2</comment>
<model>wikitext</model>
<parentid>' . ( $this->revId2_2 + $i * self::$numOfRevs ) . '</parentid>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
<parentid>' . ( $this->revId2_2 + $i * self::$numOfRevs ) . '</parentid>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
+ <username>' . $username . '</username>
+ <id>' . $userid . '</id>
</contributor>
<comment>BackupDumperTestP2Summary3</comment>
<model>wikitext</model>
</contributor>
<comment>BackupDumperTestP2Summary3</comment>
<model>wikitext</model>
<parentid>' . ( $this->revId2_3 + $i * self::$numOfRevs ) . '</parentid>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
<parentid>' . ( $this->revId2_3 + $i * self::$numOfRevs ) . '</parentid>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
+ <username>' . $username . '</username>
+ <id>' . $userid . '</id>
</contributor>
<comment>BackupDumperTestP2Summary4 extra</comment>
<model>wikitext</model>
</contributor>
<comment>BackupDumperTestP2Summary4 extra</comment>
<model>wikitext</model>
<id>' . ( $this->revId4_1 + $i * self::$numOfRevs ) . '</id>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
<id>' . ( $this->revId4_1 + $i * self::$numOfRevs ) . '</id>
<timestamp>2012-04-01T16:46:05Z</timestamp>
<contributor>
+ <username>' . $username . '</username>
+ <id>' . $userid . '</id>
</contributor>
<comment>Talk BackupDumperTestP1 Summary1</comment>
<model>BackupTextPassTestModel</model>
</contributor>
<comment>Talk BackupDumperTestP1 Summary1</comment>
<model>BackupTextPassTestModel</model>