From c25c490677bcba2c2e9fee90db10594bd43f6982 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 5 Nov 2018 23:18:54 +0100 Subject: Importing Bitraf's mediawiki o Some improvements, reusing old backup scripts. --- ansible/roles/mediawiki/files/bin/mw-dump-db | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ansible/roles/mediawiki/files/bin/mw-dump-db (limited to 'ansible/roles/mediawiki/files/bin/mw-dump-db') diff --git a/ansible/roles/mediawiki/files/bin/mw-dump-db b/ansible/roles/mediawiki/files/bin/mw-dump-db new file mode 100644 index 0000000..5a6699a --- /dev/null +++ b/ansible/roles/mediawiki/files/bin/mw-dump-db @@ -0,0 +1,12 @@ +#!/bin/bash + +set -euo pipefail + +export PGHOST=$(sed -n 's,^.wgDBserver.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php) +export PGUDATABASE=$(sed -n 's,^.wgDBname.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php) +export PGUSER=$(sed -n 's,^.wgDBuser.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php) +export PGPASSWORD=$(sed -n 's,^.wgDBpassword.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php) +export PGPORT=$(sed -n 's,^.wgDBport.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php) + +rm -rf /opt/mediawiki/backup/db +exec pg_dump -b --format directory -f /opt/mediawiki/backup/db -- cgit v1.2.3