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

Change subject: Allow parallel conversion of LQT to Flow
......................................................................


Allow parallel conversion of LQT to Flow

Allows for a start & stop to be passed to the script, so
it can run more than once, simultaneously, for different
batches of pages.

Bug: T92425
Change-Id: I2036afb241c8e8874135b191647492379af15d02
---
M includes/Utils/PagesWithPropertyIterator.php
M maintenance/convertLqt.php
2 files changed, 35 insertions(+), 6 deletions(-)

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



diff --git a/includes/Utils/PagesWithPropertyIterator.php 
b/includes/Utils/PagesWithPropertyIterator.php
index 08139e1..c6cc33b 100644
--- a/includes/Utils/PagesWithPropertyIterator.php
+++ b/includes/Utils/PagesWithPropertyIterator.php
@@ -24,12 +24,30 @@
        protected $propName;
 
        /**
+        * Page id to start at (inclusive)
+        *
+        * @var int|null
+        */
+       protected $startId = null;
+
+       /**
+        * Page id to stop at (exclusive)
+        *
+        * @var int|null
+        */
+       protected $stopId = null;
+
+       /**
         * @param DatabaseBase $db
         * @param string $propName
+        * @param int|null $startId Page id to start at (inclusive)
+        * @param int|null $stopId Page id to stop at (exclusive)
         */
-       public function __construct( DatabaseBase $db, $propName ) {
+       public function __construct( DatabaseBase $db, $propName, $startId = 
null, $stopId = null ) {
                $this->db = $db;
                $this->propName = $propName;
+               $this->startId = $startId;
+               $this->stopId = $stopId;
        }
 
        /**
@@ -42,9 +60,16 @@
                        /* pk */ 'pp_page',
                        /* rows per batch */ 500
                );
-               $it->addConditions( array(
-                       'pp_propname' => $this->propName
-               ) );
+
+               $conditions = array( 'pp_propname' => $this->propName );
+               if ( $this->startId !== null ) {
+                       $conditions[] = 'pp_page >= ' . $this->db->addQuotes( 
$this->startId );
+               }
+               if ( $this->stopId !== null ) {
+                       $conditions[] = 'pp_page < ' . $this->db->addQuotes( 
$this->stopId );
+               }
+               $it->addConditions( $conditions );
+
                $it->addJoinConditions( array(
                        'page' => array( 'JOIN', 'pp_page=page_id' ),
                ) );
diff --git a/maintenance/convertLqt.php b/maintenance/convertLqt.php
index 9f41185..30d875f 100644
--- a/maintenance/convertLqt.php
+++ b/maintenance/convertLqt.php
@@ -24,6 +24,8 @@
                $this->addOption( 'logfile', 'File to read and store 
associations between imported items and their sources. This is required for the 
import to be idempotent.', true, true );
                $this->addOption( 'verbose', 'Report on import progress to 
stdout' );
                $this->addOption( 'debug', 'Include debug information with 
progress report' );
+               $this->addOption( 'startId', 'Page id to start importing at 
(inclusive)' );
+               $this->addOption( 'stopId', 'Page id to stop importing at 
(exclusive)' );
        }
 
        public function execute() {
@@ -57,12 +59,14 @@
                        $strategy
                );
 
+               $startId = $this->getOption( 'startId' );
+               $stopId = $this->getOption( 'stopId' );
+
                $logger->info( "Starting full wiki LQT conversion" );
-               $titles = new PagesWithPropertyIterator( $dbr, 
'use-liquid-threads' );
+               $titles = new PagesWithPropertyIterator( $dbr, 
'use-liquid-threads', $startId, $stopId );
                $converter->convert( $titles );
        }
 }
 
 $maintClass = "ConvertLqt";
 require_once ( RUN_MAINTENANCE_IF_MAIN );
-

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2036afb241c8e8874135b191647492379af15d02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to