3

We use MediaWiki hosted by ibiblio. We are not admins on the server, so we have limited access to the server (we are wiki sysops and Bureaucrats (or maybe Bureaucrats and Administrators)). I'm a little risk averse, so I'd like to backup the content in case something catastrophic happens.

The content we have uploaded includes "pages" (the stuff we create), and supporting files like PNGs and ZIPs (linked in the pages). The linked files were uploaded to the wiki; and they do not reside on an external site.

I'm looking for software so I can perform an external backup of the site. More defined requirements are:

  • Backup site with credentials
    • Discover site content (like crawling)
    • Download wiki mark'd-down pages
    • Download linked files (like PNGs and ZIPs)
    • Download descriptions (like those of PNGs and ZIPs)
  • Restore site with credentials
    • Create mark'd-down pages pages
    • Upload content of mark'd-down pages
    • Upload linked files (like PNGs and ZIPs)
    • Restore descriptions (like those of PNGs and ZIPs)

The software does not need to backup and restore the revision histories of the pages or linked files. Since the page content and linked files are valuable, that's all I am really concerned about.

The software does not need to backup and restore the user database. Since the page content and linked files are valuable, that's all I am really concerned about.

I would like a list of users and their level. But there's no need to perform the restore on them because we found so many users are transient over the years. That is, I'm willing to recreate power users, like Bureaucrats and Administrators, by hand if needed.

Finally, the backup can be un-encrypted. This is all public information, and there's no need to encrypt a backup.

Does such software exist? If so, what is it?

  • If the tool backups the wiki in the common way (XML files + uploaded files) so that it can be imported into a new installation of MediaWiki (manually, i.e., via FTP/SSH), would this be sufficient? Or is "Restore site with credentials" required to be handled automatically by the tool? – unor Apr 4 '15 at 23:34
  • What exactly do you mean with "credentials"? It’s not that you need a login to access the wiki, right? ("This is all public information") – unor Apr 4 '15 at 23:42
  • 1
    @unor - to see the wiki mark down, you need to be able to edit a page. To edit a page, you need an account. If you don't log-in, about all you can get is the HTML generated from the mark down. – user8414 Apr 5 '15 at 0:41
  • 2
    You don't need to edit the page to see the wikitext. As long as you have the read right, you can get it via action=raw or the API. – Tgr Apr 5 '15 at 9:33
  • Thanks @Tgr. I was not aware of that. Does everyone have the READ right by default? (Sorry, I'm not a wiki expert - I just use and manage it). – user8414 Apr 5 '15 at 18:36
1

Backup should be the responsibility of the site operator, so I'd say you are doing it wrong. That said, you can easily write your own backup script using the allpages API. E.g. a script using pywikibot would look something like this (not tested):

import urllib2
import pywikibot
from pywikibot import pagegenerators

site = pywikibot.Site()
for ns in site.namespaces():
    gen = pagegenerators.AllpagesPageGenerator(namespace=ns, site=site)
    for page in pagegenerators.PreloadingGenerator(gen, 100):
        with open('/tmp/wiki-backup/%s.wikitext' % page.title(), 'w') as f:
            f.write(page.text())
        if isinstance(page, pywikibot.FilePage):
            urllib.urlretrieve(page.fileUrl(), '/tmp/wiki-backup/%s' ! page.title())
  • "Backup should be the responsibility of the site operator, so I'd say you are doing it wrong" - well, that's one way to look at it. But if something catastrophic goes wrong, then I'm in a very bad position (when the fix is something as easy as keep my own copy in case something catastrophic happens). – user8414 Apr 5 '15 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy