Index: trunk/phase3/maintenance/backupPrefetch.inc |
— | — | @@ -6,44 +6,6 @@ |
7 | 7 | * @ingrouo Maintenance |
8 | 8 | */ |
9 | 9 | |
10 | | -// Some smart guy removed XMLReader's global constants from PHP 5.1 |
11 | | -// and replaced them with class constants. Breaking source compatibility |
12 | | -// is SUPER awesome, and I love languages which do this constantly! |
13 | | -$xmlReaderConstants = array( |
14 | | - "NONE", |
15 | | - "ELEMENT", |
16 | | - "ATTRIBUTE", |
17 | | - "TEXT", |
18 | | - "CDATA", |
19 | | - "ENTITY_REF", |
20 | | - "ENTITY", |
21 | | - "PI", |
22 | | - "COMMENT", |
23 | | - "DOC", |
24 | | - "DOC_TYPE", |
25 | | - "DOC_FRAGMENT", |
26 | | - "NOTATION", |
27 | | - "WHITESPACE", |
28 | | - "SIGNIFICANT_WHITESPACE", |
29 | | - "END_ELEMENT", |
30 | | - "END_ENTITY", |
31 | | - "XML_DECLARATION", |
32 | | - "LOADDTD", |
33 | | - "DEFAULTATTRS", |
34 | | - "VALIDATE", |
35 | | - "SUBST_ENTITIES" ); |
36 | | -foreach ( $xmlReaderConstants as $name ) { |
37 | | - $fullName = "XMLREADER_$name"; |
38 | | - $newName = "XMLReader::$name"; |
39 | | - if ( !defined( $fullName ) ) { |
40 | | - if ( defined( $newName ) ) { |
41 | | - define( $fullName, constant( $newName ) ); |
42 | | - } else { |
43 | | - // broken or missing the extension... |
44 | | - } |
45 | | - } |
46 | | -} |
47 | | - |
48 | 10 | /** |
49 | 11 | * Readahead helper for making large MediaWiki data dumps; |
50 | 12 | * reads in a previous XML dump to sequentially prefetch text |
— | — | @@ -155,11 +117,11 @@ |
156 | 118 | return false; |
157 | 119 | } |
158 | 120 | while ( $this->reader->read() ) { |
159 | | - if ( $this->reader->nodeType == XMLREADER_ELEMENT && |
| 121 | + if ( $this->reader->nodeType == XMLReader::ELEMENT && |
160 | 122 | $this->reader->name == $name ) { |
161 | 123 | return true; |
162 | 124 | } |
163 | | - if ( $this->reader->nodeType == XMLREADER_END_ELEMENT && |
| 125 | + if ( $this->reader->nodeType == XMLReader::END_ELEMENT && |
164 | 126 | $this->reader->name == $parent ) { |
165 | 127 | $this->debug( "BaseDump::skipTo found </$parent> searching for <$name>" ); |
166 | 128 | return false; |
— | — | @@ -186,12 +148,12 @@ |
187 | 149 | $buffer = ""; |
188 | 150 | while ( $this->reader->read() ) { |
189 | 151 | switch( $this->reader->nodeType ) { |
190 | | - case XMLREADER_TEXT: |
191 | | -// case XMLREADER_WHITESPACE: |
192 | | - case XMLREADER_SIGNIFICANT_WHITESPACE: |
| 152 | + case XMLReader::TEXT: |
| 153 | +// case XMLReader::WHITESPACE: |
| 154 | + case XMLReader::SIGNIFICANT_WHITESPACE: |
193 | 155 | $buffer .= $this->reader->value; |
194 | 156 | break; |
195 | | - case XMLREADER_END_ELEMENT: |
| 157 | + case XMLReader::END_ELEMENT: |
196 | 158 | return $buffer; |
197 | 159 | } |
198 | 160 | } |