r74189 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74188‎ | r74189 | r74190 >
Date:08:14, 3 October 2010
Author:ialex
Status:ok
Tags:
Comment:
Removed forward comapt code with 5.1.0+ and modified code to use the new version
Modified paths:
  • /trunk/phase3/maintenance/backupPrefetch.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/backupPrefetch.inc
@@ -6,44 +6,6 @@
77 * @ingrouo Maintenance
88 */
99
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 -
4810 /**
4911 * Readahead helper for making large MediaWiki data dumps;
5012 * reads in a previous XML dump to sequentially prefetch text
@@ -155,11 +117,11 @@
156118 return false;
157119 }
158120 while ( $this->reader->read() ) {
159 - if ( $this->reader->nodeType == XMLREADER_ELEMENT &&
 121+ if ( $this->reader->nodeType == XMLReader::ELEMENT &&
160122 $this->reader->name == $name ) {
161123 return true;
162124 }
163 - if ( $this->reader->nodeType == XMLREADER_END_ELEMENT &&
 125+ if ( $this->reader->nodeType == XMLReader::END_ELEMENT &&
164126 $this->reader->name == $parent ) {
165127 $this->debug( "BaseDump::skipTo found </$parent> searching for <$name>" );
166128 return false;
@@ -186,12 +148,12 @@
187149 $buffer = "";
188150 while ( $this->reader->read() ) {
189151 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:
193155 $buffer .= $this->reader->value;
194156 break;
195 - case XMLREADER_END_ELEMENT:
 157+ case XMLReader::END_ELEMENT:
196158 return $buffer;
197159 }
198160 }

Status & tagging log