* Helper class for the --prefetch option of dumpTextPass.php
*
* Copyright © 2005 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* @ingroup Maintenance
*/
class BaseDump {
- var $reader = null;
- var $atEnd = false;
- var $atPageEnd = false;
- var $lastPage = 0;
- var $lastRev = 0;
- var $infiles = null;
+ protected $reader = null;
+ protected $atEnd = false;
+ protected $atPageEnd = false;
+ protected $lastPage = 0;
+ protected $lastRev = 0;
+ protected $infiles = null;
- function BaseDump( $infile ) {
+ public function __construct( $infile ) {
$this->infiles = explode( ';', $infile );
$this->reader = new XMLReader();
$infile = array_shift( $this->infiles );
* from the dump stream. May return null if the page is
* unavailable.
*
- * @param $page Integer: ID number of page to read
- * @param $rev Integer: ID number of revision to read
- * @return string or null
+ * @param int $page ID number of page to read
+ * @param int $rev ID number of revision to read
+ * @return string|null
*/
function prefetch( $page, $rev ) {
$page = intval( $page );
$this->nextPage();
}
if ( $this->lastPage > $page || $this->atEnd ) {
- $this->debug( "BaseDump::prefetch already past page $page looking for rev $rev [$this->lastPage, $this->lastRev]" );
+ $this->debug( "BaseDump::prefetch already past page $page "
+ . "looking for rev $rev [$this->lastPage, $this->lastRev]" );
return null;
}
while ( $this->lastRev < $rev && !$this->atEnd && !$this->atPageEnd ) {
- $this->debug( "BaseDump::prefetch at page $this->lastPage, rev $this->lastRev, looking for $page, $rev" );
+ $this->debug( "BaseDump::prefetch at page $this->lastPage, rev $this->lastRev, "
+ . "looking for $page, $rev" );
$this->nextRev();
}
if ( $this->lastRev == $rev && !$this->atEnd ) {
$this->debug( "BaseDump::prefetch hit on $page, $rev [$this->lastPage, $this->lastRev]" );
return $this->nextText();
} else {
- $this->debug( "BaseDump::prefetch already past rev $rev on page $page [$this->lastPage, $this->lastRev]" );
+ $this->debug( "BaseDump::prefetch already past rev $rev on page $page "
+ . "[$this->lastPage, $this->lastRev]" );
return null;
}
}
/**
* @access private
- * @param $name string
- * @param $parent string
+ * @param string $name
+ * @param string $parent
* @return bool|null
*/
function skipTo( $name, $parent = 'page' ) {
* Fetches text contents of the current element, assuming
* no sub-elements or such scary things.
*
- * @return String
+ * @return string
* @access private
*/
function nodeContents() {