From: Alexandre Emsenhuber Date: Fri, 6 Jan 2012 16:28:11 +0000 (+0000) Subject: Made UnwatchArticle, UnwatchArticleComplete, WatchArticle and WatchArticleComplete... X-Git-Tag: 1.31.0-rc.0~25475 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=a0e6ccdb0709c53f9dbbf78b9f2916548185ffa3;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/docs/hooks.txt b/docs/hooks.txt index b5d0ad53b5..8302d2eaf4 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1964,15 +1964,11 @@ $article: article "acted on" 'UnwatchArticle': before a watch is removed from an article $user: user watching -$article: article object to be removed - -'UnwatchArticle': after a watch is removed from an article -$user: user that was watching -$article: article object removed +$page: WikiPage object to be removed 'UnwatchArticleComplete': after a watch is removed from an article $user: user that watched -$article: article object that was watched +$page: WikiPage object that was watched 'UploadForm:initial': before the upload form is generated $form: UploadForm object @@ -2220,11 +2216,11 @@ used to alter the SQL query which gets the list of wanted pages 'WatchArticle': before a watch is added to an article $user: user that will watch -$article: article object to be watched +$page: WikiPage object to be watched 'WatchArticleComplete': after a watch is added to an article $user: user that watched -$article: article object watched +$page: WikiPage object watched 'WatchlistEditorBuildRemoveLine': when building remove lines in Special:Watchlist/edit diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index d72fff1384..5cd2ce7d9e 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -83,7 +83,7 @@ class WatchAction extends FormAction { } public static function doWatch( Title $title, User $user ) { - $page = new Article( $title, 0 ); + $page = WikiPage::factory( $title ); if ( wfRunHooks( 'WatchArticle', array( &$user, &$page ) ) ) { $user->addWatch( $title ); @@ -93,7 +93,7 @@ class WatchAction extends FormAction { } public static function doUnwatch( Title $title, User $user ) { - $page = new Article( $title, 0 ); + $page = WikiPage::factory( $title ); if ( wfRunHooks( 'UnwatchArticle', array( &$user, &$page ) ) ) { $user->removeWatch( $title ); diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index fa83b84c84..b10310e16b 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -337,8 +337,8 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { ), __METHOD__ ); - $article = new Article( $title, 0 ); - wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$article ) ); + $page = WikiPage::factory( $title ); + wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$page ) ); } } }