Index: trunk/phase3/includes/Import.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | * Creates an ImportXMLReader drawing from the source provided |
42 | 42 | */ |
43 | 43 | function __construct( $source ) { |
44 | | - $this->reader = new XMLReader2(); |
| 44 | + $this->reader = new XMLReader(); |
45 | 45 | |
46 | 46 | stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' ); |
47 | 47 | $id = UploadSourceAdapter::registerSource( $source ); |
— | — | @@ -281,7 +281,23 @@ |
282 | 282 | * @access private |
283 | 283 | */ |
284 | 284 | private function nodeContents() { |
285 | | - return $this->reader->nodeContents(); |
| 285 | + if( $this->reader->isEmptyElement ) { |
| 286 | + return ""; |
| 287 | + } |
| 288 | + $buffer = ""; |
| 289 | + while( $this->reader->read() ) { |
| 290 | + switch( $this->reader->nodeType ) { |
| 291 | + case XmlReader::TEXT: |
| 292 | + case XmlReader::SIGNIFICANT_WHITESPACE: |
| 293 | + $buffer .= $this->reader->value; |
| 294 | + break; |
| 295 | + case XmlReader::END_ELEMENT: |
| 296 | + return $buffer; |
| 297 | + } |
| 298 | + } |
| 299 | + |
| 300 | + $this->reader->close(); |
| 301 | + return ''; |
286 | 302 | } |
287 | 303 | |
288 | 304 | # -------------- |
— | — | @@ -344,7 +360,7 @@ |
345 | 361 | $tag = $this->reader->name; |
346 | 362 | $type = $this->reader->nodeType; |
347 | 363 | |
348 | | - if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', $this->reader ) ) { |
| 364 | + if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', $this ) ) { |
349 | 365 | // Do nothing |
350 | 366 | } elseif ( $tag == 'mediawiki' && $type == XmlReader::END_ELEMENT ) { |
351 | 367 | break; |
— | — | @@ -399,7 +415,7 @@ |
400 | 416 | $tag = $this->reader->name; |
401 | 417 | |
402 | 418 | if ( !wfRunHooks( 'ImportHandleLogItemXMLTag', |
403 | | - $this->reader, $logInfo ) ) { |
| 419 | + $this, $logInfo ) ) { |
404 | 420 | // Do nothing |
405 | 421 | } elseif ( in_array( $tag, $normalFields ) ) { |
406 | 422 | $logInfo[$tag] = $this->nodeContents(); |
— | — | @@ -459,7 +475,7 @@ |
460 | 476 | if ( $badTitle ) { |
461 | 477 | // The title is invalid, bail out of this page |
462 | 478 | $skip = true; |
463 | | - } elseif ( !wfRunHooks( 'ImportHandlePageXMLTag', array( $this->reader, |
| 479 | + } elseif ( !wfRunHooks( 'ImportHandlePageXMLTag', array( $this, |
464 | 480 | &$pageInfo ) ) ) { |
465 | 481 | // Do nothing |
466 | 482 | } elseif ( in_array( $tag, $normalFields ) ) { |
— | — | @@ -507,7 +523,7 @@ |
508 | 524 | |
509 | 525 | $tag = $this->reader->name; |
510 | 526 | |
511 | | - if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', $this->reader, |
| 527 | + if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', $this, |
512 | 528 | $pageInfo, $revisionInfo ) ) { |
513 | 529 | // Do nothing |
514 | 530 | } elseif ( in_array( $tag, $normalFields ) ) { |
— | — | @@ -568,7 +584,7 @@ |
569 | 585 | |
570 | 586 | $tag = $this->reader->name; |
571 | 587 | |
572 | | - if ( !wfRunHooks( 'ImportHandleUploadXMLTag', $this->reader, |
| 588 | + if ( !wfRunHooks( 'ImportHandleUploadXMLTag', $this, |
573 | 589 | $pageInfo ) ) { |
574 | 590 | // Do nothing |
575 | 591 | } elseif ( in_array( $tag, $normalFields ) ) { |