I want to write PHP code for a MediaWiki I own (I have command-line + admin access) that:
% Checks if a given article exists, and creates it if not.
% Checks if a given section exists in an article, and creates it if not.
% Edits a given section in a given article.
I want the edit to be done just as if a user had gone in and edited the page: it should create a history entry, update all the appropriate tables, update the page in the cache, etc.
Can I use MediaWiki's PHP functions/libraries to do this?
I realize I can use wget/curl/lynx/elinks to do this, but was looking for something more "internal".
On a related note, does MediaWiki come w/ any maintenance tools? Examples:
% Auto-fix all double redirects (if X -> Y -> Z, just edit X to redirect directly to Z).
% Find all instances of certain words (eg, spam), and revert to the previous version of each page that contains those words (crude anti-vandalism tool). Delete pages where there is no previous version.
% For commonly misspelled articles, find all instances of [[wrong spelling]] and change them to [[correct spelling]] (redirecting "wrong spelling" to "right spelling" sort of works, but it still leaves the link misspelled on many pages)
I realize SQL queries can do some of this, but they won't update the history, won't handle caching issues properly, etc. I'm looking for something that works within MediaWiki's framework, not an outside hack.