MediaWiki REL1_32
WikiExporter Class Reference
Collaboration diagram for WikiExporter:

Public Member Functions

 __construct ( $db, $history=self::CURRENT, $text=self::TEXT)
 
 allLogs ()
 
 allPages ()
 Dumps a series of page and revision records for all pages in the database, either including complete history or only the most recent version.
 
 closeStream ()
 
 logsByRange ( $start, $end)
 
 openStream ()
 
 pageByName ( $name)
 
 pageByTitle ( $title)
 
 pagesByName ( $names)
 
 pagesByRange ( $start, $end, $orderRevs)
 Dumps a series of page and revision records for those pages in the database falling within the page_id range given.
 
 revsByRange ( $start, $end)
 Dumps a series of page and revision records for those pages in the database with revisions falling within the rev_id range given.
 
 setOutputSink (&$sink)
 Set the DumpOutput or DumpFilter object which will receive various row objects and XML output for filtering.
 

Static Public Member Functions

static schemaVersion ()
 Returns the export schema version.
 

Public Attributes

string $author_list = ""
 
bool $dumpUploadFileContents = false
 
bool $dumpUploads = false
 
bool $list_authors = false
 Return distinct author list (when not returning full history)
 
DumpOutput $sink
 
int $text
 
const BATCH_SIZE = 50000
 
const CURRENT = 2
 
const FULL = 1
 
const LOGS = 8
 
const RANGE = 16
 
const STABLE = 4
 
const STUB = 1
 
const TEXT = 0
 

Protected Member Functions

 do_list_authors ( $cond)
 Generates the distinct list of authors of an article Not called by default (depends on $this->list_authors) Can be set by Special:Export when not exporting whole history.
 
 dumpFrom ( $cond='', $orderRevs=false)
 
 dumpLogs ( $cond)
 
 dumpPages ( $cond, $orderRevs)
 
 outputLogStream ( $resultset)
 
 outputPageStream ( $resultset, $lastRow)
 Runs through a query result set dumping page and revision records.
 

Detailed Description

Definition at line 36 of file WikiExporter.php.

Constructor & Destructor Documentation

◆ __construct()

WikiExporter::__construct (   $db,
  $history = self::CURRENT,
  $text = self::TEXT 
)
Parameters
IDatabase$db
int | array$historyOne of WikiExporter::FULL, WikiExporter::CURRENT, WikiExporter::RANGE or WikiExporter::STABLE, or an associative array:
  • offset: non-inclusive offset at which to start the query
  • limit: maximum number of rows to return
  • dir: "asc" or "desc" timestamp order
int$textOne of WikiExporter::TEXT or WikiExporter::STUB

Definition at line 83 of file WikiExporter.php.

References history, text, and writer.

Member Function Documentation

◆ allLogs()

WikiExporter::allLogs ( )

Definition at line 190 of file WikiExporter.php.

References dumpFrom().

◆ allPages()

WikiExporter::allPages ( )

Dumps a series of page and revision records for all pages in the database, either including complete history or only the most recent version.

Definition at line 117 of file WikiExporter.php.

References dumpFrom().

◆ closeStream()

WikiExporter::closeStream ( )

Definition at line 107 of file WikiExporter.php.

References $output, and writer.

◆ do_list_authors()

WikiExporter::do_list_authors (   $cond)
protected

Generates the distinct list of authors of an article Not called by default (depends on $this->list_authors) Can be set by Special:Export when not exporting whole history.

Parameters
array$cond

Definition at line 213 of file WikiExporter.php.

References $res, $revQuery, as, Revision\DELETED_USER, and Revision\getQueryInfo().

Referenced by dumpPages().

◆ dumpFrom()

WikiExporter::dumpFrom (   $cond = '',
  $orderRevs = false 
)
protected
Parameters
string$cond
bool$orderRevs
Exceptions
MWException
Exception

Definition at line 252 of file WikiExporter.php.

References dumpLogs(), dumpPages(), and history.

Referenced by allLogs(), allPages(), logsByRange(), pageByTitle(), pagesByRange(), and revsByRange().

◆ dumpLogs()

WikiExporter::dumpLogs (   $cond)
protected
Parameters
string$cond
Exceptions
Exception

Definition at line 264 of file WikiExporter.php.

References LogEventsList\getExcludeClause(), and outputLogStream().

Referenced by dumpFrom().

◆ dumpPages()

WikiExporter::dumpPages (   $cond,
  $orderRevs 
)
protected
Parameters
string$cond
bool$orderRevs
Exceptions
MWException
Exception

Definition at line 314 of file WikiExporter.php.

References $revQuery, $tables, $wgMultiContentRevisionSchemaMigrationStage, do_list_authors(), Revision\getQueryInfo(), history, outputPageStream(), SCHEMA_COMPAT_WRITE_OLD, and text.

Referenced by dumpFrom().

◆ logsByRange()

WikiExporter::logsByRange (   $start,
  $end 
)
Parameters
int$start
int$end

Definition at line 198 of file WikiExporter.php.

References dumpFrom().

◆ openStream()

WikiExporter::openStream ( )

Definition at line 102 of file WikiExporter.php.

References $output, and writer.

◆ outputLogStream()

WikiExporter::outputLogStream (   $resultset)
protected
Parameters
ResultWrapper$resultset
Returns
int the log_id value of the last item output, or null if none

Definition at line 492 of file WikiExporter.php.

References $output, as, and writer.

Referenced by dumpLogs().

◆ outputPageStream()

WikiExporter::outputPageStream (   $resultset,
  $lastRow 
)
protected

Runs through a query result set dumping page and revision records.

The result set should be sorted/grouped by page to avoid duplicate page records in the output.

Parameters
ResultWrapper$resultset
object$lastRowthe last row output from the previous call (or null if none)
Returns
object the last row processed

Definition at line 452 of file WikiExporter.php.

References $output, as, and writer.

Referenced by dumpPages().

◆ pageByName()

WikiExporter::pageByName (   $name)
Parameters
string$name
Exceptions
MWException

Definition at line 172 of file WikiExporter.php.

References $name, $title, and pageByTitle().

Referenced by pagesByName().

◆ pageByTitle()

WikiExporter::pageByTitle (   $title)
Parameters
Title$title

Definition at line 162 of file WikiExporter.php.

References $title, and dumpFrom().

Referenced by pageByName().

◆ pagesByName()

WikiExporter::pagesByName (   $names)
Parameters
array$names

Definition at line 184 of file WikiExporter.php.

References $name, as, and pageByName().

◆ pagesByRange()

WikiExporter::pagesByRange (   $start,
  $end,
  $orderRevs 
)

Dumps a series of page and revision records for those pages in the database falling within the page_id range given.

Parameters
int$startInclusive lower limit (this id is included)
int$endExclusive upper limit (this id is not included) If 0, no upper limit.
bool$orderRevsorder revisions within pages in ascending order

Definition at line 129 of file WikiExporter.php.

References dumpFrom().

◆ revsByRange()

WikiExporter::revsByRange (   $start,
  $end 
)

Dumps a series of page and revision records for those pages in the database with revisions falling within the rev_id range given.

Parameters
int$startInclusive lower limit (this id is included)
int$endExclusive upper limit (this id is not included) If 0, no upper limit.

Definition at line 151 of file WikiExporter.php.

References dumpFrom().

◆ schemaVersion()

static WikiExporter::schemaVersion ( )
static

Returns the export schema version.

Returns
string

Definition at line 70 of file WikiExporter.php.

◆ setOutputSink()

WikiExporter::setOutputSink ( $sink)

Set the DumpOutput or DumpFilter object which will receive various row objects and XML output for filtering.

Filters can be chained or used as callbacks.

Parameters
DumpOutput&$sink

Definition at line 98 of file WikiExporter.php.

Member Data Documentation

◆ $author_list

string WikiExporter::$author_list = ""

Definition at line 47 of file WikiExporter.php.

◆ $dumpUploadFileContents

bool WikiExporter::$dumpUploadFileContents = false

Definition at line 44 of file WikiExporter.php.

◆ $dumpUploads

bool WikiExporter::$dumpUploads = false

Definition at line 41 of file WikiExporter.php.

◆ $list_authors

bool WikiExporter::$list_authors = false

Return distinct author list (when not returning full history)

Definition at line 38 of file WikiExporter.php.

◆ $sink

DumpOutput WikiExporter::$sink

Definition at line 64 of file WikiExporter.php.

◆ $text

int WikiExporter::$text

Definition at line 61 of file WikiExporter.php.

◆ BATCH_SIZE

const WikiExporter::BATCH_SIZE = 50000

Definition at line 58 of file WikiExporter.php.

◆ CURRENT

const WikiExporter::CURRENT = 2

Definition at line 50 of file WikiExporter.php.

◆ FULL

const WikiExporter::FULL = 1

Definition at line 49 of file WikiExporter.php.

◆ LOGS

const WikiExporter::LOGS = 8

Definition at line 52 of file WikiExporter.php.

◆ RANGE

const WikiExporter::RANGE = 16

Definition at line 53 of file WikiExporter.php.

◆ STABLE

const WikiExporter::STABLE = 4

Definition at line 51 of file WikiExporter.php.

◆ STUB

const WikiExporter::STUB = 1

Definition at line 56 of file WikiExporter.php.

◆ TEXT

const WikiExporter::TEXT = 0

Definition at line 55 of file WikiExporter.php.


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