On Jul 23, 2007, at 5:41 AM, Platonides wrote:
Kelly Jones wrote:
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 think using a mediawiki bot framework like pywikipedia would be easier.
I've found that the pywikipedia bots are too slow for doing large scale work... but obviously they work on Wikipedia, so perhaps it's just that my server can't handle the self-inflicted http load.
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).
There's a pywikipedia script to do that.
% 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.
run maintenance/cleanupSpam.php
% 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)
run pywikipedia to change the links.
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.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054