MediaWiki master
MediaWiki\Export\BaseDump Class Reference

Readahead helper for making large MediaWiki data dumps; reads in a previous XML dump to sequentially prefetch text records already normalized and decompressed. More...

Collaboration diagram for MediaWiki\Export\BaseDump:

Public Member Functions

 __construct ( $infile)
 
 close ()
 
 prefetch ( $page, $rev, $slot=SlotRecord::MAIN)
 Attempts to fetch the text of a particular page revision from the dump stream.
 

Protected Member Functions

 debug ( $str)
 

Protected Attributes

bool $atEnd = false
 
bool $atPageEnd = false
 
string[] null $infiles = null
 
int $lastPage = 0
 
int $lastRev = 0
 
XMLReader null $reader = null
 

Detailed Description

Readahead helper for making large MediaWiki data dumps; reads in a previous XML dump to sequentially prefetch text records already normalized and decompressed.

This can save load on the external database servers, hopefully.

Assumes that dumps will be recorded in the canonical order:

  • ascending by page_id
  • ascending by rev_id within each page
  • text contents are immutable and should not change once recorded, so the previous dump is a reliable source

Definition at line 33 of file BaseDump.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Export\BaseDump::__construct ( $infile)
Parameters
string$infile

Definition at line 50 of file BaseDump.php.

References MediaWiki\Export\BaseDump\debug().

Member Function Documentation

◆ close()

MediaWiki\Export\BaseDump::close ( )
Returns
null

Definition at line 223 of file BaseDump.php.

◆ debug()

MediaWiki\Export\BaseDump::debug ( $str)
protected
Parameters
string$str

Definition at line 115 of file BaseDump.php.

References wfDebug().

Referenced by MediaWiki\Export\BaseDump\__construct(), and MediaWiki\Export\BaseDump\prefetch().

◆ prefetch()

MediaWiki\Export\BaseDump::prefetch ( $page,
$rev,
$slot = SlotRecord::MAIN )

Attempts to fetch the text of a particular page revision from the dump stream.

May return null if the page is unavailable.

Parameters
int$pageID number of page to read
int$revID number of revision to read
string$slotRole name of the slot to read
Returns
string|null

Definition at line 70 of file BaseDump.php.

References MediaWiki\Export\BaseDump\debug().

Member Data Documentation

◆ $atEnd

bool MediaWiki\Export\BaseDump::$atEnd = false
protected

Definition at line 37 of file BaseDump.php.

◆ $atPageEnd

bool MediaWiki\Export\BaseDump::$atPageEnd = false
protected

Definition at line 39 of file BaseDump.php.

◆ $infiles

string [] null MediaWiki\Export\BaseDump::$infiles = null
protected

Definition at line 45 of file BaseDump.php.

◆ $lastPage

int MediaWiki\Export\BaseDump::$lastPage = 0
protected

Definition at line 41 of file BaseDump.php.

◆ $lastRev

int MediaWiki\Export\BaseDump::$lastRev = 0
protected

Definition at line 43 of file BaseDump.php.

◆ $reader

XMLReader null MediaWiki\Export\BaseDump::$reader = null
protected

Definition at line 35 of file BaseDump.php.


The documentation for this class was generated from the following file: