MediaWiki master
ApiClearHasMsg.php
Go to the documentation of this file.
1<?php
2
25
30class ApiClearHasMsg extends ApiBase {
31
32 private TalkPageNotificationManager $talkPageNotificationManager;
33
39 public function __construct(
40 ApiMain $main,
41 $action,
42 TalkPageNotificationManager $talkPageNotificationManager
43 ) {
44 parent::__construct( $main, $action );
45 $this->talkPageNotificationManager = $talkPageNotificationManager;
46 }
47
48 public function execute() {
49 $this->talkPageNotificationManager->removeUserHasNewMessages( $this->getUser() );
50
51 $this->getResult()->addValue( null, $this->getModuleName(), 'success' );
52 }
53
54 public function isWriteMode() {
55 return true;
56 }
57
58 public function mustBePosted() {
59 return true;
60 }
61
62 protected function getExamplesMessages() {
63 return [
64 'action=clearhasmsg'
65 => 'apihelp-clearhasmsg-example-1',
66 ];
67 }
68
69 public function getHelpUrls() {
70 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:ClearHasMsg';
71 }
72}
This abstract class implements many basic API functions, and is the base of all API classes.
Definition ApiBase.php:64
getResult()
Get the result object.
Definition ApiBase.php:680
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:541
API module that clears the hasmsg flag for current user.
mustBePosted()
Indicates whether this module must be called with a POST request.
getExamplesMessages()
Returns usage examples for this module.
isWriteMode()
Indicates whether this module requires write mode.
__construct(ApiMain $main, $action, TalkPageNotificationManager $talkPageNotificationManager)
getHelpUrls()
Return links to more detailed help pages about the module.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
This is the main API class, used for both external and internal processing.
Definition ApiMain.php:65