r81449 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81448‎ | r81449 | r81450 >
Date:14:08, 3 February 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17: MFT r81437, r81446, r81447
Modified paths:
  • /branches/REL1_17/phase3/includes/Import.php (modified) (history)
  • /branches/REL1_17/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/includes/User.php
@@ -102,12 +102,15 @@
103103 'disableaccount',
104104 'edit',
105105 'editinterface',
106 - 'editusercssjs',
 106+ 'editusercssjs', #deprecated
 107+ 'editusercss',
 108+ 'edituserjs',
107109 'hideuser',
108110 'import',
109111 'importupload',
110112 'ipblock-exempt',
111113 'markbotedits',
 114+ 'mergehistory',
112115 'minoredit',
113116 'move',
114117 'movefile',
Index: branches/REL1_17/phase3/includes/Import.php
@@ -40,7 +40,7 @@
4141 * Creates an ImportXMLReader drawing from the source provided
4242 */
4343 function __construct( $source ) {
44 - $this->reader = new XMLReader2();
 44+ $this->reader = new XMLReader();
4545
4646 stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' );
4747 $id = UploadSourceAdapter::registerSource( $source );
@@ -281,7 +281,23 @@
282282 * @access private
283283 */
284284 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 '';
286302 }
287303
288304 # --------------
@@ -344,7 +360,7 @@
345361 $tag = $this->reader->name;
346362 $type = $this->reader->nodeType;
347363
348 - if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', $this->reader ) ) {
 364+ if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', $this ) ) {
349365 // Do nothing
350366 } elseif ( $tag == 'mediawiki' && $type == XmlReader::END_ELEMENT ) {
351367 break;
@@ -399,7 +415,7 @@
400416 $tag = $this->reader->name;
401417
402418 if ( !wfRunHooks( 'ImportHandleLogItemXMLTag',
403 - $this->reader, $logInfo ) ) {
 419+ $this, $logInfo ) ) {
404420 // Do nothing
405421 } elseif ( in_array( $tag, $normalFields ) ) {
406422 $logInfo[$tag] = $this->nodeContents();
@@ -459,7 +475,7 @@
460476 if ( $badTitle ) {
461477 // The title is invalid, bail out of this page
462478 $skip = true;
463 - } elseif ( !wfRunHooks( 'ImportHandlePageXMLTag', array( $this->reader,
 479+ } elseif ( !wfRunHooks( 'ImportHandlePageXMLTag', array( $this,
464480 &$pageInfo ) ) ) {
465481 // Do nothing
466482 } elseif ( in_array( $tag, $normalFields ) ) {
@@ -507,7 +523,7 @@
508524
509525 $tag = $this->reader->name;
510526
511 - if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', $this->reader,
 527+ if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', $this,
512528 $pageInfo, $revisionInfo ) ) {
513529 // Do nothing
514530 } elseif ( in_array( $tag, $normalFields ) ) {
@@ -568,7 +584,7 @@
569585
570586 $tag = $this->reader->name;
571587
572 - if ( !wfRunHooks( 'ImportHandleUploadXMLTag', $this->reader,
 588+ if ( !wfRunHooks( 'ImportHandleUploadXMLTag', $this,
573589 $pageInfo ) ) {
574590 // Do nothing
575591 } elseif ( in_array( $tag, $normalFields ) ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81437Kill the XMLReader2 class in response to Tim's code review comments on r68587werdna01:25, 3 February 2011
r81446Add editusercss and edituserjs rights to User::$mCoreRights. Pointed out by S...catrope13:20, 3 February 2011
r81447Followup r81446: and mergehistory toocatrope13:21, 3 February 2011

Status & tagging log