Mediawiki maintenance: Difference between revisions

From wikinotes
(Created page with "= Backups = <blockquote> </blockquote><!-- Backups --> = Delete Revision History = <blockquote> <syntaxhighlight lang="bash"> cd /usr/local/www/mediawiki/maintenance php del...")
 
Line 1: Line 1:
= Backups =
= Backups =
<blockquote>
<blockquote>
== Full Backups ==
<blockquote>
To create a full backup, you'll need to:


{{ expand
| Backup Database
|
<source lang="bash">
mysqldump -u wiki -pPASSWORD wikidb > ~/wikidb-backup.sql
</source>
}}
{{expand
| Backup Images
|
TODO
}}
{{expand
| Backup LocalSettings.php
|
TODO
}}
</blockquote><!-- full backups -->
== Static HTML ==
<blockquote>
{{ TODO |
See if there are newer options for static html dumps.
}}
See page of mediawiki parsers here: http://www.mediawiki.org/wiki/Alternative_parsers
=== mwoffliner ===
<blockquote>
Can dump wiki to a zim file. Not optimal, I'd prefer to use my browser.
https://nuxx.net/blog/2020/06/23/archiving-mediawiki-with-mwoffliner-and-zimdump/
</blockquote><!-- mwoffliner -->
=== wget ===
<blockquote>
Captures/correct links, but not as relative links for me. technically can capture CSS too.
<source lang="bash">
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"
</source>
</blockquote><!-- wget -->
== mw2html ==
<blockquote>
{{ expand
| Install
|
<source lang="bash">
# 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
</source>
}}
{{ expand
| Configuration
|
In order for the pythonscript to backup your wiki, it must have permission
to read it. Confirm the following:
<source lang="php">
# $WIKIROOT/LocalSettings.php
$wgGroupPermissions['*']['read'] = true;
</source>
}}
{{ expand
| Perform Backup
|
<source lang="bash">
python2 mw2html.py \
  http://127.0.0.1/index.php ~/mwexport \
  -f --no-flatten --no-hack-skin --no-remove-png
</source>
}}
</blockquote><!-- mw2html -->
</blockquote><!-- static html backup -->
</blockquote><!-- Backups -->
</blockquote><!-- Backups -->



Revision as of 22:20, 12 July 2021

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

mwoffliner

Can dump wiki to a zim file. Not optimal, I'd prefer to use my browser.

https://nuxx.net/blog/2020/06/23/archiving-mediawiki-with-mwoffliner-and-zimdump/

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"

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

Delete Revision History

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