ApiClearHasMsg.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Created on August 26, 2014
  4. *
  5. * Copyright © 2014 Petr Bena (benapetr@gmail.com)
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. * http://www.gnu.org/copyleft/gpl.html
  21. *
  22. * @file
  23. */
  24. /**
  25. * API module that clears the hasmsg flag for current user
  26. * @ingroup API
  27. */
  28. class ApiClearHasMsg extends ApiBase {
  29. public function execute() {
  30. $user = $this->getUser();
  31. $user->setNewtalk( false );
  32. $this->getResult()->addValue( null, $this->getModuleName(), 'success' );
  33. }
  34. public function isWriteMode() {
  35. return true;
  36. }
  37. public function mustBePosted() {
  38. return true;
  39. }
  40. protected function getExamplesMessages() {
  41. return [
  42. 'action=clearhasmsg'
  43. => 'apihelp-clearhasmsg-example-1',
  44. ];
  45. }
  46. public function getHelpUrls() {
  47. return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:ClearHasMsg';
  48. }
  49. }