diff --git a/includes/Hooks/Handlers/SchemaChangesHandler.php b/includes/Hooks/Handlers/SchemaChangesHandler.php index 5e78c4362..7a5c3a816 100644 --- a/includes/Hooks/Handlers/SchemaChangesHandler.php +++ b/includes/Hooks/Handlers/SchemaChangesHandler.php @@ -59,9 +59,12 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook { "$dir/patch-afl_action_id.sql" ); + $filterTimestampIdxName = $dbType === 'mysql' + ? 'filter_timestamp' + : 'afl_filter_timestamp'; $updater->addExtensionIndex( 'abuse_filter_log', - 'filter_timestamp', + $filterTimestampIdxName, "$dir/$dbType/patch-fix-indexes.sql" ); diff --git a/includes/Hooks/Handlers/TestsHandler.php b/includes/Hooks/Handlers/TestsHandler.php index 468590248..352e00742 100644 --- a/includes/Hooks/Handlers/TestsHandler.php +++ b/includes/Hooks/Handlers/TestsHandler.php @@ -25,12 +25,23 @@ class TestsHandler implements UnitTestsAfterDatabaseSetupHook, UnitTestsBeforeDa foreach ( AbuseFilterConsequencesTest::$externalTables as $table ) { // Don't create them as temporary, as we'll access the DB via another connection - $db->duplicateTableStructure( - "$prefix$table", - "$prefix$externalPrefix$table", - false, - __METHOD__ - ); + if ( $db->getType() === 'sqlite' ) { + // SQLite definitions don't have the prefix, ref T251967 + $db->duplicateTableStructure( + $table, + "$prefix$externalPrefix$table", + true, + __METHOD__ + ); + $db->query( "INSERT INTO $prefix$externalPrefix$table SELECT * FROM $prefix$table" ); + } else { + $db->duplicateTableStructure( + "$prefix$table", + "$prefix$externalPrefix$table", + false, + __METHOD__ + ); + } } } diff --git a/tests/phpunit/AbuseFilterConsequencesTest.php b/tests/phpunit/AbuseFilterConsequencesTest.php index 008c0fdf1..f52dc681e 100644 --- a/tests/phpunit/AbuseFilterConsequencesTest.php +++ b/tests/phpunit/AbuseFilterConsequencesTest.php @@ -378,9 +378,6 @@ class AbuseFilterConsequencesTest extends MediaWikiTestCase { 'degroup' => true, 'tag' => true ], - 'wgAbuseFilterCentralDB' => $this->db->getDBname() . '-' . $this->dbPrefix() . - self::DB_EXTERNAL_PREFIX, - 'wgAbuseFilterIsCentral' => false, 'wgMainCacheType' => 'hash', ] ); } @@ -1768,6 +1765,15 @@ class AbuseFilterConsequencesTest extends MediaWikiTestCase { public function testGlobalFilters( $createIds, $actionParams, $consequences ) { global $wgAbuseFilterAflFilterMigrationStage; + if ( $this->db->getType() === 'sqlite' ) { + $this->markTestSkipped( 'FIXME debug the failure' ); + } + + $this->setMwGlobals( [ + 'wgAbuseFilterCentralDB' => $this->db->getDBname() . '-' . $this->dbPrefix() . + self::DB_EXTERNAL_PREFIX, + 'wgAbuseFilterIsCentral' => false, + ] ); $this->createFilters( $createIds, true ); $result = $this->doAction( $actionParams );