r108252 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108251‎ | r108252 | r108253 >
Date:16:28, 6 January 2012
Author:ialex
Status:ok
Tags:backcompat 
Comment:
Made UnwatchArticle, UnwatchArticleComplete, WatchArticle and WatchArticleComplete pass a WikiPage object instead of Article.
There are two extensions (InterwikiIntegration and Syslog) that use these hooks and they don't Article-only methods so they won't break by this change.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/actions/WatchAction.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialEditWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1964,15 +1964,11 @@
19651965
19661966 'UnwatchArticle': before a watch is removed from an article
19671967 $user: user watching
1968 -$article: article object to be removed
 1968+$page: WikiPage object to be removed
19691969
1970 -'UnwatchArticle': after a watch is removed from an article
1971 -$user: user that was watching
1972 -$article: article object removed
1973 -
19741970 'UnwatchArticleComplete': after a watch is removed from an article
19751971 $user: user that watched
1976 -$article: article object that was watched
 1972+$page: WikiPage object that was watched
19771973
19781974 'UploadForm:initial': before the upload form is generated
19791975 $form: UploadForm object
@@ -2220,11 +2216,11 @@
22212217
22222218 'WatchArticle': before a watch is added to an article
22232219 $user: user that will watch
2224 -$article: article object to be watched
 2220+$page: WikiPage object to be watched
22252221
22262222 'WatchArticleComplete': after a watch is added to an article
22272223 $user: user that watched
2228 -$article: article object watched
 2224+$page: WikiPage object watched
22292225
22302226 'WatchlistEditorBuildRemoveLine': when building remove lines in
22312227 Special:Watchlist/edit
Index: trunk/phase3/includes/actions/WatchAction.php
@@ -83,7 +83,7 @@
8484 }
8585
8686 public static function doWatch( Title $title, User $user ) {
87 - $page = new Article( $title, 0 );
 87+ $page = WikiPage::factory( $title );
8888
8989 if ( wfRunHooks( 'WatchArticle', array( &$user, &$page ) ) ) {
9090 $user->addWatch( $title );
@@ -93,7 +93,7 @@
9494 }
9595
9696 public static function doUnwatch( Title $title, User $user ) {
97 - $page = new Article( $title, 0 );
 97+ $page = WikiPage::factory( $title );
9898
9999 if ( wfRunHooks( 'UnwatchArticle', array( &$user, &$page ) ) ) {
100100 $user->removeWatch( $title );
Index: trunk/phase3/includes/specials/SpecialEditWatchlist.php
@@ -337,8 +337,8 @@
338338 ),
339339 __METHOD__
340340 );
341 - $article = new Article( $title, 0 );
342 - wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$article ) );
 341+ $page = WikiPage::factory( $title );
 342+ wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$page ) );
343343 }
344344 }
345345 }

Status & tagging log