This is the code behind User:Grammarbot. It is structured something like this:
cronjob (runs main.php every minute)
- main.php (checks if bot is active, then includes do.php)
-- do.php (parses article text, does text transformations, checks up
on articles it did earlier)
--- inc.php (sets up error handling and logging, sets edit summary,
replacement text etc)
---- inc_db.php (db login details)
---- inc_wiki.php (wiki functions and site details)
I also have curl.exe (although I may move to using the PHP Curl
library), cookieconf.txt (a config file for Curl), cookie.txt (the
actual cookie file by and for Curl, which of course is kept where it
won't be served to the public) and the public pages index.php,
stop.php, stuff.php. Also, some more text files which you can see at
stop.php, and logs.
The source of inc_wiki.php is available under GPL.
It includes the following functions:
gettext($title) takes the article text from Special:Export using an
XML parser, converts it to ISO-8859-1 if the charset for the wiki
isn't UTF-8 (as Special:Export is *always* in UTF-8), and returns it.
geteditpage($title) returns an array where $ar['text'] is the article
text and $ar['attr'] is the form variables (including wpEditToken) to
pass on to makeedit().
makeedit($title, $attr, $newtext) uses the $ar['attr'] you got from
geteditpage() to commit an edit.
That is all. It is a bit messy and you will have to uncomment and edit
a line in geteditpage() the first time you use it for it to login.
http://r3m0t.geniushost.net/cron/inc_wiki.txt
The other files in my bot are available if you email me.
Hello,
it seems that after the blackout an Apache rewrite rule that allowed
"short URLs" like this:
http://en.wikipedia.org/USA
instead of
http://en.wikipedia.org/wiki/USA
is now missing. Or maybe it depends on which particular Apache server you
hit. The first URL gives a 404.
Alfio
Hi,
I want to remove two links from the sidebar, and add a new link to a
sandbox. I have tried following the document
http://meta.wikimedia.org/wiki/Customization:Quickbar
I have been unable to remove links by removing them from the array I copied
into localSettings.php, and when I tried to add a new link, I couldn't enter
the link name and target. I tried defining the link in the languages.php
file but kept getting an error. I added the code specified in the document
into the relevant namespace section in the file, where the other links were
defined.
Also I want to add a Google link to my search option, beneath the text box,
does anyone have a document explaining how to do this?
And finally how can I create a link to generate a printable version of each
page?
Thanks in advance,
Alison
Hi, this is my first post, thank you for looking.
I have uploaded the wikimedia 1.3.11 installation files to my server and
chmodded my config directory to 777. I access my site:
http://www.paperheadache.com/
However, when I click the link to the config page I am taken to here:
http://www.paperheadache.com:2222/
I suppose this might not be much of a problem except that I am using
virtual web hosting and that latter address takes me to my DirectAdmin
site log-in.
Forgive me if this is an easy question, but I am at a loss how to
circumvent this or if I will not be able to use the Wikimedia installer.
I appreciate any insight.
I cannot access www.en.wikipedia.org, I know this isn't supposed to be the
right domain but I am sure many users make this mistake from time to time,
and it can easily be avoided by enabling some new dns aliases.
--
NSK
http://portal.wikinerds.org
Hi,
I am using MediaWiki 1.4 beta-6 and the monobook style sheet. I want to
remove the links Community portal and Current events, and add a google link
beneath the search box. I tried following the document
http://meta.wikimedia.org/wiki/Customization:Quickbar which tells you to
edit defaultsettings.php.
$wgNavigationLinks = array (
array( 'text'=>'mainpage', 'href'=>'mainpage' ),
array( 'text'=>'portal', 'href'=>'portal-url' ),
array( 'text'=>'currentevents', 'href'=>'currentevents-url' ),
array( 'text'=>'mylink', 'href'=>'mylink-url' ),
array( 'text'=>'help', 'href'=>'helppage' ),
array( 'text'=>'sitesupport', 'href'=>'sitesupport-url' )
);
I removed the links and saved and refreshed, but they have not been removed.
Any help is appreciated greatly...I am obviously changing the wrong file...
and also does anyone know how to add the Google link?
Thanks in advance,
Alison
I thought this would be a good forum to bring up some interaction
design problems with Wikipedia.
These are some of the problems I found as an active contributor who
also happens to be an interaction designer.
* Wikipedia shows only the last edit of an article in the watch
list. This leaves the writer no clue of the edits that took place from
his/her base lined version. (Base lined version will generally be the
user's last edit on the article.). Some kind of visualization
technique on all the edits only can give the writer a sense of the
course taken by the article. (I guess this is being discussed as LVR
in some of the recent threads.)
* Too many entries in watch list make it very difficult to clear
them on a day. Some kind of prioritization needs to be done...like
ignoring the minor edits...or flagging
o the articles which are more prone to vandalism or
o an article where some real interesting edits are happening or
o articles on which some of your trusted buddies are working on...
* When you work on more than a few articles, it is very natural
that you might find a same set of people working on those or similar
articles. Wikipedia could encourage collaboration by allowing me to
watch any articles edited by my buddies. (Of course, only if my buddy
agrees to it, which I would think he would, for it is a chance for
both of us to write a quality article.)
* When you start with an article, it is very probable that you
would be interested in editing related articles. e.g.: If you start
with Satyajit Ray, you might be interested in editing/reviewing the
articles for Bengali cinema, or Mrinal Sen or Italian Neo-realist
Cinema or the Apu Trilogy. One simple heuristic that could help meet
the similar goals would be to allow the user to watch all the articles
that link to a particular article or watch all the articles that have
been manually grouped as categories. The feature "Related Changes"
tries to do something similar, but lists the changes to the articles
listed only on your watch list.
I believe that encouraging people to collaborate better and giving
users better idea of how articles are changing over time would help
Wikipedia improve the quality of articles tremendously. These are not
just some _nice-to-have features_ but they'll become necessary as
Wikipedia grows in both size and popularity. With out controls like
the above, most of the articles will become just unmanageable as
people might giveup going thru their long watchlists paving the way to
spoilers.
--
Kesava Mallela
Interaction Designer
http://en.wikipedia.org/wiki/user:kaysov