Wire migration scripts to SchemaHooks

Add MigrateNamespace and MigrateTagTemplate as post database update
maintenance operations.

Bug: T367207
Change-Id: I7676f9ce4bef59febc463d897cb26d47347a3968
This commit is contained in:
Isabelle Hurbain-Palatin 2024-10-10 13:52:30 +02:00
parent 9d5c586377
commit 165354ab91
4 changed files with 17 additions and 0 deletions

View file

@ -12,6 +12,10 @@
"requires": { "requires": {
"MediaWiki": ">= 1.43" "MediaWiki": ">= 1.43"
}, },
"AutoloadClasses": {
"MediaWiki\\Linter\\Maintenance\\MigrateNamespace": "maintenance/migrateNamespace.php",
"MediaWiki\\Linter\\Maintenance\\MigrateTagTemplate": "maintenance/migrateTagTemplate.php"
},
"AutoloadNamespaces": { "AutoloadNamespaces": {
"MediaWiki\\Linter\\": "includes/" "MediaWiki\\Linter\\": "includes/"
}, },

View file

@ -22,6 +22,8 @@ namespace MediaWiki\Linter;
use MediaWiki\Installer\DatabaseUpdater; use MediaWiki\Installer\DatabaseUpdater;
use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
use MediaWiki\Linter\Maintenance\MigrateNamespace;
use MediaWiki\Linter\Maintenance\MigrateTagTemplate;
class SchemaHooks implements LoadExtensionSchemaUpdatesHook { class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
/** /**
@ -45,5 +47,8 @@ class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
$updater->modifyExtensionField( 'linter', 'linter_params', $updater->modifyExtensionField( 'linter', 'linter_params',
"{$dir}/sql/{$dbType}/patch-linter-fix-params-null-definition.sql" "{$dir}/sql/{$dbType}/patch-linter-fix-params-null-definition.sql"
); );
// 1.43
$updater->addPostDatabaseUpdateMaintenance( MigrateNamespace::class );
$updater->addPostDatabaseUpdateMaintenance( MigrateTagTemplate::class );
} }
} }

View file

@ -1,5 +1,9 @@
<?php <?php
namespace MediaWiki\Linter\Maintenance;
use LoggedUpdateMaintenance;
/** /**
* Maintenance script that migrates the page table page_namespace field values * Maintenance script that migrates the page table page_namespace field values
* to the linter table linter_namespace field to improve linter search performance. * to the linter table linter_namespace field to improve linter search performance.

View file

@ -1,5 +1,9 @@
<?php <?php
namespace MediaWiki\Linter\Maintenance;
use LoggedUpdateMaintenance;
/** /**
* Maintenance script that migrates the linter_params field value to the new tag and template fields * Maintenance script that migrates the linter_params field value to the new tag and template fields
* Note: The schema migration "patch-linter-add-template-tag-fields.json" is expected to have been done. * Note: The schema migration "patch-linter-add-template-tag-fields.json" is expected to have been done.