*
* Created on Jan 4, 2008
*
- * Copyright © 2008 Yuri Astrakhan <Firstname><Lastname>@gmail.com,
+ * Copyright © 2008 Yuri Astrakhan "<Firstname><Lastname>@gmail.com",
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiBase.php' );
-}
-
/**
* API module to allow users to watch a page
*
$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() );
+ $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() );
+ $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock();
$success = WatchAction::doWatch( $title, $user );
}
if ( !$success ) {
ApiBase::PARAM_REQUIRED => true
),
'unwatch' => false,
- 'token' => null,
+ 'token' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => true
+ ),
);
}
);
}
+ public function getResultProperties() {
+ return array(
+ '' => array(
+ 'title' => 'string',
+ 'unwatched' => 'boolean',
+ 'watched' => 'boolean',
+ 'message' => 'string'
+ )
+ );
+ }
+
public function getDescription() {
return 'Add or remove a page from/to the current user\'s watchlist';
}
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"',
);
}
public function getHelpUrls() {
- return 'http://www.mediawiki.org/wiki/API:Watch';
+ return 'https://www.mediawiki.org/wiki/API:Watch';
}
public function getVersion() {