Skip to content
This repository has been archived by the owner on Nov 25, 2019. It is now read-only.

MediaWiki metadata does not always contain server; use base if so #9

Open
GreenReaper opened this issue May 15, 2011 · 4 comments
Open

Comments

@GreenReaper
Copy link

In wiki.py the server name is extracted from JSON metadata:

server = general_siteinfo['server']

However, in versions of MediaWiki prior to 1.16, the general metadata does not contain the name of the server as a variable. For example:

{"query":{"general":{"mainpage":"Huvudsida","base":"http:\/\/www.wikilurv.se\/wiki\/Huvudsida","sitename":"WikiLurv","generator":"MediaWiki 1.15.4","case":"first-letter","rights":"GNU Free Documentation License","lang":"sv","fallback8bitEncoding":"windows-1252","writeapi":"","timezone":"UTC","timeoffset":0}}}

The lack of this variable causes failure of the script.

A more robust approach is to extract the server name from base if server is not available.

server = general_siteinfo['server'] if 'server' in general_siteinfo else general_siteinfo['base'].split("/")[2]
@itkach
Copy link
Member

itkach commented May 26, 2011

Makes sense, why don't you fork, make the change and send me pull request

@GreenReaper
Copy link
Author

. . . because that would be silly, since you have it checked out already and can easily make a two-line change yourself? :-)

I'm not looking to become a regular contributor - I just needed this patch to support a site using MediaWiki 1.15.2, and wanted to pass it on in case it'd be useful to others.

@itkach
Copy link
Member

itkach commented May 26, 2011

The best way to pass it on is to make the change and share it the GitHub way. As simple as the change may be, now I need to locate exact place where it needs to be done and come up with the test data that triggers the problem - repeat the work that you have already done instead of just pulling (and reviewing the actual changeset along the way) - now that is rather silly, isn't it?

@GreenReaper
Copy link
Author

Seems like a sneaky way to get people to use GitHub! No thanks. I'll stick with my SVNs and tarballs. :-p It's not like I have the source checked out, anyway - I installed using pip and patched the file on the server when I found it didn't work.

The relevant dump is at http://dumps.wikifur.com/sv-latest-pages-meta-history.xml.7z

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants