MediaWiki REL1_35
ApiClearHasMsg.php
Go to the documentation of this file.
1<?php
2
25
30class 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}
This abstract class implements many basic API functions, and is the base of all API classes.
Definition ApiBase.php:52
getResult()
Get the result object.
Definition ApiBase.php:620
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:499
API module that clears the hasmsg flag for current user.
mustBePosted()
Indicates whether this module must be called with a POST request Stable to override.
getExamplesMessages()
Returns usage examples for this module.
isWriteMode()
Indicates whether this module requires write mode.
getHelpUrls()
Return links to more detailed help pages about the module.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getUser()
Stable to override.
MediaWikiServices is the service locator for the application scope of MediaWiki.