diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/api/ApiWatch.php | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/api/ApiWatch.php')
-rw-r--r-- | includes/api/ApiWatch.php | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index 27846ab7..fa382b3b 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -24,11 +24,6 @@ * @file */ -if ( !defined( 'MEDIAWIKI' ) ) { - // Eclipse helper - will be ignored in production - require_once( 'ApiBase.php' ); -} - /** * API module to allow users to watch a page * @@ -41,8 +36,8 @@ class ApiWatch extends ApiBase { } public function execute() { - global $wgUser; - if ( !$wgUser->isLoggedIn() ) { + $user = $this->getUser(); + if ( !$user->isLoggedIn() ) { $this->dieUsage( 'You must be logged-in to have a watchlist', 'notloggedin' ); } @@ -53,17 +48,16 @@ class ApiWatch extends ApiBase { $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); } - $article = new Article( $title, 0 ); $res = array( 'title' => $title->getPrefixedText() ); if ( $params['unwatch'] ) { $res['unwatched'] = ''; - $res['message'] = wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() ); - $success = WatchAction::doUnwatch( $title, $wgUser ); + $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock(); + $success = UnwatchAction::doUnwatch( $title, $user ); } else { $res['watched'] = ''; - $res['message'] = wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() ); - $success = UnwatchAction::doWatch( $title, $wgUser ); + $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock(); + $success = WatchAction::doWatch( $title, $user ); } if ( !$success ) { $this->dieUsageMsg( 'hookaborted' ); @@ -118,10 +112,10 @@ class ApiWatch extends ApiBase { ) ); } - protected function getExamples() { + public function getExamples() { return array( - 'api.php?action=watch&title=Main_Page', - 'api.php?action=watch&title=Main_Page&unwatch=', + 'api.php?action=watch&title=Main_Page' => 'Watch the page "Main Page"', + 'api.php?action=watch&title=Main_Page&unwatch=' => 'Unwatch the page "Main Page"', ); } |