MediaWiki  master
ApiClearHasMsg.php
Go to the documentation of this file.
1 <?php
2 
25 
30 class ApiClearHasMsg extends ApiBase {
31  public function execute() {
32  $user = $this->getUser();
33  MediaWikiServices::getInstance()
34  ->getTalkPageNotificationManager()
35  ->removeUserHasNewMessages( $user );
36 
37  $this->getResult()->addValue( null, $this->getModuleName(), 'success' );
38  }
39 
40  public function isWriteMode() {
41  return true;
42  }
43 
44  public function mustBePosted() {
45  return true;
46  }
47 
48  protected function getExamplesMessages() {
49  return [
50  'action=clearhasmsg'
51  => 'apihelp-clearhasmsg-example-1',
52  ];
53  }
54 
55  public function getHelpUrls() {
56  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:ClearHasMsg';
57  }
58 }
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:154
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:565
ApiClearHasMsg\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiClearHasMsg.php:31
ApiClearHasMsg\mustBePosted
mustBePosted()
Indicates whether this module must be called with a POST request Stable to override.
Definition: ApiClearHasMsg.php:44
ContextSource\getUser
getUser()
Stable to override.
Definition: ContextSource.php:131
ApiClearHasMsg
API module that clears the hasmsg flag for current user.
Definition: ApiClearHasMsg.php:30
ApiBase
This abstract class implements many basic API functions, and is the base of all API classes.
Definition: ApiBase.php:52
ApiClearHasMsg\isWriteMode
isWriteMode()
Indicates whether this module requires write mode.
Definition: ApiClearHasMsg.php:40
ApiClearHasMsg\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiClearHasMsg.php:48
ApiClearHasMsg\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiClearHasMsg.php:55
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:444