MediaWiki master
ApiClearHasMsg.php
Go to the documentation of this file.
1<?php
2
10namespace MediaWiki\Api;
11
13
18class ApiClearHasMsg extends ApiBase {
19
20 private TalkPageNotificationManager $talkPageNotificationManager;
21
22 public function __construct(
23 ApiMain $main,
24 string $action,
25 TalkPageNotificationManager $talkPageNotificationManager
26 ) {
27 parent::__construct( $main, $action );
28 $this->talkPageNotificationManager = $talkPageNotificationManager;
29 }
30
31 public function execute() {
32 $this->talkPageNotificationManager->removeUserHasNewMessages( $this->getUser() );
33
34 $this->getResult()->addValue( null, $this->getModuleName(), 'success' );
35 }
36
38 public function isWriteMode() {
39 return true;
40 }
41
43 public function mustBePosted() {
44 return true;
45 }
46
48 protected function getExamplesMessages() {
49 return [
50 'action=clearhasmsg'
51 => 'apihelp-clearhasmsg-example-1',
52 ];
53 }
54
56 public function getHelpUrls() {
57 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:ClearHasMsg';
58 }
59}
60
62class_alias( ApiClearHasMsg::class, 'ApiClearHasMsg' );
This abstract class implements many basic API functions, and is the base of all API classes.
Definition ApiBase.php:61
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:543
getResult()
Get the result object.
Definition ApiBase.php:682
API module that clears the hasmsg flag for current user.
getHelpUrls()
Return links to more detailed help pages about the module.1.25, returning boolean false is deprecated...
__construct(ApiMain $main, string $action, TalkPageNotificationManager $talkPageNotificationManager)
isWriteMode()
Indicates whether this module requires write access to the wiki.API modules must override this method...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
mustBePosted()
Indicates whether this module must be called with a POST request.Implementations of this method must ...
getExamplesMessages()
Returns usage examples for this module.Return value has query strings as keys, with values being eith...
This is the main API class, used for both external and internal processing.
Definition ApiMain.php:66