diff --git a/autoload.php b/autoload.php index ed3fdc5be37..58101a0adb7 100644 --- a/autoload.php +++ b/autoload.php @@ -506,7 +506,6 @@ $wgAutoloadLocalClasses = [ 'FindOrphanedFiles' => __DIR__ . '/maintenance/findOrphanedFiles.php', 'FixDefaultJsonContentPages' => __DIR__ . '/maintenance/fixDefaultJsonContentPages.php', 'FixDoubleRedirects' => __DIR__ . '/maintenance/fixDoubleRedirects.php', - 'FixExtLinksProtocolRelative' => __DIR__ . '/maintenance/fixExtLinksProtocolRelative.php', 'FixLegacyEncoding' => __DIR__ . '/maintenance/storage/fixLegacyEncoding.php', 'FixMergeHistoryCorruption' => __DIR__ . '/maintenance/fixMergeHistoryCorruption.php', 'FixTimestamps' => __DIR__ . '/maintenance/fixTimestamps.php', @@ -2397,7 +2396,6 @@ $wgAutoloadLocalClasses = [ 'RedisConnectionPool' => __DIR__ . '/includes/libs/redis/RedisConnectionPool.php', 'RedisLockManager' => __DIR__ . '/includes/libs/lockmanager/RedisLockManager.php', 'RedisPubSubFeedEngine' => __DIR__ . '/includes/rcfeed/RedisPubSubFeedEngine.php', - 'RefreshExternallinksIndex' => __DIR__ . '/maintenance/refreshExternallinksIndex.php', 'RefreshFileHeaders' => __DIR__ . '/maintenance/refreshFileHeaders.php', 'RefreshImageMetadata' => __DIR__ . '/maintenance/refreshImageMetadata.php', 'RefreshLinks' => __DIR__ . '/maintenance/refreshLinks.php', diff --git a/docs/config-schema.yaml b/docs/config-schema.yaml index c4fa401ce6f..3de52361c11 100755 --- a/docs/config-schema.yaml +++ b/docs/config-schema.yaml @@ -1985,7 +1985,7 @@ config-schema: - 1.39: Default has changed to SCHEMA_COMPAT_WRITE_BOTH | SCHEMA_COMPAT_READ_OLD and support for SCHEMA_COMPAT_OLD is dropped. ExternalLinksSchemaMigrationStage: - default: 769 + default: 768 type: integer description: |- Externallinks table schema migration stage. diff --git a/includes/ExternalLinks/LinkFilter.php b/includes/ExternalLinks/LinkFilter.php index 779e5451799..0782d835a16 100644 --- a/includes/ExternalLinks/LinkFilter.php +++ b/includes/ExternalLinks/LinkFilter.php @@ -42,12 +42,6 @@ use Wikimedia\Rdbms\Platform\ISQLPlatform; * - AbuseFilter extension (Special:BlockedExternalDomains, T337431) */ class LinkFilter { - /** - * Increment this when makeIndexes output changes. It'll cause - * maintenance/refreshExternallinksIndex.php to run from update.php. - */ - public const VERSION = 1; - /** * Check whether $content contains a link to $filterEntry * @@ -96,8 +90,6 @@ class LinkFilter { * @return string */ private static function indexifyHost( $host, $reverse = true ) { - // NOTE: If you change the output of this method, you'll probably have to increment self::VERSION! - // Canonicalize. $host = rawurldecode( $host ); if ( $host !== '' ) { @@ -187,8 +179,6 @@ class LinkFilter { * Each entry is an array in form of */ public static function makeIndexes( $url, $reverseDomain = true ) { - // NOTE: If you change the output of this method, you'll probably have to increment self::VERSION! - // NOTE: refreshExternallinksIndex.php assumes that only protocol-relative URLs return more // than one index, and that the indexes for protocol-relative URLs only vary in the "http://" // versus "https://" prefix. If you change that, you'll likely need to update diff --git a/includes/MainConfigSchema.php b/includes/MainConfigSchema.php index a56567ec30d..85762de55cc 100644 --- a/includes/MainConfigSchema.php +++ b/includes/MainConfigSchema.php @@ -3255,7 +3255,7 @@ class MainConfigSchema { * - 1.40: Added */ public const ExternalLinksSchemaMigrationStage = [ - 'default' => SCHEMA_COMPAT_READ_NEW | SCHEMA_COMPAT_WRITE_BOTH, + 'default' => SCHEMA_COMPAT_READ_NEW | SCHEMA_COMPAT_WRITE_NEW, 'type' => 'integer', ]; diff --git a/includes/config-schema.php b/includes/config-schema.php index 7081074f44f..9d8a76f98a4 100755 --- a/includes/config-schema.php +++ b/includes/config-schema.php @@ -385,7 +385,7 @@ return [ 'DatabaseReplicaLagCritical' => 30, 'MaxExecutionTimeForExpensiveQueries' => 0, 'TemplateLinksSchemaMigrationStage' => 768, - 'ExternalLinksSchemaMigrationStage' => 769, + 'ExternalLinksSchemaMigrationStage' => 768, 'ContentHandlers' => [ 'wikitext' => [ 'class' => 'WikitextContentHandler', diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 85cdfd89395..09742c95b4f 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -89,7 +89,6 @@ abstract class DatabaseUpdater { PopulateRevisionLength::class, PopulateRevisionSha1::class, PopulateImageSha1::class, - FixExtLinksProtocolRelative::class, PopulateFilearchiveSha1::class, PopulateBacklinkNamespace::class, FixDefaultJsonContentPages::class, @@ -97,7 +96,6 @@ abstract class DatabaseUpdater { AddRFCandPMIDInterwiki::class, PopulatePPSortKey::class, PopulateIpChanges::class, - RefreshExternallinksIndex::class, ]; /** diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 2bb400156ad..79943ff2368 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -149,6 +149,7 @@ class MysqlUpdater extends DatabaseUpdater { [ 'runMaintenance', MigrateExternallinks::class, 'maintenance/migrateExternallinks.php' ], [ 'modifyField', 'externallinks', 'el_to', 'patch-externallinks-el_to_default.sql' ], [ 'addField', 'pagelinks', 'pl_target_id', 'patch-pagelinks-target_id.sql' ], + [ 'dropField', 'externallinks', 'el_to', 'patch-externallinks-drop-el_to.sql' ], ]; } diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index ac37d49c2d5..62dc5069743 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -201,11 +201,8 @@ class PostgresUpdater extends DatabaseUpdater { [ 'changeField', 'protected_titles', 'pt_reason_id', 'BIGINT', '' ], [ 'dropDefault', 'protected_titles', 'pt_create_perm' ], [ 'dropFkey', 'externallinks', 'el_from' ], - [ 'setDefault', 'externallinks', 'el_from', 0 ], - [ 'changeField', 'externallinks', 'el_index_60', 'TEXT', '' ], [ 'renameIndex', 'externallinks', 'externallinks_from_to', 'el_from' ], [ 'renameIndex', 'externallinks', 'externallinks_index', 'el_index' ], - [ 'addPgIndex', 'externallinks', 'el_to', '(el_to, el_from)' ], [ 'dropSequence', 'ip_changes', 'ip_changes_ipc_rev_id_seq' ], [ 'changeField', 'ip_changes', 'ipc_hex', 'TEXT', "ipc_hex::TEXT DEFAULT ''" ], [ 'setDefault', 'ip_changes', 'ipc_rev_id', 0 ], @@ -454,6 +451,7 @@ class PostgresUpdater extends DatabaseUpdater { [ 'runMaintenance', MigrateExternallinks::class, 'maintenance/migrateExternallinks.php' ], [ 'modifyField', 'externallinks', 'el_to', 'patch-externallinks-el_to_default.sql' ], [ 'addField', 'pagelinks', 'pl_target_id', 'patch-pagelinks-target_id.sql' ], + [ 'dropField', 'externallinks', 'el_to', 'patch-externallinks-drop-el_to.sql' ], ]; } diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index 827f0492abf..e8701ecfdd4 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -131,6 +131,7 @@ class SqliteUpdater extends DatabaseUpdater { [ 'runMaintenance', MigrateExternallinks::class, 'maintenance/migrateExternallinks.php' ], [ 'modifyField', 'externallinks', 'el_to', 'patch-externallinks-el_to_default.sql' ], [ 'addField', 'pagelinks', 'pl_target_id', 'patch-pagelinks-target_id.sql' ], + [ 'dropField', 'externallinks', 'el_to', 'patch-externallinks-drop-el_to.sql' ], ]; } diff --git a/maintenance/abstractSchemaChanges/patch-externallinks-drop-el_to.json b/maintenance/abstractSchemaChanges/patch-externallinks-drop-el_to.json new file mode 100644 index 00000000000..cfbc07e27e4 --- /dev/null +++ b/maintenance/abstractSchemaChanges/patch-externallinks-drop-el_to.json @@ -0,0 +1,93 @@ +{ + "comment": "Drop old columns of externallinks (T312666)", + "before": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to", + "type": "blob", + "comment": "The external link", + "options": { "length": 65530, "notnull": false, "default": "" } + }, + { + "name": "el_index", + "type": "blob", + "comment": "In the case of HTTP URLs, this is the URL with any username or password removed, and with the labels in the hostname reversed and converted to lower case which will allow faster searching for all pages with WHERE clause. Note: If PHP's intl extension is enabled/disabled, maintenance/refreshExternallinksIndex.php needs to be run to refresh this field", + "options": { "length": 65530, "notnull": false, "default": "" } + }, + { + "name": "el_index_60", + "type": "binary", + "comment": "'el_index' truncated to 60 bytes to allow for sortable queries that aren't supported by a partial index", + "options": { "notnull": true, "length": 60, "default": "" } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to", "columns": [ "el_to", "el_from" ], "unique": false, "options": { "lengths": [ 60, null ] } }, + { "name": "el_index", "columns": [ "el_index" ], "unique": false, "options": { "lengths": [ 60 ] } }, + { "name": "el_index_60", "columns": [ "el_index_60", "el_id" ], "unique": false }, + { "name": "el_from_index_60", "columns": [ "el_from", "el_index_60", "el_id" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + }, + "after": { + "name": "externallinks", + "comment": "Track links to external URLs", + "columns": [ + { + "name": "el_id", + "type": "integer", + "options": { "unsigned": true, "notnull": true, "autoincrement": true } + }, + { + "name": "el_from", + "type": "integer", + "comment": "page_id of the referring page", + "options": { "unsigned": true, "notnull": true, "default": 0 } + }, + { + "name": "el_to_domain_index", + "type": "binary", + "comment": "Indexable domain", + "options": { "notnull": true, "length": 255, "default": "" } + }, + { + "name": "el_to_path", + "type": "blob", + "comment": "Path to the external link without considering the domain", + "options": { "length": 65530, "notnull": false } + } + ], + "indexes": [ + { "name": "el_from", "columns": [ "el_from" ], "unique": false }, + { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } + ], + "pk": [ "el_id" ] + } +} diff --git a/maintenance/archives/patch-externallinks-drop-el_to.sql b/maintenance/archives/patch-externallinks-drop-el_to.sql new file mode 100644 index 00000000000..5316a0b257e --- /dev/null +++ b/maintenance/archives/patch-externallinks-drop-el_to.sql @@ -0,0 +1,12 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-externallinks-drop-el_to.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +DROP INDEX el_to ON /*_*/externallinks; +DROP INDEX el_index ON /*_*/externallinks; +DROP INDEX el_index_60 ON /*_*/externallinks; +DROP INDEX el_from_index_60 ON /*_*/externallinks; +ALTER TABLE /*_*/externallinks +DROP el_to, +DROP el_index, +DROP el_index_60; \ No newline at end of file diff --git a/maintenance/fixExtLinksProtocolRelative.php b/maintenance/fixExtLinksProtocolRelative.php deleted file mode 100644 index 8541483c868..00000000000 --- a/maintenance/fixExtLinksProtocolRelative.php +++ /dev/null @@ -1,102 +0,0 @@ -addDescription( - 'Fixes any entries in the externallinks table containing protocol-relative URLs' ); - } - - protected function getUpdateKey() { - return 'fix protocol-relative URLs in externallinks'; - } - - protected function updateSkippedMessage() { - return 'protocol-relative URLs in externallinks table already fixed.'; - } - - protected function doDBUpdates() { - $db = $this->getDB( DB_PRIMARY ); - if ( !$db->tableExists( 'externallinks', __METHOD__ ) ) { - $this->error( "externallinks table does not exist" ); - - return false; - } - $this->output( "Fixing protocol-relative entries in the externallinks table...\n" ); - $res = $db->newSelectQueryBuilder() - ->select( [ 'el_from', 'el_to', 'el_index' ] ) - ->from( 'externallinks' ) - ->where( [ 'el_index' . $db->buildLike( '//', $db->anyString() ) ] ) - ->caller( __METHOD__ )->fetchResultSet(); - $count = 0; - foreach ( $res as $row ) { - $count++; - if ( $count % 100 == 0 ) { - $this->output( $count . "\n" ); - $this->waitForReplication(); - } - $db->insert( 'externallinks', - [ - [ - 'el_from' => $row->el_from, - 'el_to' => $row->el_to, - 'el_index' => "http:{$row->el_index}", - 'el_index_60' => substr( "http:{$row->el_index}", 0, 60 ), - ], - [ - 'el_from' => $row->el_from, - 'el_to' => $row->el_to, - 'el_index' => "https:{$row->el_index}", - 'el_index_60' => substr( "https:{$row->el_index}", 0, 60 ), - ] - ], __METHOD__, [ 'IGNORE' ] - ); - $db->delete( - 'externallinks', - [ - 'el_index' => $row->el_index, - 'el_from' => $row->el_from, - 'el_to' => $row->el_to - ], - __METHOD__ - ); - } - $this->output( "Done, $count rows updated.\n" ); - - return true; - } -} - -$maintClass = FixExtLinksProtocolRelative::class; -require_once RUN_MAINTENANCE_IF_MAIN; diff --git a/maintenance/postgres/archives/patch-externallinks-drop-el_to.sql b/maintenance/postgres/archives/patch-externallinks-drop-el_to.sql new file mode 100644 index 00000000000..db90fc7d962 --- /dev/null +++ b/maintenance/postgres/archives/patch-externallinks-drop-el_to.sql @@ -0,0 +1,14 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-externallinks-drop-el_to.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +DROP INDEX el_to; +DROP INDEX el_index; +DROP INDEX el_index_60; +DROP INDEX el_from_index_60; +ALTER TABLE externallinks +DROP el_to; +ALTER TABLE externallinks +DROP el_index; +ALTER TABLE externallinks +DROP el_index_60; \ No newline at end of file diff --git a/maintenance/postgres/tables-generated.sql b/maintenance/postgres/tables-generated.sql index 98742fcde3f..07bd39a138a 100644 --- a/maintenance/postgres/tables-generated.sql +++ b/maintenance/postgres/tables-generated.sql @@ -443,9 +443,6 @@ CREATE INDEX pt_timestamp ON protected_titles (pt_timestamp); CREATE TABLE externallinks ( el_id SERIAL NOT NULL, el_from INT DEFAULT 0 NOT NULL, - el_to TEXT DEFAULT '', - el_index TEXT DEFAULT '', - el_index_60 TEXT DEFAULT '' NOT NULL, el_to_domain_index TEXT DEFAULT '' NOT NULL, el_to_path TEXT DEFAULT NULL, PRIMARY KEY(el_id) @@ -453,14 +450,6 @@ CREATE TABLE externallinks ( CREATE INDEX el_from ON externallinks (el_from); -CREATE INDEX el_to ON externallinks (el_to, el_from); - -CREATE INDEX el_index ON externallinks (el_index); - -CREATE INDEX el_index_60 ON externallinks (el_index_60, el_id); - -CREATE INDEX el_from_index_60 ON externallinks (el_from, el_index_60, el_id); - CREATE INDEX el_to_domain_index_to_path ON externallinks (el_to_domain_index, el_to_path); diff --git a/maintenance/refreshExternallinksIndex.php b/maintenance/refreshExternallinksIndex.php deleted file mode 100644 index 18f06472ddb..00000000000 --- a/maintenance/refreshExternallinksIndex.php +++ /dev/null @@ -1,124 +0,0 @@ -addDescription( - 'Refresh the externallinks table el_index and el_index_60 from el_to' ); - $this->setBatchSize( 10000 ); - } - - protected function getUpdateKey() { - return static::class . ' v' . LinkFilter::VERSION . '+IDN'; - } - - protected function updateSkippedMessage() { - return 'externallinks table indexes up to date.'; - } - - protected function doDBUpdates() { - $dbw = $this->getDB( DB_PRIMARY ); - if ( !$dbw->tableExists( 'externallinks', __METHOD__ ) ) { - $this->error( "externallinks table does not exist" ); - return false; - } - $this->output( "Updating externallinks table index fields\n" ); - - $minmax = $dbw->selectRow( - 'externallinks', - [ 'min' => 'MIN(el_id)', 'max' => 'MAX(el_id)' ], - '', - __METHOD__ - ); - - $updated = 0; - $deleted = 0; - $start = $minmax->min - 1; - $last = (int)$minmax->max; - while ( $start < $last ) { - $end = min( $start + $this->mBatchSize, $last ); - $this->output( "el_id $start - $end of $last\n" ); - $res = $dbw->select( 'externallinks', [ 'el_id', 'el_to', 'el_index' ], - [ - "el_id > $start", - "el_id <= $end", - ], - __METHOD__, - [ 'ORDER BY' => 'el_id' ] - ); - foreach ( $res as $row ) { - $newIndexes = LinkFilter::makeIndexes( $row->el_to ); - if ( !$newIndexes ) { - $dbw->delete( 'externallinks', [ 'el_id' => $row->el_id ], __METHOD__ ); - $deleted++; - continue; - } - $newIndexes2 = []; - foreach ( $newIndexes as $newIndex ) { - $newIndexes2[] = implode( '', $newIndex ); - } - if ( in_array( $row->el_index, $newIndexes2, true ) ) { - continue; - } - - if ( count( $newIndexes2 ) === 1 ) { - $newIndex = $newIndexes2[0]; - } else { - // Assume the scheme is the only difference between the different $newIndexes. - // Keep this row's scheme, assuming there's another row with the other scheme. - $newIndex = substr( $row->el_index, 0, strpos( $row->el_index, ':' ) ) . - substr( $newIndexes2[0], strpos( $newIndexes2[0], ':' ) ); - } - $dbw->update( 'externallinks', - [ - 'el_index' => $newIndex, - 'el_index_60' => substr( $newIndex, 0, 60 ), - ], - [ 'el_id' => $row->el_id ], - __METHOD__ - ); - $updated++; - } - $this->waitForReplication(); - $start = $end; - } - $this->output( "Done, $updated rows updated, $deleted deleted.\n" ); - - return true; - } -} - -$maintClass = RefreshExternallinksIndex::class; -require_once RUN_MAINTENANCE_IF_MAIN; diff --git a/maintenance/sqlite/archives/patch-externallinks-drop-el_to.sql b/maintenance/sqlite/archives/patch-externallinks-drop-el_to.sql new file mode 100644 index 00000000000..d8041c8c03f --- /dev/null +++ b/maintenance/sqlite/archives/patch-externallinks-drop-el_to.sql @@ -0,0 +1,15 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-externallinks-drop-el_to.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +CREATE TEMPORARY TABLE /*_*/__temp__externallinks AS +SELECT el_id, el_from, el_to_domain_index, el_to_path +FROM /*_*/externallinks; +DROP TABLE /*_*/externallinks; +CREATE TABLE /*_*/externallinks ( el_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, el_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, el_to_domain_index BLOB DEFAULT '' NOT NULL, el_to_path BLOB DEFAULT NULL ); +INSERT INTO /*_*/externallinks ( el_id, el_from, el_to_domain_index, el_to_path ) +SELECT el_id, el_from, el_to_domain_index, el_to_path +FROM /*_*/__temp__externallinks; +DROP TABLE /*_*/__temp__externallinks; +CREATE INDEX el_from ON /*_*/externallinks (el_from); +CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks (el_to_domain_index, el_to_path); \ No newline at end of file diff --git a/maintenance/sqlite/tables-generated.sql b/maintenance/sqlite/tables-generated.sql index eafc70f7e09..e86e38bced2 100644 --- a/maintenance/sqlite/tables-generated.sql +++ b/maintenance/sqlite/tables-generated.sql @@ -426,22 +426,12 @@ CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp); CREATE TABLE /*_*/externallinks ( el_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, el_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, - el_to BLOB DEFAULT '', el_index BLOB DEFAULT '', - el_index_60 BLOB DEFAULT '' NOT NULL, el_to_domain_index BLOB DEFAULT '' NOT NULL, el_to_path BLOB DEFAULT NULL ); CREATE INDEX el_from ON /*_*/externallinks (el_from); -CREATE INDEX el_to ON /*_*/externallinks (el_to, el_from); - -CREATE INDEX el_index ON /*_*/externallinks (el_index); - -CREATE INDEX el_index_60 ON /*_*/externallinks (el_index_60, el_id); - -CREATE INDEX el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id); - CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks (el_to_domain_index, el_to_path); diff --git a/maintenance/tables-generated.sql b/maintenance/tables-generated.sql index 1bdf591a9f4..bef41e20e00 100644 --- a/maintenance/tables-generated.sql +++ b/maintenance/tables-generated.sql @@ -391,21 +391,9 @@ CREATE TABLE /*_*/protected_titles ( CREATE TABLE /*_*/externallinks ( el_id INT UNSIGNED AUTO_INCREMENT NOT NULL, el_from INT UNSIGNED DEFAULT 0 NOT NULL, - el_to BLOB DEFAULT NULL, - el_index BLOB DEFAULT NULL, - el_index_60 VARBINARY(60) DEFAULT '' NOT NULL, el_to_domain_index VARBINARY(255) DEFAULT '' NOT NULL, el_to_path BLOB DEFAULT NULL, INDEX el_from (el_from), - INDEX el_to ( - el_to(60), - el_from - ), - INDEX el_index ( - el_index(60) - ), - INDEX el_index_60 (el_index_60, el_id), - INDEX el_from_index_60 (el_from, el_index_60, el_id), INDEX el_to_domain_index_to_path ( el_to_domain_index, el_to_path(60) diff --git a/maintenance/tables.json b/maintenance/tables.json index 166dc7831e6..d1d1d6a49fb 100644 --- a/maintenance/tables.json +++ b/maintenance/tables.json @@ -1302,24 +1302,6 @@ "comment": "page_id of the referring page", "options": { "unsigned": true, "notnull": true, "default": 0 } }, - { - "name": "el_to", - "type": "blob", - "comment": "The external link", - "options": { "length": 65530, "notnull": false, "default": "" } - }, - { - "name": "el_index", - "type": "blob", - "comment": "In the case of HTTP URLs, this is the URL with any username or password removed, and with the labels in the hostname reversed and converted to lower case which will allow faster searching for all pages with WHERE clause. Note: If PHP's intl extension is enabled/disabled, maintenance/refreshExternallinksIndex.php needs to be run to refresh this field", - "options": { "length": 65530, "notnull": false, "default": "" } - }, - { - "name": "el_index_60", - "type": "binary", - "comment": "'el_index' truncated to 60 bytes to allow for sortable queries that aren't supported by a partial index", - "options": { "notnull": true, "length": 60, "default": "" } - }, { "name": "el_to_domain_index", "type": "binary", @@ -1335,10 +1317,6 @@ ], "indexes": [ { "name": "el_from", "columns": [ "el_from" ], "unique": false }, - { "name": "el_to", "columns": [ "el_to", "el_from" ], "unique": false, "options": { "lengths": [ 60, null ] } }, - { "name": "el_index", "columns": [ "el_index" ], "unique": false, "options": { "lengths": [ 60 ] } }, - { "name": "el_index_60", "columns": [ "el_index_60", "el_id" ], "unique": false }, - { "name": "el_from_index_60", "columns": [ "el_from", "el_index_60", "el_id" ], "unique": false }, { "name": "el_to_domain_index_to_path", "columns": [ "el_to_domain_index", "el_to_path" ], "unique": false, "options": { "lengths": [ null, 60 ] } } ], "pk": [ "el_id" ] diff --git a/tests/phpunit/includes/deferred/LinksUpdateTest.php b/tests/phpunit/includes/deferred/LinksUpdateTest.php index e4fa2b55bfb..32df9044fc3 100644 --- a/tests/phpunit/includes/deferred/LinksUpdateTest.php +++ b/tests/phpunit/includes/deferred/LinksUpdateTest.php @@ -195,11 +195,11 @@ class LinksUpdateTest extends MediaWikiLangTestCase { $t, $po, 'externallinks', - [ 'el_to', 'el_index' ], + [ 'el_to_domain_index', 'el_to_path' ], 'el_from = ' . self::$testingPageId, [ - [ 'http://testing.com/wiki/Bar', 'http://com.testing./wiki/Bar' ], - [ 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ], + [ 'http://com.testing.', '/wiki/Bar' ], + [ 'http://com.testing.', '/wiki/Foo' ], ] ); @@ -216,11 +216,11 @@ class LinksUpdateTest extends MediaWikiLangTestCase { $t, $po, 'externallinks', - [ 'el_to', 'el_index' ], + [ 'el_to_domain_index', 'el_to_path' ], 'el_from = ' . self::$testingPageId, [ - [ 'http://testing.com/wiki/Bar', 'http://com.testing./wiki/Bar' ], - [ 'http://testing.com/wiki/Baz', 'http://com.testing./wiki/Baz' ], + [ 'http://com.testing.', '/wiki/Bar' ], + [ 'http://com.testing.', '/wiki/Baz' ], ] ); @@ -862,7 +862,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase { /** @var ParserOutput $po */ [ $t, $po ] = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId ); $po->addCategory( $s, $s ); - $po->addExternalLink( $s ); + $po->addExternalLink( 'https://foo.com' ); $po->addImage( $s ); $po->addInterwikiLink( new TitleValue( 0, $s, '', $s ) ); $po->addLanguageLink( "$s:$s" );