From 8d7f00dad984cc9dc96fed37474f67fe8b2e6a71 Mon Sep 17 00:00:00 2001 From: Andrew H Date: Sat, 26 Dec 2015 03:49:48 +0000 Subject: [PATCH] Add --rootpage parameter to importDump.php The --rootpage parameter will import pages as subpages of a specified page. Bug: T72272 Change-Id: Ie026b091275668765ea06e947d45bed64354f2cb --- maintenance/importDump.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/maintenance/importDump.php b/maintenance/importDump.php index 6b7cfb6ac1..43e5060a84 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -68,6 +68,8 @@ TEXT; $this->addOption( 'namespaces', 'Import only the pages from namespaces belonging to the list of ' . 'pipe-separated namespace names or namespace indexes', false, true ); + $this->addOption( 'rootpage', 'Pages will be imported as subpages of the specified page', + false, true ); $this->addOption( 'dry-run', 'Parse dump without actually importing pages' ); $this->addOption( 'debug', 'Output extra verbose debug information' ); $this->addOption( 'uploads', 'Process file upload data if included (experimental)' ); @@ -285,6 +287,14 @@ TEXT; if ( $this->hasOption( 'no-updates' ) ) { $importer->setNoUpdates( true ); } + if ( $this->hasOption( 'rootpage' ) ) { + $statusRootPage = $importer->setTargetRootPage( $this->getOption( 'rootpage' ) ); + if ( !$statusRootPage->isGood() ) { + // Die here so that it doesn't print "Done!" + $this->error( $statusRootPage->getMessage()->text(), 1 ); + return false; + } + } $importer->setPageCallback( array( &$this, 'reportPage' ) ); $this->importCallback = $importer->setRevisionCallback( array( &$this, 'handleRevision' ) ); -- 2.20.1