Made UnwatchArticle, UnwatchArticleComplete, WatchArticle and WatchArticleComplete...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 6 Jan 2012 16:28:11 +0000 (16:28 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 6 Jan 2012 16:28:11 +0000 (16:28 +0000)
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.

docs/hooks.txt
includes/actions/WatchAction.php
includes/specials/SpecialEditWatchlist.php

index b5d0ad5..8302d2e 100644 (file)
@@ -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
index d72fff1..5cd2ce7 100644 (file)
@@ -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 );
index fa83b84..b10310e 100644 (file)
@@ -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 ) );
                        }
                }
        }