$params = $this->extractRequestParams();
- $continuationManager = new ApiContinuationManager( $this, array(), array() );
+ $continuationManager = new ApiContinuationManager( $this, [], [] );
$this->setContinuationManager( $continuationManager );
$pageSet = $this->getPageSet();
// title is still supported for backward compatibility
if ( !isset( $params['title'] ) ) {
$pageSet->execute();
- $res = $pageSet->getInvalidTitlesAndRevisions( array(
+ $res = $pageSet->getInvalidTitlesAndRevisions( [
'invalidTitles',
'special',
'missingIds',
'missingRevIds',
'interwikiTitles'
- ) );
+ ] );
foreach ( $pageSet->getMissingTitles() as $title ) {
$r = $this->watchTitle( $title, $user, $params );
if ( $extraParams ) {
$p = $this->getModulePrefix();
$this->dieUsage(
- "The parameter {$p}title can not be used with " . implode( ", ", $extraParams ),
+ "The parameter {$p}title can not be used with " . implode( ', ', $extraParams ),
'invalidparammix'
);
}
$title = Title::newFromText( $params['title'] );
if ( !$title || !$title->isWatchable() ) {
- $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
+ $this->dieUsageMsg( [ 'invalidtitle', $params['title'] ] );
}
$res = $this->watchTitle( $title, $user, $params, true );
}
$compatibilityMode = false
) {
if ( !$title->isWatchable() ) {
- return array( 'title' => $title->getPrefixedText(), 'watchable' => 0 );
+ return [ 'title' => $title->getPrefixedText(), 'watchable' => 0 ];
}
- $res = array( 'title' => $title->getPrefixedText() );
+ $res = [ 'title' => $title->getPrefixedText() ];
if ( $params['unwatch'] ) {
$status = UnwatchAction::doUnwatch( $title, $user );
$res['unwatched'] = $status->isOK();
if ( $status->isOK() ) {
- $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )
+ $msgKey = $title->isTalkPage() ? 'removedwatchtext-talk' : 'removedwatchtext';
+ $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() )
->title( $title )->parseAsBlock();
}
} else {
$status = WatchAction::doWatch( $title, $user );
$res['watched'] = $status->isOK();
if ( $status->isOK() ) {
- $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )
+ $msgKey = $title->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext';
+ $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() )
->title( $title )->parseAsBlock();
}
}
}
public function getAllowedParams( $flags = 0 ) {
- $result = array(
- 'title' => array(
+ $result = [
+ 'title' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_DEPRECATED => true
- ),
+ ],
'unwatch' => false,
- 'continue' => array(
+ 'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
- ),
- );
+ ],
+ ];
if ( $flags ) {
$result += $this->getPageSet()->getFinalParams( $flags );
}
}
protected function getExamplesMessages() {
- return array(
+ return [
'action=watch&titles=Main_Page&token=123ABC'
=> 'apihelp-watch-example-watch',
'action=watch&titles=Main_Page&unwatch=&token=123ABC'
=> 'apihelp-watch-example-unwatch',
'action=watch&generator=allpages&gapnamespace=0&token=123ABC'
=> 'apihelp-watch-example-generator',
- );
+ ];
}
public function getHelpUrls() {