https://www.mediawiki.org/wiki/Special:Code/MediaWiki/108252

Revision: 108252
Author:   ialex
Date:     2012-01-06 16:28:11 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
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
    trunk/phase3/includes/actions/WatchAction.php
    trunk/phase3/includes/specials/SpecialEditWatchlist.php

Modified: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt 2012-01-06 16:27:29 UTC (rev 108251)
+++ trunk/phase3/docs/hooks.txt 2012-01-06 16:28:11 UTC (rev 108252)
@@ -1964,15 +1964,11 @@
 
 'UnwatchArticle': before a watch is removed from an article
 $user: user watching
-$article: article object to be removed
+$page: WikiPage object to be removed
 
-'UnwatchArticle': after a watch is removed from an article
-$user: user that was watching
-$article: article object 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 @@
 
 '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

Modified: trunk/phase3/includes/actions/WatchAction.php
===================================================================
--- trunk/phase3/includes/actions/WatchAction.php       2012-01-06 16:27:29 UTC 
(rev 108251)
+++ trunk/phase3/includes/actions/WatchAction.php       2012-01-06 16:28:11 UTC 
(rev 108252)
@@ -83,7 +83,7 @@
        }
 
        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 @@
        }
 
        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 );

Modified: trunk/phase3/includes/specials/SpecialEditWatchlist.php
===================================================================
--- trunk/phase3/includes/specials/SpecialEditWatchlist.php     2012-01-06 
16:27:29 UTC (rev 108251)
+++ trunk/phase3/includes/specials/SpecialEditWatchlist.php     2012-01-06 
16:28:11 UTC (rev 108252)
@@ -337,8 +337,8 @@
                                        ),
                                        __METHOD__
                                );
-                               $article = new Article( $title, 0 );
-                               wfRunHooks( 'UnwatchArticleComplete', array( 
$this->getUser(), &$article ) );
+                               $page = WikiPage::factory( $title );
+                               wfRunHooks( 'UnwatchArticleComplete', array( 
$this->getUser(), &$page ) );
                        }
                }
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to