r28005 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28004‎ | r28005 | r28006 >
Date:07:13, 1 December 2007
Author:tstarling
Status:old
Tags:
Comment:
Got rid of the $shallowFlags/$deepFlags split -- seemed like a good idea at the time but turns out to be useless. Best to kill it before some extension starts using expand() flags and b/c kicks in.
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3032,7 +3032,7 @@
30333033
30343034 $dom = $this->preprocessToDom( $text );
30353035 $flags = $argsOnly ? PPFrame::NO_TEMPLATES : 0;
3036 - $text = $frame->expand( $dom, 0, $flags );
 3036+ $text = $frame->expand( $dom, $flags );
30373037
30383038 wfProfileOut( $fname );
30393039 return $text;
@@ -3336,7 +3336,7 @@
33373337 # Just replace the arguments, not any double-brace items
33383338 # This is used for rendered interwiki transclusion
33393339 if ( $isDOM ) {
3340 - $text = $newFrame->expand( $text, 0, PPFrame::NO_TEMPLATES );
 3340+ $text = $newFrame->expand( $text, PPFrame::NO_TEMPLATES );
33413341 } else {
33423342 $text = $this->replaceVariables( $text, $newFrame, true );
33433343 }
@@ -3344,7 +3344,7 @@
33453345 $text = $frame->expand( $text );
33463346 }
33473347 } elseif ( $isDOM ) {
3348 - $text = $frame->expand( $text, 0, PPFrame::NO_TEMPLATES | PPFrame::NO_ARGS );
 3348+ $text = $frame->expand( $text, PPFrame::NO_TEMPLATES | PPFrame::NO_ARGS );
33493349 }
33503350
33513351 # Prune lower levels off the recursion check path
@@ -4972,7 +4972,7 @@
49734973 $curIndex++;
49744974 }
49754975 if ( $mode == 'replace' ) {
4976 - $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
 4976+ $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
49774977 }
49784978 $node = $node->nextSibling;
49794979 }
@@ -5000,7 +5000,7 @@
50015001 }
50025002 }
50035003 if ( $mode == 'get' ) {
5004 - $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
 5004+ $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
50055005 }
50065006 $node = $node->nextSibling;
50075007 } while ( $node );
@@ -5012,7 +5012,7 @@
50135013 // stripped by the editor, so we need both newlines to restore the paragraph gap
50145014 $outText .= $newText . "\n\n";
50155015 while ( $node ) {
5016 - $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
 5016+ $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
50175017 $node = $node->nextSibling;
50185018 }
50195019 }
@@ -5283,7 +5283,7 @@
52845284 * using the current context
52855285 * @param $root the node
52865286 */
5287 - function expand( $root, $shallowFlags = 0, $deepFlags = 0 ) {
 5287+ function expand( $root, $flags = 0 ) {
52885288 if ( is_string( $root ) ) {
52895289 return $root;
52905290 }
@@ -5293,17 +5293,16 @@
52945294 {
52955295 return $this->parser->insertStripItem( '<!-- node-count limit exceeded -->' );
52965296 }
5297 - $flags = $shallowFlags | $deepFlags;
52985297
52995298 if ( is_array( $root ) ) {
53005299 $s = '';
53015300 foreach ( $root as $node ) {
5302 - $s .= $this->expand( $node, 0, $deepFlags );
 5301+ $s .= $this->expand( $node, $flags );
53035302 }
53045303 } elseif ( $root instanceof DOMNodeList ) {
53055304 $s = '';
53065305 foreach ( $root as $node ) {
5307 - $s .= $this->expand( $node, 0, $deepFlags );
 5306+ $s .= $this->expand( $node, $flags );
53085307 }
53095308 } elseif ( $root instanceof DOMNode ) {
53105309 if ( $root->nodeType == XML_TEXT_NODE ) {
@@ -5315,7 +5314,7 @@
53165315 $title = $titles->item( 0 );
53175316 $parts = $xpath->query( 'part', $root );
53185317 if ( $flags & self::NO_TEMPLATES ) {
5319 - $s = '{{' . $this->implodeWithFlags( '|', 0, $deepFlags, $title, $parts ) . '}}';
 5318+ $s = '{{' . $this->implodeWithFlags( '|', $flags, $title, $parts ) . '}}';
53205319 } else {
53215320 $lineStart = $root->getAttribute( 'lineStart' );
53225321 $params = array(
@@ -5332,7 +5331,7 @@
53335332 $title = $titles->item( 0 );
53345333 $parts = $xpath->query( 'part', $root );
53355334 if ( $flags & self::NO_ARGS || $this->parser->ot['msg'] ) {
5336 - $s = '{{{' . $this->implode( '|', 0, $deepFlags, $title, $parts ) . '}}}';
 5335+ $s = '{{{' . $this->implode( '|', $flags, $title, $parts ) . '}}}';
53375336 } else {
53385337 $params = array( 'title' => $title, 'parts' => $parts, 'text' => 'FIXME' );
53395338 $s = $this->parser->argSubstitution( $params, $this );
@@ -5353,7 +5352,7 @@
53545353 $s = $this->parser->extensionSubstitution( $params, $this );
53555354 } elseif ( $root->nodeName == 'h' ) {
53565355 # Heading
5357 - $s = $this->expand( $root->childNodes, 0, $deepFlags );
 5356+ $s = $this->expand( $root->childNodes, $flags );
53585357
53595358 if ( $this->parser->ot['html'] ) {
53605359 # Insert heading index marker
@@ -5387,7 +5386,7 @@
53885387 if ( $node->nodeType == XML_TEXT_NODE ) {
53895388 $s .= $node->nodeValue;
53905389 } elseif ( $node->nodeType == XML_ELEMENT_NODE ) {
5391 - $s .= $this->expand( $node, 0, $deepFlags );
 5390+ $s .= $this->expand( $node, $flags );
53925391 }
53935392 }
53945393 }
@@ -5397,8 +5396,8 @@
53985397 return $s;
53995398 }
54005399
5401 - function implodeWithFlags( $sep, $shallowFlags, $deepFlags /*, ... */ ) {
5402 - $args = array_slice( func_get_args(), 3 );
 5400+ function implodeWithFlags( $sep, $flags /*, ... */ ) {
 5401+ $args = array_slice( func_get_args(), 2 );
54035402
54045403 $first = true;
54055404 $s = '';
@@ -5412,7 +5411,7 @@
54135412 } else {
54145413 $s .= $sep;
54155414 }
5416 - $s .= $this->expand( $node, $shallowFlags, $deepFlags );
 5415+ $s .= $this->expand( $node, $flags );
54175416 }
54185417 }
54195418 return $s;
@@ -5420,7 +5419,7 @@
54215420
54225421 function implode( $sep /*, ... */ ) {
54235422 $args = func_get_args();
5424 - $args = array_merge( array_slice( $args, 0, 1 ), array( 0, 0 ), array_slice( $args, 1 ) );
 5423+ $args = array_merge( array_slice( $args, 0, 1 ), array( 0 ), array_slice( $args, 1 ) );
54255424 return call_user_func_array( array( $this, 'implodeWithFlags' ), $args );
54265425 }
54275426

Status & tagging log