52 $this->infiles = explode(
';', $infile );
53 $this->reader =
new XMLReader();
55 $this->reader->open( $infile,
null, LIBXML_PARSEHUGE );
70 while ( $this->lastPage < $page && !$this->atEnd ) {
71 $this->
debug(
"BaseDump::prefetch at page $this->lastPage, looking for $page" );
74 if ( $this->lastPage > $page || $this->atEnd ) {
75 $this->
debug(
"BaseDump::prefetch already past page $page "
76 .
"looking for rev $rev [$this->lastPage, $this->lastRev]" );
80 while ( $this->lastRev < $rev && !$this->atEnd && !$this->atPageEnd ) {
81 $this->
debug(
"BaseDump::prefetch at page $this->lastPage, rev $this->lastRev, "
82 .
"looking for $page, $rev" );
85 if ( $this->lastRev ==
$rev && !$this->atEnd ) {
86 $this->
debug(
"BaseDump::prefetch hit on $page, $rev [$this->lastPage, $this->lastRev]" );
90 $this->
debug(
"BaseDump::prefetch already past rev $rev on page $page "
91 .
"[$this->lastPage, $this->lastRev]" );
107 if ( $this->
skipTo(
'page',
'mediawiki' ) ) {
108 if ( $this->
skipTo(
'id' ) ) {
111 $this->atPageEnd =
false;
115 if ( count( $this->infiles ) ) {
117 $this->reader->open( $infile );
118 $this->atEnd =
false;
127 if ( $this->
skipTo(
'revision' ) ) {
128 if ( $this->
skipTo(
'id' ) ) {
132 $this->atPageEnd =
true;
153 if ( $this->atEnd ) {
156 while ( $this->reader->read() ) {
157 if ( $this->reader->nodeType == XMLReader::ELEMENT
158 && $this->reader->name == $name
162 if ( $this->reader->nodeType == XMLReader::END_ELEMENT
163 && $this->reader->name ==
$parent
165 $this->
debug(
"BaseDump::skipTo found </$parent> searching for <$name>" );
171 return $this->
close();
183 if ( $this->atEnd ) {
186 if ( $this->reader->isEmptyElement ) {
190 while ( $this->reader->read() ) {
191 switch ( $this->reader->nodeType ) {
192 case XMLReader::TEXT:
194 case XMLReader::SIGNIFICANT_WHITESPACE:
195 $buffer .= $this->reader->value;
197 case XMLReader::END_ELEMENT:
202 return $this->
close();
210 $this->reader->close();
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Readahead helper for making large MediaWiki data dumps; reads in a previous XML dump to sequentially ...
nodeContents()
Shouldn't something like this be built-in to XMLReader? Fetches text contents of the current element,...
skipTo( $name, $parent='page')
prefetch( $page, $rev)
Attempts to fetch the text of a particular page revision from the dump stream.
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev