Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -525,7 +525,7 @@ |
526 | 526 | return new FlaggedRevision( $row ); |
527 | 527 | } |
528 | 528 | |
529 | | - return NULL; |
| 529 | + return null; |
530 | 530 | } |
531 | 531 | |
532 | 532 | /** |
— | — | @@ -774,7 +774,7 @@ |
775 | 775 | wfProfileIn( __METHOD__ ); |
776 | 776 | # Make sure it is valid |
777 | 777 | if( !$article->getId() ) |
778 | | - return NULL; |
| 778 | + return null; |
779 | 779 | |
780 | 780 | $parserCache = ParserCache::singleton(); |
781 | 781 | $key = self::getCacheKey( $parserCache, $article, $wgUser ); |
— | — | @@ -828,13 +828,11 @@ |
829 | 829 | * @param parerOutput $parserOut |
830 | 830 | * Updates the stable cache of a page with the given $parserOut |
831 | 831 | */ |
832 | | - public static function updatePageCache( $article, $parserOut=NULL ) { |
| 832 | + public static function updatePageCache( $article, $parserOut=null ) { |
833 | 833 | global $wgUser, $parserMemc, $wgParserCacheExpireTime; |
834 | 834 | # Make sure it is valid |
835 | 835 | if( is_null($parserOut) || !$article ) |
836 | 836 | return false; |
837 | | - # Update the cache... |
838 | | - $article->getTitle()->invalidateCache(); |
839 | 837 | |
840 | 838 | $parserCache = ParserCache::singleton(); |
841 | 839 | $key = self::getCacheKey( $parserCache, $article, $wgUser ); |
— | — | @@ -852,8 +850,6 @@ |
853 | 851 | } |
854 | 852 | # Save to objectcache |
855 | 853 | $parserMemc->set( $key, $parserOut, $expire ); |
856 | | - # Purge squid for this page only |
857 | | - $article->getTitle()->purgeSquid(); |
858 | 854 | |
859 | 855 | return true; |
860 | 856 | } |
— | — | @@ -1144,16 +1140,18 @@ |
1145 | 1141 | return true; |
1146 | 1142 | # Get the either the full flagged revision text or the revision text |
1147 | 1143 | $article = new Article( $linksUpdate->mTitle ); |
1148 | | - if( $wgUseStableTemplates ) { |
1149 | | - $rev = Revision::newFromId( $sv->getRevId() ); |
1150 | | - $text = $rev->getText(); |
1151 | | - } else { |
1152 | | - $text = $sv->getText(); |
| 1144 | + # Try stable version cache. This should be updated before this is called. |
| 1145 | + $parserOut = self::getPageCache( $article ); |
| 1146 | + if( $parserOut==false ) { |
| 1147 | + if( $wgUseStableTemplates ) { |
| 1148 | + $rev = Revision::newFromId( $sv->getRevId() ); |
| 1149 | + $text = $rev->getText(); |
| 1150 | + } else { |
| 1151 | + $text = $sv->getText(); |
| 1152 | + } |
| 1153 | + # Parse the text |
| 1154 | + $parserOut = self::parseStableText( $article, $text, $sv->getRevId() ); |
1153 | 1155 | } |
1154 | | - # Parse the text |
1155 | | - $parserOut = self::parseStableText( $article, $text, $sv->getRevId() ); |
1156 | | - # Might as well update the stable cache while we're at it |
1157 | | - self::updatePageCache( $article, $parserOut ); |
1158 | 1156 | # Update page fields |
1159 | 1157 | self::updateArticleOn( $article, $sv->getRevId() ); |
1160 | 1158 | # Update the links tables to include these |
— | — | @@ -1390,8 +1388,8 @@ |
1391 | 1389 | $parser->mOutput->fr_newestImageTime = $maxTimestamp; |
1392 | 1390 | # Record the max template revision ID |
1393 | 1391 | if( !empty($parser->mOutput->mTemplateIds) ) { |
1394 | | - foreach( $parser->mOutput->mTemplateIds as $namespace => $title_rev ) { |
1395 | | - foreach( $title_rev as $title => $revID ) { |
| 1392 | + foreach( $parser->mOutput->mTemplateIds as $namespace => $DBkey_rev ) { |
| 1393 | + foreach( $DBkey_rev as $DBkey => $revID ) { |
1396 | 1394 | if( $revID > $maxRevision ) { |
1397 | 1395 | $maxRevision = $revID; |
1398 | 1396 | } |
— | — | @@ -1410,8 +1408,6 @@ |
1411 | 1409 | # Leave as defaults if missing. Relevant things will be updated only when needed. |
1412 | 1410 | # We don't want to go around resetting caches all over the place if avoidable... |
1413 | 1411 | $out->fr_ImageSHA1Keys = isset($parserOut->fr_ImageSHA1Keys) ? $parserOut->fr_ImageSHA1Keys : array(); |
1414 | | - $out->fr_newestImageTime = isset($parserOut->fr_newestImageTime) ? $parserOut->fr_newestImageTime : "0"; |
1415 | | - $out->fr_newestTemplateID = isset($parserOut->fr_newestTemplateID) ? $parserOut->fr_newestTemplateID : 0; |
1416 | 1412 | |
1417 | 1413 | return true; |
1418 | 1414 | } |
— | — | @@ -1560,7 +1556,7 @@ |
1561 | 1557 | * Get a selector of reviewable namespaces |
1562 | 1558 | * @param int $selected, namespace selected |
1563 | 1559 | */ |
1564 | | - public static function getNamespaceMenu( $selected=NULL ) { |
| 1560 | + public static function getNamespaceMenu( $selected=null ) { |
1565 | 1561 | global $wgContLang, $wgFlaggedRevsNamespaces; |
1566 | 1562 | |
1567 | 1563 | $selector = "<label for='namespace'>" . wfMsgHtml('namespace') . "</label>"; |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -886,11 +886,7 @@ |
887 | 887 | $extraq .= "oldid={$frev->getRevId()}&diff=cur&editreview=1"; |
888 | 888 | } else { |
889 | 889 | if( !is_null($frev) ){ |
890 | | - if( $wgUser->isAllowed('review') ) { |
891 | | - $extraq .= "stable=1"; |
892 | | - } else { |
893 | | - $extraq .= "stable=0"; |
894 | | - } |
| 890 | + $extraq .= "stable=0"; |
895 | 891 | } |
896 | 892 | } |
897 | 893 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -399,8 +399,10 @@ |
400 | 400 | $dbw->rollback(); // All versions must be specified, 0 for none |
401 | 401 | return false; |
402 | 402 | } |
| 403 | + |
| 404 | + $article = new Article( $this->page ); |
403 | 405 | # Check if the rest matches up |
404 | | - $stableOutput = FlaggedRevs::parseStableText( new Article( $rev->getTitle() ), $fulltext, $rev->getId() ); |
| 406 | + $stableOutput = FlaggedRevs::parseStableText( $article, $rev->getText(), $rev->getId() ); |
405 | 407 | if( !$stableOutput->fr_includesMatched ) { |
406 | 408 | $dbw->rollback(); // All versions must be specified, 0 for none |
407 | 409 | return false; |
— | — | @@ -443,6 +445,7 @@ |
444 | 446 | 'fr_text' => $fulltext, # Store expanded text for speed |
445 | 447 | 'fr_flags' => $textFlags |
446 | 448 | ); |
| 449 | + |
447 | 450 | # Update flagged revisions table |
448 | 451 | $dbw->replace( 'flaggedrevs', array( array('fr_page_id','fr_rev_id') ), $revset, __METHOD__ ); |
449 | 452 | # Mark as patrolled |
— | — | @@ -457,8 +460,8 @@ |
458 | 461 | # Update the article review log |
459 | 462 | $this->updateLog( $this->page, $this->dims, $this->comment, $this->oldid, true ); |
460 | 463 | |
461 | | - $article = new Article( $this->page ); |
462 | | - # Update the links tables as the stable version may now be the default page... |
| 464 | + # Update the links tables as the stable version may now be the default page. |
| 465 | + # Try using the parser cache first since we didn't actually edit the current version. |
463 | 466 | $parserCache = ParserCache::singleton(); |
464 | 467 | $poutput = $parserCache->get( $article, $wgUser ); |
465 | 468 | if( $poutput==false ) { |
— | — | @@ -467,15 +470,18 @@ |
468 | 471 | $options->setTidy(true); |
469 | 472 | $poutput = $wgParser->parse( $text, $article->mTitle, $options ); |
470 | 473 | } |
| 474 | + # Clear the cache... |
| 475 | + $this->page->invalidateCache(); |
| 476 | + # Might as well update the stable cache while we're at it |
| 477 | + FlaggedRevs::updatePageCache( $article, $stableOutput ); |
| 478 | + |
471 | 479 | $u = new LinksUpdate( $this->page, $poutput ); |
472 | 480 | $u->doUpdate(); // Will trigger our hook to add stable links too... |
473 | 481 | |
474 | | - # Clear the cache... |
475 | | - $this->page->invalidateCache(); |
476 | | - # Might as well save the cache |
| 482 | + # Might as well save the cache, since it should be the same |
477 | 483 | $parserCache->save( $poutput, $article, $wgUser ); |
478 | 484 | # Purge squid for this page only |
479 | | - $this->page->purgeSquid(); |
| 485 | + $article->getTitle()->purgeSquid(); |
480 | 486 | |
481 | 487 | return true; |
482 | 488 | } |