Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -669,11 +669,32 @@ |
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
673 | | - * Clears cache for a page when revisiondelete is used |
| 673 | + * Clears cache for a page when delete is used |
674 | 674 | */ |
675 | | - public static function articleLinksUpdate( $title, $a=null, $b=null ) { |
| 675 | + public static function articleLinksUpdate( $article, $a=null, $b=null ) { |
676 | 676 | global $wgUser, $wgParser; |
677 | 677 | |
| 678 | + // Update the links tables as the stable version may now be the default page... |
| 679 | + $parserCache =& ParserCache::singleton(); |
| 680 | + $poutput = $parserCache->get( $article, $wgUser ); |
| 681 | + if( $poutput==false ) { |
| 682 | + $text = $article->getContent(); |
| 683 | + $poutput = $wgParser->parse($text, $article->mTitle, ParserOptions::newFromUser($wgUser)); |
| 684 | + # Might as well save the cache while we're at it |
| 685 | + $parserCache->save( $poutput, $article, $wgUser ); |
| 686 | + } |
| 687 | + $u = new LinksUpdate( $article->mTitle, $poutput ); |
| 688 | + $u->doUpdate(); // this will trigger our hook to add stable links too... |
| 689 | + |
| 690 | + return true; |
| 691 | + } |
| 692 | + |
| 693 | + /** |
| 694 | + * Clears cache for a page when revisiondelete/undelete is used |
| 695 | + */ |
| 696 | + public static function articleLinksUpdate2( $title, $a=null, $b=null ) { |
| 697 | + global $wgUser, $wgParser; |
| 698 | + |
678 | 699 | $article = new Article( $title ); |
679 | 700 | // Update the links tables as the stable version may now be the default page... |
680 | 701 | $parserCache =& ParserCache::singleton(); |
— | — | @@ -684,7 +705,7 @@ |
685 | 706 | # Might as well save the cache while we're at it |
686 | 707 | $parserCache->save( $poutput, $article, $wgUser ); |
687 | 708 | } |
688 | | - $u = new LinksUpdate( $title, $poutput ); |
| 709 | + $u = new LinksUpdate( $article->mTitle, $poutput ); |
689 | 710 | $u->doUpdate(); // this will trigger our hook to add stable links too... |
690 | 711 | |
691 | 712 | return true; |
— | — | @@ -1850,11 +1871,10 @@ |
1851 | 1872 | $wgHooks['ArticleSaveComplete'][] = array($wgFlaggedArticle, 'autoPromoteUser'); |
1852 | 1873 | # Adds table link references to include ones from the stable version |
1853 | 1874 | $wgHooks['LinksUpdateConstructed'][] = array($wgFlaggedArticle, 'extraLinksUpdate'); |
1854 | | -# If a stable version is hidden, move to the next one if possible, and update things |
1855 | | -# Check on undelete/delete too |
1856 | | -$wgHooks['ArticleUndelete'][] = array($wgFlaggedArticle, 'articleLinksUpdate'); |
1857 | | -$wgHooks['ArticleDelete'][] = array($wgFlaggedArticle, 'articleLinksUpdate'); |
1858 | | -$wgHooks['ArticleRevisionVisiblityUpdates'][] = array($wgFlaggedArticle, 'articleLinksUpdate'); |
| 1875 | +# Check on undelete/delete/revisiondelete for changes to stable version |
| 1876 | +$wgHooks['ArticleDeleteComplete'][] = array($wgFlaggedArticle, 'articleLinksUpdate'); |
| 1877 | +$wgHooks['ArticleUndelete'][] = array($wgFlaggedArticle, 'articleLinksUpdate2'); |
| 1878 | +$wgHooks['ArticleRevisionVisiblitySet'][] = array($wgFlaggedArticle, 'articleLinksUpdate2'); |
1859 | 1879 | $wgHooks['ArticleMergeComplete'][] = array($wgFlaggedArticle, 'articleLinksUpdate'); |
1860 | 1880 | # Update our table NS/Titles when things are moved |
1861 | 1881 | $wgHooks['SpecialMovepageAfterMove'][] = array($wgFlaggedArticle, 'updateFromMove'); |