DumpIterator: Replace deprecated WikiRevision::setText()
Change-Id: I4646ce4890a89df34d3f8b6d055f9cedc9bda9fc
This commit is contained in:
parent
54acf8af11
commit
d4979d0c10
1 changed files with 8 additions and 4 deletions
|
|
@ -26,6 +26,8 @@
|
|||
* @ingroup Maintenance
|
||||
*/
|
||||
|
||||
use MediaWiki\Revision\SlotRecord;
|
||||
|
||||
require_once __DIR__ . '/Maintenance.php';
|
||||
|
||||
/**
|
||||
|
|
@ -55,12 +57,14 @@ abstract class DumpIterator extends Maintenance {
|
|||
$this->checkOptions();
|
||||
|
||||
if ( $this->hasOption( 'file' ) ) {
|
||||
$file = $this->getOption( 'file' );
|
||||
$revision = new WikiRevision( $this->getConfig() );
|
||||
$text = file_get_contents( $file );
|
||||
$title = Title::newFromText( rawurldecode( basename( $file, '.txt' ) ) );
|
||||
$revision->setTitle( $title );
|
||||
$content = ContentHandler::makeContent( $text, $title );
|
||||
$revision->setContent( SlotRecord::MAIN, $content );
|
||||
|
||||
$revision->setTitle( Title::newFromText(
|
||||
rawurldecode( basename( $this->getOption( 'file' ), '.txt' ) )
|
||||
) );
|
||||
$revision->setText( file_get_contents( $this->getOption( 'file' ) ) );
|
||||
$this->from = false;
|
||||
$this->handleRevision( $revision );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue