aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/mw-backend/files/bin/mw-dump-db
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-09-23 01:10:23 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-09-23 01:10:23 +0200
commit0a6da2506c38681f7138f3787c6f0dd20696ad0d (patch)
treeeb2546bacb079352adfee14a334a869ce1b714b6 /ansible/roles/mw-backend/files/bin/mw-dump-db
parent008bd2a99f9ca3012f939c08679f7ba418793c57 (diff)
downloadinfra-0a6da2506c38681f7138f3787c6f0dd20696ad0d.tar.gz
infra-0a6da2506c38681f7138f3787c6f0dd20696ad0d.tar.bz2
infra-0a6da2506c38681f7138f3787c6f0dd20696ad0d.tar.xz
infra-0a6da2506c38681f7138f3787c6f0dd20696ad0d.zip
o Adding back mw-backend role for mw.yml.
o Adding backup scripts for mediawiki. o Fixing broken Debian logo. o Adding .pdf as valid file updload type.
Diffstat (limited to 'ansible/roles/mw-backend/files/bin/mw-dump-db')
-rw-r--r--ansible/roles/mw-backend/files/bin/mw-dump-db11
1 files changed, 11 insertions, 0 deletions
diff --git a/ansible/roles/mw-backend/files/bin/mw-dump-db b/ansible/roles/mw-backend/files/bin/mw-dump-db
new file mode 100644
index 0000000..0a82059
--- /dev/null
+++ b/ansible/roles/mw-backend/files/bin/mw-dump-db
@@ -0,0 +1,11 @@
+#!/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)
+
+exec pg_dump -b --format directory -f /mediawiki-backup/db