r56013 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56012‎ | r56013 | r56014 >
Date:03:43, 8 September 2009
Author:aaron
Status:ok
Tags:
Comment:
Remove some function param/var cruft
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -271,6 +271,7 @@
272272 $reqId = FlaggedRevs::getPrimeFlaggedRevId( $this->parent );
273273 }
274274 if( $stableId && $reqId ) {
 275+ # Treat requesting the stable version by ID as &stable=1
275276 if( $reqId != $stableId ) {
276277 $frev = FlaggedRevision::newFromTitle( $this->parent->getTitle(), $reqId, FR_TEXT );
277278 $old = true; // old reviewed version requested by ID
@@ -335,10 +336,10 @@
336337 // Looking at some specific old revision (&oldid=x) or if FlaggedRevs is not
337338 // set to override given the relevant conditions (like &action=protect).
338339 } elseif( !$stable && !$this->pageOverride() ) {
339 - $this->showRegularVersion( $srev, $frev, $tag, $prot );
 340+ $this->showRegularVersion( $srev, $tag, $prot );
340341 // The relevant conditions are met to override the page with the stable version.
341342 } else {
342 - $this->showStableVersion( $srev, $frev, $tag, $prot );
 343+ $this->showStableVersion( $srev, $tag, $prot );
343344 $outputDone = true; # Tell MW that parser output is done
344345 $pcache = false;
345346 }
@@ -361,32 +362,28 @@
362363
363364 /**
364365 * @param $srev stable version
365 - * @param $frev selected flagged revision
366366 * @param $tag review box/bar info
367367 * @param $prot protection notice
368368 * Tag output function must be called by caller
369369 * Parser cache control deferred to caller
370370 */
371 - protected function showRegularVersion( $srev, $frev, &$tag, $prot ) {
 371+ protected function showRegularVersion( $srev, &$tag, $prot ) {
372372 global $wgUser, $wgOut, $wgLang, $wgRequest;
373 - $flags = $frev->getTags();
374 - $time = $wgLang->date( $frev->getTimestamp(), true );
 373+ $flags = $srev->getTags();
 374+ $time = $wgLang->date( $srev->getTimestamp(), true );
375375 # Get quality level
376376 $quality = FlaggedRevs::isQuality( $flags );
377377 $pristine = FlaggedRevs::isPristine( $flags );
378378 $revsSince = FlaggedRevs::getRevCountSince( $this->parent, $srev->getRevId() );
379 - $synced = false;
380 - # We only care about syncing if not viewing an old stable version
381 - if( $srev->getRevId() == $frev->getRevId() ) {
382 - $synced = FlaggedRevs::stableVersionIsSynced( $frev, $this->parent );
383 - if( $synced ) $this->getReviewNotes( $frev ); // Still the same
384 - }
 379+ # Get stable version sync status
 380+ $synced = FlaggedRevs::stableVersionIsSynced( $srev, $this->parent );
 381+ if( $synced ) $this->getReviewNotes( $srev ); // Still the same
385382 $pending = '';
386383 # Give notice to newer users if an unreviewed edit was completed...
387384 if( !$synced && $wgRequest->getVal('shownotice') && !$wgUser->isAllowed('review') ) {
388385 $tooltip = wfMsgHtml('revreview-draft-title');
389386 $pending = "{$prot}<span class='fr-icon-current' title=\"{$tooltip}\"></span>" .
390 - wfMsgExt('revreview-edited',array('parseinline'),$frev->getRevId(),$revsSince);
 387+ wfMsgExt('revreview-edited',array('parseinline'),$srev->getRevId(),$revsSince);
391388 $pending = "<div id='mw-reviewnotice' class='flaggedrevs_preview plainlinks'>$pending</div>";
392389 # Notice should always use subtitle
393390 $this->reviewNotice = $pending;
@@ -404,14 +401,14 @@
405402 $msg = $quality ? 'revreview-quick-quality-same' : 'revreview-quick-basic-same';
406403 $class = $quality ? 'fr-icon-quality' : 'fr-icon-stable';
407404 $tooltip = $quality ? 'revreview-quality-title' : 'revreview-stable-title';
408 - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $revsSince );
 405+ $msgHTML = wfMsgExt( $msg, array('parseinline'), $srev->getRevId(), $revsSince );
409406 } else {
410407 $msg = $quality ? 'revreview-quick-see-quality' : 'revreview-quick-see-basic';
411 - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $revsSince );
 408+ $msgHTML = wfMsgExt( $msg, array('parseinline'), $srev->getRevId(), $revsSince );
412409 }
413410 $tooltip = wfMsgHtml($tooltip);
414411 $msgHTML = "{$prot}<span class='{$class}' title=\"{$tooltip}\"></span>$msgHTML";
415 - $tag .= FlaggedRevsXML::prettyRatingBox( $frev, $msgHTML, $revsSince,
 412+ $tag .= FlaggedRevsXML::prettyRatingBox( $srev, $msgHTML, $revsSince,
416413 $synced, $synced, false );
417414 // Standard UI
418415 } else {
@@ -419,12 +416,12 @@
420417 $msg = $quality ? 'revreview-quality-same' : 'revreview-basic-same';
421418 $class = $quality ? 'fr-icon-quality' : 'fr-icon-stable';
422419 $tooltip = $quality ? 'revreview-quality-title' : 'revreview-stable-title';
423 - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(),
 420+ $msgHTML = wfMsgExt( $msg, array('parseinline'), $srev->getRevId(),
424421 $time, $revsSince );
425422 } else {
426423 $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
427424 $msg .= ($revsSince == 0) ? '-i' : '';
428 - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(),
 425+ $msgHTML = wfMsgExt( $msg, array('parseinline'), $srev->getRevId(),
429426 $time, $revsSince );
430427 }
431428 $tooltip = wfMsgHtml($tooltip);
@@ -499,32 +496,31 @@
500497
501498 /**
502499 * @param $srev stable version
503 - * @param $frev selected flagged revision
504500 * @param $tag review box/bar info
505501 * @param $prot protection notice
506502 * Tag output function must be called by caller
507503 * Parser cache control deferred to caller
508504 */
509 - protected function showStableVersion( $srev, $frev, &$tag, $prot ) {
 505+ protected function showStableVersion( $srev, &$tag, $prot ) {
510506 global $wgOut, $wgLang;
511 - $flags = $frev->getTags();
512 - $time = $wgLang->date( $frev->getTimestamp(), true );
 507+ $flags = $srev->getTags();
 508+ $time = $wgLang->date( $srev->getTimestamp(), true );
513509 # Set display revision ID
514 - $wgOut->setRevisionId( $frev->getRevId() );
 510+ $wgOut->setRevisionId( $srev->getRevId() );
515511 # Get quality level
516512 $quality = FlaggedRevs::isQuality( $flags );
517513 $pristine = FlaggedRevs::isPristine( $flags );
518514 # We will be looking at the reviewed revision...
519 - $revsSince = FlaggedRevs::getRevCountSince( $this->parent, $frev->getRevId() );
 515+ $revsSince = FlaggedRevs::getRevCountSince( $this->parent, $srev->getRevId() );
520516 # Get parsed stable version
521517 $parserOut = FlaggedRevs::getPageCache( $this->parent );
522518 if( $parserOut == false ) {
523 - $text = $frev->getRevText();
524 - $parserOut = FlaggedRevs::parseStableText( $this->parent, $text, $frev->getRevId() );
 519+ $text = $srev->getRevText();
 520+ $parserOut = FlaggedRevs::parseStableText( $this->parent, $text, $srev->getRevId() );
525521 # Update the stable version cache
526522 FlaggedRevs::updatePageCache( $this->parent, $parserOut );
527523 }
528 - $synced = FlaggedRevs::stableVersionIsSynced( $frev, $this->parent, $parserOut, null );
 524+ $synced = FlaggedRevs::stableVersionIsSynced( $srev, $this->parent, $parserOut, null );
529525 # Construct some tagging
530526 if( !$wgOut->isPrintable() && !($this->lowProfileUI() && $synced) ) {
531527 $class = $quality ? 'fr-icon-quality' : 'fr-icon-stable';
@@ -536,8 +532,8 @@
537533 # uses messages 'revreview-quick-quality-same', 'revreview-quick-basic-same'
538534 $msg = $synced ? "{$msg}-same" : $msg;
539535 $html = "{$prot}<span class='{$class}' title=\"{$tooltip}\"></span>" .
540 - wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $revsSince );
541 - $tag = FlaggedRevsXML::prettyRatingBox( $frev, $html, $revsSince, true, $synced );
 536+ wfMsgExt( $msg, array('parseinline'), $srev->getRevId(), $revsSince );
 537+ $tag = FlaggedRevsXML::prettyRatingBox( $srev, $html, $revsSince, true, $synced );
542538 // Standard UI
543539 } else {
544540 $msg = $quality ? 'revreview-quality' : 'revreview-basic';
@@ -549,7 +545,7 @@
550546 $msg .= '-i';
551547 }
552548 $tag = "{$prot}<span class='{$class} plainlinks' title=\"{$tooltip}\"></span>" .
553 - wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince );
 549+ wfMsgExt( $msg, array('parseinline'), $srev->getRevId(), $time, $revsSince );
554550 if( !empty($flags) ) {
555551 $tag .= " " . FlaggedRevsXML::ratingToggle();
556552 $tag .= "<span id='mw-revisionratings' style='display:block;'><br/>" .
@@ -558,7 +554,7 @@
559555 }
560556 }
561557 # Output HTML
562 - $this->getReviewNotes( $frev );
 558+ $this->getReviewNotes( $srev );
563559 $wgOut->addParserOutput( $parserOut );
564560 }
565561

Status & tagging log