Mediawiki maintenance

From wikinotes
Revision as of 13:58, 12 June 2022 by Will (talk | contribs)

Documentation

mediawiki static dump tools https://meta.wikimedia.org/wiki/Static_version_tools
mediawiki dumpBackup xml https://www.mediawiki.org/wiki/Manual:DumpBackup.php

Backups

Full Backups

To create a full backup, you'll need to:

Backup Database


mysqldump -u wiki -pPASSWORD wikidb > ~/wikidb-backup.sql

Backup Images

TODO

Backup LocalSettings.php

TODO

Static HTML

TODO:

See if there are newer options for static html dumps.

See page of mediawiki parsers here: http://www.mediawiki.org/wiki/Alternative_parsers

wget

Captures/correct links, but not as relative links for me. technically can capture CSS too.

wget --recursive \
     --page-requisites \
     --adjust-extension \
     --convert-links \
     --no-parent \
     -R "*Special*" \
     -R "Special*" \
     -R "*action=*" \
     -R "*printable=*" \
     -R "*oldid=*" \
     -R "*title=Talk:*" \
     -R "*limit=*" \
     "https://yourwiki.com"

Tools

mw2html
static-wiki

mw2html

Install

# Install htmldata
cd /home/will/dev  # Install htmldata to a location on $PYTHONPATH
curl -#O http://www.connellybarnes.com/code/htmldata/htmldata

# Install mw2html
cd $www/maintenance
git clone https://github.com/samuell/mw2html.git

Configuration


In order for the pythonscript to backup your wiki, it must have permission to read it. Confirm the following:

# $WIKIROOT/LocalSettings.php

$wgGroupPermissions['*']['read'] = true;

Perform Backup


python2 mw2html.py \
  http://127.0.0.1/index.php ~/mwexport \
  -f --no-flatten --no-hack-skin --no-remove-png

static-wiki

A tool designed to create a static-html copy of wikipedia, preserving search.

github https://github.com/segfall/static-wiki
static wikipedia http://static.wiki/

Zim

wget-2-zim bash script to scrape mediawiki to zimfile
zim-tools includes zimwriterfs which dumps mediawiki to zimfile
mwoffliner scrape a mediawiki to zimfile

Delete Revision History

cd /usr/local/www/mediawiki/maintenance
php deleteOldRevisions.php --delete