Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -271,6 +271,7 @@ |
272 | 272 | $reqId = FlaggedRevs::getPrimeFlaggedRevId( $this->parent ); |
273 | 273 | } |
274 | 274 | if( $stableId && $reqId ) { |
| 275 | + # Treat requesting the stable version by ID as &stable=1 |
275 | 276 | if( $reqId != $stableId ) { |
276 | 277 | $frev = FlaggedRevision::newFromTitle( $this->parent->getTitle(), $reqId, FR_TEXT ); |
277 | 278 | $old = true; // old reviewed version requested by ID |
— | — | @@ -335,10 +336,10 @@ |
336 | 337 | // Looking at some specific old revision (&oldid=x) or if FlaggedRevs is not |
337 | 338 | // set to override given the relevant conditions (like &action=protect). |
338 | 339 | } elseif( !$stable && !$this->pageOverride() ) { |
339 | | - $this->showRegularVersion( $srev, $frev, $tag, $prot ); |
| 340 | + $this->showRegularVersion( $srev, $tag, $prot ); |
340 | 341 | // The relevant conditions are met to override the page with the stable version. |
341 | 342 | } else { |
342 | | - $this->showStableVersion( $srev, $frev, $tag, $prot ); |
| 343 | + $this->showStableVersion( $srev, $tag, $prot ); |
343 | 344 | $outputDone = true; # Tell MW that parser output is done |
344 | 345 | $pcache = false; |
345 | 346 | } |
— | — | @@ -361,32 +362,28 @@ |
362 | 363 | |
363 | 364 | /** |
364 | 365 | * @param $srev stable version |
365 | | - * @param $frev selected flagged revision |
366 | 366 | * @param $tag review box/bar info |
367 | 367 | * @param $prot protection notice |
368 | 368 | * Tag output function must be called by caller |
369 | 369 | * Parser cache control deferred to caller |
370 | 370 | */ |
371 | | - protected function showRegularVersion( $srev, $frev, &$tag, $prot ) { |
| 371 | + protected function showRegularVersion( $srev, &$tag, $prot ) { |
372 | 372 | 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 ); |
375 | 375 | # Get quality level |
376 | 376 | $quality = FlaggedRevs::isQuality( $flags ); |
377 | 377 | $pristine = FlaggedRevs::isPristine( $flags ); |
378 | 378 | $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 |
385 | 382 | $pending = ''; |
386 | 383 | # Give notice to newer users if an unreviewed edit was completed... |
387 | 384 | if( !$synced && $wgRequest->getVal('shownotice') && !$wgUser->isAllowed('review') ) { |
388 | 385 | $tooltip = wfMsgHtml('revreview-draft-title'); |
389 | 386 | $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); |
391 | 388 | $pending = "<div id='mw-reviewnotice' class='flaggedrevs_preview plainlinks'>$pending</div>"; |
392 | 389 | # Notice should always use subtitle |
393 | 390 | $this->reviewNotice = $pending; |
— | — | @@ -404,14 +401,14 @@ |
405 | 402 | $msg = $quality ? 'revreview-quick-quality-same' : 'revreview-quick-basic-same'; |
406 | 403 | $class = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
407 | 404 | $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 ); |
409 | 406 | } else { |
410 | 407 | $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 ); |
412 | 409 | } |
413 | 410 | $tooltip = wfMsgHtml($tooltip); |
414 | 411 | $msgHTML = "{$prot}<span class='{$class}' title=\"{$tooltip}\"></span>$msgHTML"; |
415 | | - $tag .= FlaggedRevsXML::prettyRatingBox( $frev, $msgHTML, $revsSince, |
| 412 | + $tag .= FlaggedRevsXML::prettyRatingBox( $srev, $msgHTML, $revsSince, |
416 | 413 | $synced, $synced, false ); |
417 | 414 | // Standard UI |
418 | 415 | } else { |
— | — | @@ -419,12 +416,12 @@ |
420 | 417 | $msg = $quality ? 'revreview-quality-same' : 'revreview-basic-same'; |
421 | 418 | $class = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
422 | 419 | $tooltip = $quality ? 'revreview-quality-title' : 'revreview-stable-title'; |
423 | | - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), |
| 420 | + $msgHTML = wfMsgExt( $msg, array('parseinline'), $srev->getRevId(), |
424 | 421 | $time, $revsSince ); |
425 | 422 | } else { |
426 | 423 | $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; |
427 | 424 | $msg .= ($revsSince == 0) ? '-i' : ''; |
428 | | - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), |
| 425 | + $msgHTML = wfMsgExt( $msg, array('parseinline'), $srev->getRevId(), |
429 | 426 | $time, $revsSince ); |
430 | 427 | } |
431 | 428 | $tooltip = wfMsgHtml($tooltip); |
— | — | @@ -499,32 +496,31 @@ |
500 | 497 | |
501 | 498 | /** |
502 | 499 | * @param $srev stable version |
503 | | - * @param $frev selected flagged revision |
504 | 500 | * @param $tag review box/bar info |
505 | 501 | * @param $prot protection notice |
506 | 502 | * Tag output function must be called by caller |
507 | 503 | * Parser cache control deferred to caller |
508 | 504 | */ |
509 | | - protected function showStableVersion( $srev, $frev, &$tag, $prot ) { |
| 505 | + protected function showStableVersion( $srev, &$tag, $prot ) { |
510 | 506 | 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 ); |
513 | 509 | # Set display revision ID |
514 | | - $wgOut->setRevisionId( $frev->getRevId() ); |
| 510 | + $wgOut->setRevisionId( $srev->getRevId() ); |
515 | 511 | # Get quality level |
516 | 512 | $quality = FlaggedRevs::isQuality( $flags ); |
517 | 513 | $pristine = FlaggedRevs::isPristine( $flags ); |
518 | 514 | # We will be looking at the reviewed revision... |
519 | | - $revsSince = FlaggedRevs::getRevCountSince( $this->parent, $frev->getRevId() ); |
| 515 | + $revsSince = FlaggedRevs::getRevCountSince( $this->parent, $srev->getRevId() ); |
520 | 516 | # Get parsed stable version |
521 | 517 | $parserOut = FlaggedRevs::getPageCache( $this->parent ); |
522 | 518 | 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() ); |
525 | 521 | # Update the stable version cache |
526 | 522 | FlaggedRevs::updatePageCache( $this->parent, $parserOut ); |
527 | 523 | } |
528 | | - $synced = FlaggedRevs::stableVersionIsSynced( $frev, $this->parent, $parserOut, null ); |
| 524 | + $synced = FlaggedRevs::stableVersionIsSynced( $srev, $this->parent, $parserOut, null ); |
529 | 525 | # Construct some tagging |
530 | 526 | if( !$wgOut->isPrintable() && !($this->lowProfileUI() && $synced) ) { |
531 | 527 | $class = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
— | — | @@ -536,8 +532,8 @@ |
537 | 533 | # uses messages 'revreview-quick-quality-same', 'revreview-quick-basic-same' |
538 | 534 | $msg = $synced ? "{$msg}-same" : $msg; |
539 | 535 | $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 ); |
542 | 538 | // Standard UI |
543 | 539 | } else { |
544 | 540 | $msg = $quality ? 'revreview-quality' : 'revreview-basic'; |
— | — | @@ -549,7 +545,7 @@ |
550 | 546 | $msg .= '-i'; |
551 | 547 | } |
552 | 548 | $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 ); |
554 | 550 | if( !empty($flags) ) { |
555 | 551 | $tag .= " " . FlaggedRevsXML::ratingToggle(); |
556 | 552 | $tag .= "<span id='mw-revisionratings' style='display:block;'><br/>" . |
— | — | @@ -558,7 +554,7 @@ |
559 | 555 | } |
560 | 556 | } |
561 | 557 | # Output HTML |
562 | | - $this->getReviewNotes( $frev ); |
| 558 | + $this->getReviewNotes( $srev ); |
563 | 559 | $wgOut->addParserOutput( $parserOut ); |
564 | 560 | } |
565 | 561 | |