Python snippet to get Mediawiki/Wikipedia Recent Changes externally

Mediawiki allows one to send Recent Changes (RC) to a UDP port. The ip address is defined by the variable wgRC2UDPAddress, and the port by the variable wgRC2UDPPort. It’s a really good idea that it’s a UDP transfer, since there is no need for any ACK, so Mediawiki doesn’t block if there is nothing listening on that port. These parameters must be set in the LocalSettings.php file, like this, for example. $wgRC2UDPAddress = ''; $wgRC2UDPPort = 9390; I wrote a really simple python program (more a proof of concept) that receives the data, cleans it, and then prints it to stdout : #!/usr/bin/env python # -*- coding: utf-8 -*- # # vim:syntax=python:sw=4:ts=4:expandtab import SocketServer import re HOST,PORT = '', 9390 class MyUDPHandler(SocketServer.BaseRequestHandler): def handle(self): print re.sub(r'\x03\d{0,2}', '', self.request[0]) if __name__ == '__main__': server = SocketServer.UDPServer((HOST, PORT), MyUDPHandler) server.serve_forever() I plan to make it into a complete project that will send ...(Read More)

How to skip the useless “you are now logged in” page in Mediawiki

You installed Mediawiki some time ago, and now something bothers you: aren’t you tired of having an intermediate page named “Login successful” saying “You are now logged in to” before being allowed to go to the page you wanted to go? I am. I found there’s a hook that is called just when a user successfully logs on (UserLoginComplete), and even an extension named RedirectOnLogin that does the redirection for you, BUT to a fixed one. It seems the hook doesn’t give you the page you previously were before the login request. So to correct this, I just found a dirty hack. That means you’ll have to patch the source, meaning also that you’ll loose some flexibility when upgrading Mediawiki :-( Anyway, if you still want to do this, here is the magic stuff: Edit the file mediawiki/includes/specials/SpecialUserlogin.php and look for the function successfulLogin(). At the end of it, just ...(Read More)