Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/293039

Change subject: Migrate and remove event_page_namespace and event_page_title
......................................................................

Migrate and remove event_page_namespace and event_page_title

By running updateEchoSchemaForSuppression.php as an updater.
The patch-*.sql files already existed, they were added
in 2013(!) by 34fbeaf8c but never applied.

Bug: T136427
Bug: T50059
Change-Id: Ied049681df4bab325f069c3a68cf704ee9a8f2c9
Depends-On: Idf3fdb77a9f2e895a57eb0f982e06a7ab67ae124
---
M Hooks.php
M echo.sql
M maintenance/updateEchoSchemaForSuppression.php
3 files changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/39/293039/1

diff --git a/Hooks.php b/Hooks.php
index bb381fb..89fb22d 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -165,6 +165,15 @@
                $updater->addExtensionField( 'echo_event', 'event_page_id', 
"$dir/db_patches/patch-add-echo_event-event_page_id.sql" );
                $updater->addExtensionIndex( 'echo_event', 'echo_event_type', 
"$dir/db_patches/patch-alter-event_type-index.sql" );
                $updater->addExtensionIndex( 'echo_notification', 
'echo_user_timestamp', "$dir/db_patches/patch-alter-user_timestamp-index.sql" );
+               // Can't use addPostDatabaseUpdateMaintenance() here because 
that would run the migration script after dropping the fields
+               $updater->addExtensionUpdate( array( 
'EchoHooks::doUpdateEchoSchemaForSuppression' ) );
+               $updater->dropExtensionField( 'echo_event', 
'event_page_namespace', 
"$dir/db_patches/patch-drop-echo_event-event_page_namespace.sql" );
+               $updater->dropExtensionField( 'echo_event', 'event_page_title', 
"$dir/db_patches/patch-drop-echo_event-event_page_title.sql" );
+       }
+
+       public static function doUpdateEchoSchemaForSuppression( $updater ) {
+               $task = $updater->maintenance->runChild( 
'UpdateEchoSchemaForSuppression' );
+               $task->execute();
        }
 
        /**
diff --git a/echo.sql b/echo.sql
index 910203a..9b8d50d 100644
--- a/echo.sql
+++ b/echo.sql
@@ -6,8 +6,6 @@
        event_variant varchar(64) binary null,
        event_agent_id int unsigned null, -- The user who triggered it, if any
        event_agent_ip varchar(39) binary null, -- IP address who triggered it, 
if any
-       event_page_namespace int unsigned null,
-       event_page_title varchar(255) binary null,
        event_extra BLOB NULL,
        event_page_id int unsigned null
 ) /*$wgDBTableOptions*/;
diff --git a/maintenance/updateEchoSchemaForSuppression.php 
b/maintenance/updateEchoSchemaForSuppression.php
index 6224af5..8aad843 100644
--- a/maintenance/updateEchoSchemaForSuppression.php
+++ b/maintenance/updateEchoSchemaForSuppression.php
@@ -47,7 +47,8 @@
 
                $updater = new BatchRowUpdate(
                        $reader,
-                       new BatchRowWriter( MWEchoDbFactory::getDB( DB_MASTER 
), $this->table, $wgEchoCluster ),
+                       // Disable transactions for BatchRowWriter so that this 
can be run from update.php
+                       new BatchRowWriter( MWEchoDbFactory::getDB( DB_MASTER 
), $this->table, $wgEchoCluster, false ),
                        new EchoSuppressionRowUpdateGenerator
                );
                $updater->setOutput( function ( $text ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/293039
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied049681df4bab325f069c3a68cf704ee9a8f2c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Catrope <roan.katt...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to