51 $this->infiles = explode(
';', $infile );
52 $this->reader =
new XMLReader();
53 $infile = array_shift( $this->infiles );
54 if ( defined(
'LIBXML_PARSEHUGE' ) ) {
55 $this->reader->open( $infile,
null, LIBXML_PARSEHUGE );
57 $this->reader->open( $infile );
73 while ( $this->lastPage < $page && !$this->atEnd ) {
74 $this->
debug(
"BaseDump::prefetch at page $this->lastPage, looking for $page" );
77 if ( $this->lastPage >
$page || $this->atEnd ) {
78 $this->
debug(
"BaseDump::prefetch already past page $page "
79 .
"looking for rev $rev [$this->lastPage, $this->lastRev]" );
83 while ( $this->lastRev < $rev && !$this->atEnd && !$this->atPageEnd ) {
84 $this->
debug(
"BaseDump::prefetch at page $this->lastPage, rev $this->lastRev, "
85 .
"looking for $page, $rev" );
88 if ( $this->lastRev ==
$rev && !$this->atEnd ) {
89 $this->
debug(
"BaseDump::prefetch hit on $page, $rev [$this->lastPage, $this->lastRev]" );
93 $this->
debug(
"BaseDump::prefetch already past rev $rev on page $page "
94 .
"[$this->lastPage, $this->lastRev]" );
110 if ( $this->
skipTo(
'page',
'mediawiki' ) ) {
111 if ( $this->
skipTo(
'id' ) ) {
114 $this->atPageEnd =
false;
118 if (
count( $this->infiles ) ) {
119 $infile = array_shift( $this->infiles );
120 $this->reader->open( $infile );
121 $this->atEnd =
false;
130 if ( $this->
skipTo(
'revision' ) ) {
131 if ( $this->
skipTo(
'id' ) ) {
135 $this->atPageEnd =
true;
156 if ( $this->atEnd ) {
159 while ( $this->reader->read() ) {
160 if ( $this->reader->nodeType == XMLReader::ELEMENT
161 && $this->reader->name ==
$name
165 if ( $this->reader->nodeType == XMLReader::END_ELEMENT
166 && $this->reader->name == $parent
168 $this->
debug(
"BaseDump::skipTo found </$parent> searching for <$name>" );
174 return $this->
close();
186 if ( $this->atEnd ) {
189 if ( $this->reader->isEmptyElement ) {
193 while ( $this->reader->read() ) {
194 switch ( $this->reader->nodeType ) {
195 case XMLReader::TEXT:
197 case XMLReader::SIGNIFICANT_WHITESPACE:
198 $buffer .= $this->reader->value;
200 case XMLReader::END_ELEMENT:
205 return $this->
close();
213 $this->reader->close();