r25155 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25154‎ | r25155 | r25156 >
Date:11:56, 26 August 2007
Author:aaron
Status:old
Tags:
Comment:
*Fix broken hooks
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -669,11 +669,32 @@
670670 }
671671
672672 /**
673 - * Clears cache for a page when revisiondelete is used
 673+ * Clears cache for a page when delete is used
674674 */
675 - public static function articleLinksUpdate( $title, $a=null, $b=null ) {
 675+ public static function articleLinksUpdate( $article, $a=null, $b=null ) {
676676 global $wgUser, $wgParser;
677677
 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+
678699 $article = new Article( $title );
679700 // Update the links tables as the stable version may now be the default page...
680701 $parserCache =& ParserCache::singleton();
@@ -684,7 +705,7 @@
685706 # Might as well save the cache while we're at it
686707 $parserCache->save( $poutput, $article, $wgUser );
687708 }
688 - $u = new LinksUpdate( $title, $poutput );
 709+ $u = new LinksUpdate( $article->mTitle, $poutput );
689710 $u->doUpdate(); // this will trigger our hook to add stable links too...
690711
691712 return true;
@@ -1850,11 +1871,10 @@
18511872 $wgHooks['ArticleSaveComplete'][] = array($wgFlaggedArticle, 'autoPromoteUser');
18521873 # Adds table link references to include ones from the stable version
18531874 $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');
18591879 $wgHooks['ArticleMergeComplete'][] = array($wgFlaggedArticle, 'articleLinksUpdate');
18601880 # Update our table NS/Titles when things are moved
18611881 $wgHooks['SpecialMovepageAfterMove'][] = array($wgFlaggedArticle, 'updateFromMove');

Status & tagging log