MediaWiki master
ApiClearHasMsg.php
Go to the documentation of this file.
1<?php
2
24namespace MediaWiki\Api;
25
27
32class ApiClearHasMsg extends ApiBase {
33
34 private TalkPageNotificationManager $talkPageNotificationManager;
35
36 public function __construct(
37 ApiMain $main,
38 string $action,
39 TalkPageNotificationManager $talkPageNotificationManager
40 ) {
41 parent::__construct( $main, $action );
42 $this->talkPageNotificationManager = $talkPageNotificationManager;
43 }
44
45 public function execute() {
46 $this->talkPageNotificationManager->removeUserHasNewMessages( $this->getUser() );
47
48 $this->getResult()->addValue( null, $this->getModuleName(), 'success' );
49 }
50
51 public function isWriteMode() {
52 return true;
53 }
54
55 public function mustBePosted() {
56 return true;
57 }
58
59 protected function getExamplesMessages() {
60 return [
61 'action=clearhasmsg'
62 => 'apihelp-clearhasmsg-example-1',
63 ];
64 }
65
66 public function getHelpUrls() {
67 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:ClearHasMsg';
68 }
69}
70
72class_alias( ApiClearHasMsg::class, 'ApiClearHasMsg' );
This abstract class implements many basic API functions, and is the base of all API classes.
Definition ApiBase.php:76
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:571
getResult()
Get the result object.
Definition ApiBase.php:710
API module that clears the hasmsg flag for current user.
getHelpUrls()
Return links to more detailed help pages about the module.
__construct(ApiMain $main, string $action, TalkPageNotificationManager $talkPageNotificationManager)
isWriteMode()
Indicates whether this module requires write access to the wiki.
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.
getExamplesMessages()
Returns usage examples for this module.
This is the main API class, used for both external and internal processing.
Definition ApiMain.php:78