Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ciencia/de9b8f7da49201f4c9cdb4fd4432be71 to your computer and use it in GitHub Desktop.
Save ciencia/de9b8f7da49201f4c9cdb4fd4432be71 to your computer and use it in GitHub Desktop.
MediaWiki ext-CheckUser updater no destructive updates REL1_43
diff --git a/src/HookHandler/SchemaChangesHandler.php b/src/HookHandler/SchemaChangesHandler.php
index 6e6575d5..9708eeb2 100644
--- a/src/HookHandler/SchemaChangesHandler.php
+++ b/src/HookHandler/SchemaChangesHandler.php
@@ -241,11 +241,11 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook, CheckUserQ
'cu_private_event',
"$base/$dbType/patch-cu_private_event-def.sql"
);
- $updater->dropExtensionField(
- 'cu_log',
- 'cul_user',
- "$base/$dbType/patch-cu_log-drop-cul_user.sql"
- );
+ // $updater->dropExtensionField(
+ // 'cu_log',
+ // 'cul_user',
+ // "$base/$dbType/patch-cu_log-drop-cul_user.sql"
+ // );
if (
$dbType !== 'sqlite' ||
$maintenanceDb->fieldExists( 'cu_log', 'cul_reason', __METHOD__ )
@@ -261,21 +261,21 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook, CheckUserQ
"$base/$dbType/patch-cu_log-drop-actor_default.sql"
);
}
- $updater->dropExtensionField(
- 'cu_log',
- 'cul_reason',
- "$base/$dbType/patch-cu_log-drop-cul_reason.sql"
- );
- $updater->modifyExtensionField(
- 'cu_log',
- 'cul_reason_id',
- "$base/$dbType/patch-cu_log-drop-cul_reason_id_default.sql"
- );
- $updater->dropExtensionField(
- 'cu_changes',
- 'cuc_user',
- "$base/$dbType/patch-cu_changes-drop-cuc_user.sql"
- );
+ // $updater->dropExtensionField(
+ // 'cu_log',
+ // 'cul_reason',
+ // "$base/$dbType/patch-cu_log-drop-cul_reason.sql"
+ // );
+ // $updater->modifyExtensionField(
+ // 'cu_log',
+ // 'cul_reason_id',
+ // "$base/$dbType/patch-cu_log-drop-cul_reason_id_default.sql"
+ // );
+ // $updater->dropExtensionField(
+ // 'cu_changes',
+ // 'cuc_user',
+ // "$base/$dbType/patch-cu_changes-drop-cuc_user.sql"
+ // );
// Skip adding the cuc_only_for_read_old column if:
// * This is an install of CheckUser MW 1.43 or later (and therefore no migration is necesary)
// * The column has been in the table before (checked by seeing if the cuc_agent_id column exists
@@ -288,36 +288,36 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook, CheckUserQ
"$base/$dbType/patch-cu_changes-add-cuc_only_for_read_old.sql"
);
}
- $updater->dropExtensionField(
- 'cu_changes',
- 'cuc_comment',
- "$base/$dbType/patch-cu_changes-drop-cuc_comment.sql"
- );
+ // $updater->dropExtensionField(
+ // 'cu_changes',
+ // 'cuc_comment',
+ // "$base/$dbType/patch-cu_changes-drop-cuc_comment.sql"
+ // );
// Only run this for SQLite if cuc_only_for_read_old exists, as modifyExtensionField does not take into
// account that SQLite patches that use temporary tables. If the cuc_only_for_read_old field does not exist
// this SQL would fail, however, cuc_only_for_read_old not existing also means this change has
// been previously applied.
- if (
- $dbType !== 'sqlite' ||
- $maintenanceDb->fieldExists( 'cu_changes', 'cuc_only_for_read_old', __METHOD__ )
- ) {
- $updater->modifyExtensionField(
- 'cu_changes',
- 'cuc_actor',
- "$base/$dbType/patch-cu_changes-drop-defaults.sql"
- );
- }
+ // if (
+ // $dbType !== 'sqlite' ||
+ // $maintenanceDb->fieldExists( 'cu_changes', 'cuc_only_for_read_old', __METHOD__ )
+ // ) {
+ // $updater->modifyExtensionField(
+ // 'cu_changes',
+ // 'cuc_actor',
+ // "$base/$dbType/patch-cu_changes-drop-defaults.sql"
+ // );
+ // }
// 1.41
$updater->addExtensionTable( 'cu_useragent_clienthints', "$base/$dbType/cu_useragent_clienthints.sql" );
$updater->addExtensionTable( 'cu_useragent_clienthints_map', "$base/$dbType/cu_useragent_clienthints_map.sql" );
- // Must be run before deleteReadOldEntriesInCuChanges.php is run or the cuc_only_for_read_old column is
- // removed, as the script needs the column to be present and needs to be allowed to set the value of the
- // column to 1.
- $updater->addExtensionUpdate( [
- 'runMaintenance',
- MoveLogEntriesFromCuChanges::class,
- ] );
+ // // Must be run before deleteReadOldEntriesInCuChanges.php is run or the cuc_only_for_read_old column is
+ // // removed, as the script needs the column to be present and needs to be allowed to set the value of the
+ // // column to 1.
+ // $updater->addExtensionUpdate( [
+ // 'runMaintenance',
+ // MoveLogEntriesFromCuChanges::class,
+ // ] );
// 1.42
$updater->addExtensionField(
@@ -332,7 +332,7 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook, CheckUserQ
"$base/$dbType/patch-cu_changes-modify-cuc_id-bigint.sql"
);
}
- $updater->addPostDatabaseUpdateMaintenance( FixTrailingSpacesInLogs::class );
+ // $updater->addPostDatabaseUpdateMaintenance( FixTrailingSpacesInLogs::class );
// If any columns are modified or removed from cu_private_event in the future, then make sure to only apply this
// patch if the later schema change has not yet been applied. Otherwise wikis using SQLite will have a DB error.
$updater->modifyExtensionField(
@@ -360,29 +360,29 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook, CheckUserQ
// 1.43
// Must be run before the removal of the cuc_only_for_read_old column, as the script needs the column to be
// present to delete the rows where the column value is 1.
- $updater->addExtensionUpdate( [
- 'runMaintenance',
- DeleteReadOldRowsInCuChanges::class,
- ] );
- $updater->dropExtensionField(
- 'cu_changes',
- 'cuc_only_for_read_old',
- "$base/$dbType/patch-cu_changes-drop-cuc_only_for_read_old.sql"
- );
- $updater->dropExtensionField(
- 'cu_changes',
- 'cuc_actiontext',
- "$base/$dbType/patch-cu_changes-drop-cuc_actiontext.sql"
- );
- $updater->dropExtensionField(
- 'cu_changes',
- 'cuc_private',
- "$base/$dbType/patch-cu_changes-drop-cuc_private.sql"
- );
+ // $updater->addExtensionUpdate( [
+ // 'runMaintenance',
+ // DeleteReadOldRowsInCuChanges::class,
+ // ] );
+ // $updater->dropExtensionField(
+ // 'cu_changes',
+ // 'cuc_only_for_read_old',
+ // "$base/$dbType/patch-cu_changes-drop-cuc_only_for_read_old.sql"
+ // );
+ // $updater->dropExtensionField(
+ // 'cu_changes',
+ // 'cuc_actiontext',
+ // "$base/$dbType/patch-cu_changes-drop-cuc_actiontext.sql"
+ // );
+ // $updater->dropExtensionField(
+ // 'cu_changes',
+ // 'cuc_private',
+ // "$base/$dbType/patch-cu_changes-drop-cuc_private.sql"
+ // );
if ( $isCUInstalled ) {
// We only need to run this maintenance script if CU is already installed, because otherwise the script
// will be run for us by the populateCheckUserTable.php script (after it's populated the tables).
- $updater->addPostDatabaseUpdateMaintenance( PopulateCentralCheckUserIndexTables::class );
+ // $updater->addPostDatabaseUpdateMaintenance( PopulateCentralCheckUserIndexTables::class );
}
if ( !$isCUInstalled ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment