jenkins-bot has submitted this change and it was merged.

Change subject: Replace EchoBatchRowUpdate with BatchRowUpdate
......................................................................


Replace EchoBatchRowUpdate with BatchRowUpdate

* Replace EchoBatchRowUpdate and friends with equivalents
  in mediawiki/core
* Some tweaks to make some of the scripts run

Bug: T119253
Change-Id: Iccafbbdb06711463fee0f30a11326c7771df30e2
---
M includes/Data/Utils/UserMerger.php
M includes/Import/Postprocessor/LqtNotifications.php
M includes/Utils/NamespaceIterator.php
M includes/Utils/PagesWithPropertyIterator.php
M maintenance/FlowAddMissingModerationLogs.php
M maintenance/FlowExternalStoreMoveCluster.php
M maintenance/FlowFixLog.php
M maintenance/FlowFixWorkflowLastUpdateTimestamp.php
M maintenance/FlowUpdateRevisionContentLength.php
M maintenance/FlowUpdateWorkflowPageId.php
M maintenance/repair_missing_from_csv.php
M maintenance/repair_missing_revision_content.php
M maintenance/repair_missing_revision_content_from_parent.php
13 files changed, 67 insertions(+), 42 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Data/Utils/UserMerger.php 
b/includes/Data/Utils/UserMerger.php
index b8f4c07..8caf12e 100644
--- a/includes/Data/Utils/UserMerger.php
+++ b/includes/Data/Utils/UserMerger.php
@@ -2,7 +2,7 @@
 
 namespace Flow\Data\Utils;
 
-use EchoBatchRowIterator;
+use BatchRowIterator;
 use Flow\Data\ManagerGroup;
 use Flow\DbFactory;
 use Flow\Model\AbstractRevision;
@@ -85,7 +85,7 @@
                $dbw = $this->dbFactory->getDb( DB_MASTER );
                foreach ( $this->config as $table => $config ) {
                        foreach ( $config['userColumns'] as $column => 
$userTupleGetter ) {
-                               $it = new EchoBatchRowIterator( $dbw, $table, 
$config['pk'], 500 );
+                               $it = new BatchRowIterator( $dbw, $table, 
$config['pk'], 500 );
                                // The database is migrated, so look for the 
new user id
                                $it->addConditions( array( $column => 
$newUserId ) );
                                if ( isset( $config['loadColumns'] ) ) {
diff --git a/includes/Import/Postprocessor/LqtNotifications.php 
b/includes/Import/Postprocessor/LqtNotifications.php
index 05c1014..896d2ae 100644
--- a/includes/Import/Postprocessor/LqtNotifications.php
+++ b/includes/Import/Postprocessor/LqtNotifications.php
@@ -3,7 +3,7 @@
 namespace Flow\Import\Postprocessor;
 
 use DatabaseBase;
-use EchoBatchRowIterator;
+use BatchRowIterator;
 use EchoCallbackIterator;
 use EchoEvent;
 use Flow\Import\IImportHeader;
@@ -97,7 +97,7 @@
                        throw new ImportException( 'No active thread!' );
                }
 
-               $it = new EchoBatchRowIterator(
+               $it = new BatchRowIterator(
                        $this->dbw,
                        /* table = */ 'user_message_state',
                        /* primary keys */ array( 'ums_user' ),
diff --git a/includes/Utils/NamespaceIterator.php 
b/includes/Utils/NamespaceIterator.php
index a52a356..55bad8b 100644
--- a/includes/Utils/NamespaceIterator.php
+++ b/includes/Utils/NamespaceIterator.php
@@ -3,7 +3,7 @@
 namespace Flow\Utils;
 
 use DatabaseBase;
-use EchoBatchRowIterator;
+use BatchRowIterator;
 use EchoCallbackIterator;
 use Iterator;
 use IteratorAggregate;
@@ -38,7 +38,7 @@
         * @return Iterator<Title>
         */
        public function getIterator() {
-               $it = new EchoBatchRowIterator(
+               $it = new BatchRowIterator(
                        $this->db,
                        /* tables */ array( 'page' ),
                        /* pk */ 'page_id',
diff --git a/includes/Utils/PagesWithPropertyIterator.php 
b/includes/Utils/PagesWithPropertyIterator.php
index c6cc33b..f9be2b1 100644
--- a/includes/Utils/PagesWithPropertyIterator.php
+++ b/includes/Utils/PagesWithPropertyIterator.php
@@ -3,7 +3,7 @@
 namespace Flow\Utils;
 
 use DatabaseBase;
-use EchoBatchRowIterator;
+use BatchRowIterator;
 use EchoCallbackIterator;
 use IteratorAggregate;
 use RecursiveIteratorIterator;
@@ -54,7 +54,7 @@
         * @return Iterator<Title>
         */
        public function getIterator() {
-               $it = new EchoBatchRowIterator(
+               $it = new BatchRowIterator(
                        $this->db,
                        /* tables */ array( 'page_props', 'page' ),
                        /* pk */ 'pp_page',
diff --git a/maintenance/FlowAddMissingModerationLogs.php 
b/maintenance/FlowAddMissingModerationLogs.php
index 9236d17..25977dd 100644
--- a/maintenance/FlowAddMissingModerationLogs.php
+++ b/maintenance/FlowAddMissingModerationLogs.php
@@ -39,7 +39,7 @@
 
                $moderationLoggingListener = 
$container['storage.post.listeners.moderation_logging'];
 
-               $rowIterator = new EchoBatchRowIterator(
+               $rowIterator = new BatchRowIterator(
                        $dbw,
                        /* table = */'flow_revision',
                        /* primary key = */'rev_id',
diff --git a/maintenance/FlowExternalStoreMoveCluster.php 
b/maintenance/FlowExternalStoreMoveCluster.php
index 67be68e..a2c247f 100644
--- a/maintenance/FlowExternalStoreMoveCluster.php
+++ b/maintenance/FlowExternalStoreMoveCluster.php
@@ -2,10 +2,13 @@
 
 use Flow\Container;
 
-require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
-    ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
-    : dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
-require_once( __DIR__ . '/../../Echo/includes/BatchRowUpdate.php' );
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+       $IP = dirname( __FILE__ ) . '/../../..';
+}
+
+require_once "$IP/maintenance/Maintenance.php";
+require_once "$IP/includes/utils/RowUpdateGenerator.php";
 
 /**
  * @ingroup Maintenance
@@ -63,7 +66,7 @@
         /** @var DatabaseBase $dbw */
         $dbw = $schema['dbw'];
 
-        $iterator = new EchoBatchRowIterator( $dbr, $schema['table'], 
$schema['pk'], $this->mBatchSize );
+        $iterator = new BatchRowIterator( $dbr, $schema['table'], 
$schema['pk'], $this->mBatchSize );
         $iterator->setFetchColumns( array( $schema['content'], 
$schema['flags'] ) );
 
         $clusterConditions = array();
@@ -75,9 +78,9 @@
             $dbr->makeList( $clusterConditions, LIST_OR ),
         ) );
 
-        $updater = new EchoBatchRowUpdate(
+        $updater = new BatchRowUpdate(
             $iterator,
-            new EchoBatchRowWriter( $dbw, $schema['table'] ),
+            new BatchRowWriter( $dbw, $schema['table'] ),
             new ExternalStoreUpdateGenerator( $this, $to, $schema )
         );
         $updater->setOutput( array( $this, 'output' ) );
@@ -108,7 +111,7 @@
     }
 }
 
-class ExternalStoreUpdateGenerator implements EchoRowUpdateGenerator {
+class ExternalStoreUpdateGenerator implements RowUpdateGenerator {
     /**
      * @var ExternalStoreMoveCluster
      */
diff --git a/maintenance/FlowFixLog.php b/maintenance/FlowFixLog.php
index 34097bb..a67298d 100644
--- a/maintenance/FlowFixLog.php
+++ b/maintenance/FlowFixLog.php
@@ -7,10 +7,13 @@
 use Flow\Model\UUID;
 use Flow\Collection\PostCollection;
 
-require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
-       ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
-       : dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
-require_once( __DIR__ . '/../../Echo/includes/BatchRowUpdate.php' );
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+       $IP = dirname( __FILE__ ) . '/../../..';
+}
+
+require_once( "$IP/maintenance/Maintenance.php" );
+require_once( "$IP/includes/utils/RowUpdateGenerator.php" );
 
 /**
  * Fixes Flow log entries.
@@ -31,7 +34,7 @@
        }
 
        protected function doDBUpdates() {
-               $iterator = new EchoBatchRowIterator( wfGetDB( DB_SLAVE ), 
'logging', 'log_id', $this->mBatchSize );
+               $iterator = new BatchRowIterator( wfGetDB( DB_SLAVE ), 
'logging', 'log_id', $this->mBatchSize );
                $iterator->setFetchColumns( array( 'log_id', 'log_params' ) );
                $iterator->addConditions( array(
                        'log_type' => array( 'delete', 'suppress' ),
@@ -41,9 +44,9 @@
                        ),
                ) );
 
-               $updater = new EchoBatchRowUpdate(
+               $updater = new BatchRowUpdate(
                        $iterator,
-                       new EchoBatchRowWriter( wfGetDB( DB_MASTER ), 'logging' 
),
+                       new BatchRowWriter( wfGetDB( DB_MASTER ), 'logging' ),
                        new LogRowUpdateGenerator( $this )
                );
                $updater->setOutput( array( $this, 'output' ) );
@@ -76,7 +79,7 @@
        }
 }
 
-class LogRowUpdateGenerator implements EchoRowUpdateGenerator {
+class LogRowUpdateGenerator implements RowUpdateGenerator {
        /**
         * @var FlowFixLog
         */
diff --git a/maintenance/FlowFixWorkflowLastUpdateTimestamp.php 
b/maintenance/FlowFixWorkflowLastUpdateTimestamp.php
index 638fa1e..c03c3e0 100644
--- a/maintenance/FlowFixWorkflowLastUpdateTimestamp.php
+++ b/maintenance/FlowFixWorkflowLastUpdateTimestamp.php
@@ -9,10 +9,14 @@
 use Flow\Model\Workflow;
 use Flow\Repository\RootPostLoader;
 
-require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
-       ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
-       : dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
-require_once( __DIR__ . '/../../Echo/includes/BatchRowUpdate.php' );
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+       $IP = dirname( __FILE__ ) . '/../../..';
+}
+
+require_once( "$IP/maintenance/Maintenance.php" );
+require_once( "$IP/includes/utils/RowUpdateGenerator.php" );
+require_once( "$IP/includes/utils/BatchRowWriter.php" );
 
 /**
  * @ingroup Maintenance
@@ -33,11 +37,11 @@
                $storage = Container::get( 'storage' );
                $rootPostLoader = Container::get( 'loader.root_post' );
 
-               $iterator = new EchoBatchRowIterator( $dbFactory->getDB( 
DB_SLAVE ), 'flow_workflow', 'workflow_id', $this->mBatchSize );
+               $iterator = new BatchRowIterator( $dbFactory->getDB( DB_SLAVE 
), 'flow_workflow', 'workflow_id', $this->mBatchSize );
                $iterator->setFetchColumns( array( 'workflow_id', 
'workflow_type', 'workflow_last_update_timestamp' ) );
                $iterator->addConditions( array( 'workflow_wiki' => wfWikiId() 
) );
 
-               $updater = new EchoBatchRowUpdate(
+               $updater = new BatchRowUpdate(
                        $iterator,
                        new UpdateWorkflowLastUpdateTimestampWriter( $storage, 
$wgFlowCluster ),
                        new UpdateWorkflowLastUpdateTimestampGenerator( 
$storage, $rootPostLoader )
@@ -59,7 +63,7 @@
        }
 }
 
-class UpdateWorkflowLastUpdateTimestampGenerator implements 
EchoRowUpdateGenerator {
+class UpdateWorkflowLastUpdateTimestampGenerator implements RowUpdateGenerator 
{
        /**
         * @var ManagerGroup
         */
@@ -148,7 +152,7 @@
        }
 }
 
-class UpdateWorkflowLastUpdateTimestampWriter extends EchoBatchRowWriter {
+class UpdateWorkflowLastUpdateTimestampWriter extends BatchRowWriter {
        /**
         * @var ManagerGroup
         */
diff --git a/maintenance/FlowUpdateRevisionContentLength.php 
b/maintenance/FlowUpdateRevisionContentLength.php
index a4c8bdf..f89f641 100644
--- a/maintenance/FlowUpdateRevisionContentLength.php
+++ b/maintenance/FlowUpdateRevisionContentLength.php
@@ -74,7 +74,7 @@
 
                $dbw = $this->dbFactory->getDb( DB_MASTER );
                // Walk through the flow_revision table
-               $it = new EchoBatchRowIterator(
+               $it = new BatchRowIterator(
                        $dbw,
                        /* table = */'flow_revision',
                        /* primary key = */'rev_id',
diff --git a/maintenance/FlowUpdateWorkflowPageId.php 
b/maintenance/FlowUpdateWorkflowPageId.php
index 7ff32a1..c67debc 100644
--- a/maintenance/FlowUpdateWorkflowPageId.php
+++ b/maintenance/FlowUpdateWorkflowPageId.php
@@ -9,7 +9,7 @@
        $IP = dirname( __FILE__ ) . '/../../..';
 }
 require_once( "$IP/maintenance/Maintenance.php" );
-require_once __DIR__ . "/../../Echo/includes/BatchRowUpdate.php";
+require_once( "$IP/includes/utils/RowUpdateGenerator.php" );
 
 /**
  * In some cases we have created workflow instances before the related Title
@@ -33,7 +33,7 @@
 
                $dbw = Container::get( 'db.factory' )->getDB( DB_MASTER );
 
-               $it = new EchoBatchRowIterator(
+               $it = new BatchRowIterator(
                        $dbw,
                        'flow_workflow',
                        'workflow_id',
@@ -45,8 +45,8 @@
                ) );
 
                $gen = new WorkflowPageIdUpdateGenerator( $wgLang );
-               $writer = new EchoBatchRowWriter( $dbw, 'flow_workflow', 
$wgFlowCluster );
-               $updater = new EchoBatchRowUpdate( $it, $writer, $gen );
+               $writer = new BatchRowWriter( $dbw, 'flow_workflow', 
$wgFlowCluster );
+               $updater = new BatchRowUpdate( $it, $writer, $gen );
 
                $updater->execute();
 
@@ -64,7 +64,7 @@
  * Looks at rows from the flow_workflow table and returns an update
  * for the workflow_page_id field if necessary.
  */
-class WorkflowPageIdUpdateGenerator implements EchoRowUpdateGenerator {
+class WorkflowPageIdUpdateGenerator implements RowUpdateGenerator {
        /**
         * @var Language|StubUserLang
         */
@@ -96,7 +96,7 @@
                if ( $row->workflow_page_id === 0 && $title->getArticleID() === 
0 ) {
                        // build workflow object (yes, loading them piecemeal 
is suboptimal, but
                        // this is just a one-time script; considering the 
alternative is
-                       // creating a derivative EchoBatchRowIterator that 
returns workflows,
+                       // creating a derivative BatchRowIterator that returns 
workflows,
                        // it doesn't really matter)
                        $storage = Container::get( 'storage' );
                        $workflow = $storage->get( 'Workflow', UUID::create( 
$row->workflow_id ) );
diff --git a/maintenance/repair_missing_from_csv.php 
b/maintenance/repair_missing_from_csv.php
index 54c36c9..3763292 100644
--- a/maintenance/repair_missing_from_csv.php
+++ b/maintenance/repair_missing_from_csv.php
@@ -1,5 +1,10 @@
 <?php
 
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+       $IP = dirname( __FILE__ ) . '/../../..';
+}
+
 require_once "$IP/maintenance/commandLine.inc";
 require_once "$IP/extensions/Flow/FlowActions.php";
 
diff --git a/maintenance/repair_missing_revision_content.php 
b/maintenance/repair_missing_revision_content.php
index 0ece306..4a221ac 100644
--- a/maintenance/repair_missing_revision_content.php
+++ b/maintenance/repair_missing_revision_content.php
@@ -1,5 +1,10 @@
 <?php
 
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+       $IP = dirname( __FILE__ ) . '/../../..';
+}
+
 require_once "$IP/maintenance/commandLine.inc";
 require_once "$IP/extensions/Flow/FlowActions.php";
 
@@ -26,7 +31,7 @@
 }
 fputcsv( $csvOutput, array( "uuid", "esurl", "flags" ) );
 
-$it = new EchoBatchRowIterator(
+$it = new BatchRowIterator(
        Flow\Container::get( 'db.factory' )->getDB( DB_SLAVE ),
        'flow_revision',
        array( 'rev_id' ),
diff --git a/maintenance/repair_missing_revision_content_from_parent.php 
b/maintenance/repair_missing_revision_content_from_parent.php
index e053734..980b041 100644
--- a/maintenance/repair_missing_revision_content_from_parent.php
+++ b/maintenance/repair_missing_revision_content_from_parent.php
@@ -1,5 +1,10 @@
 <?php
 
+$IP = getenv( 'MW_INSTALL_PATH' );
+if ( $IP === false ) {
+       $IP = dirname( __FILE__ ) . '/../../..';
+}
+
 require_once "$IP/maintenance/commandLine.inc";
 require_once "$IP/extensions/Flow/FlowActions.php";
 
@@ -22,7 +27,7 @@
 fputcsv( $csvOutput, array( "uuid", "esurl", "flags" ) );
 
 $dbr = Flow\Container::get( 'db.factory' )->getDB( DB_SLAVE );
-$it = new EchoBatchRowIterator(
+$it = new BatchRowIterator(
        $dbr,
        'flow_revision',
        array( 'rev_id' ),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iccafbbdb06711463fee0f30a11326c7771df30e2
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Sn1per <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Sn1per <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to