public class PostDelete extends MWAction
To allow your bot to delete articles in your MediaWiki add the following line to your MediaWiki's
LocalSettings.php:
$wgEnableWriteAPI = true; $wgGroupPermissions['bot']['delete'] = true;
Delete an article with
String name = ... MediaWikiBot bot = ... Siteinfo si = bot.getSiteinfo(); Userinfo ui = bot.getUserinfo(); bot.performAction(new PostDelete(name, si, ui));
| Constructor and Description |
|---|
PostDelete(MediaWikiBot bot,
String title)
Constructs a new
PostDelete action. |
PostDelete(MediaWikiBot bot,
String title,
String reason)
Constructs a new
PostDelete action. |
| Modifier and Type | Method and Description |
|---|---|
protected org.jdom.Element |
getErrorElement(org.jdom.Element rootElement)
Determines if the given XML
Document contains an error message which then would printed
by the logger. |
HttpAction |
getNextMessage() |
String |
processReturningText(String s,
HttpAction hm)
Deals with the MediaWiki API's response by parsing the provided text.
|
createNsString, evaluateXpath, getRootElement, getRootElementWithError, hasMoreMessages, isSelfExecuter, processAllReturningText, setExceptionHandler, setHasMoreMessagespublic PostDelete(MediaWikiBot bot, String title)
PostDelete action.public PostDelete(MediaWikiBot bot, String title, String reason)
PostDelete action.bot - MediaWikiBottitle - the title of the page to deletereason - reason for the deletion (may be null)
in case of a precessing exception
in case of an action exceptionpublic String processReturningText(String s, HttpAction hm)
processReturningText in interface ReturningTextprocessReturningText in class MWActions - the answer to the most recently generated MediaWiki API requesthm - the requestor messageprotected org.jdom.Element getErrorElement(org.jdom.Element rootElement)
Document contains an error message which then would printed
by the logger.getErrorElement in class MWActionrootElement - XML Documentpublic HttpAction getNextMessage()
Copyright © 2013. All Rights Reserved.