Skip to content

Commit

Permalink
miraheze-backup: Backup mediawiki xml dumps to archive.org
Browse files Browse the repository at this point in the history
We don't want this to be backed up into our ovh backup as we already have sql backups. Instead back this up to archive.
  • Loading branch information
paladox authored Aug 4, 2023
1 parent a49cbeb commit 97cadb2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions modules/base/files/backups/archive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/python3

import argparse
import datetime
import internetarchive

parser = argparse.ArgumentParser(description='Archives files to archive.org')
parser.add_argument('--name', dest='name', help='Wiki name')
parser.add_argument('--file', dest='file_name', help='File to upload')
args = parser.parse_args()

item = internetarchive.get_item(f'miraheze-wikibackups-{args.name}-{date.day}{date.month}{date.year}')
date = datetime.date.today()
# metadata
md = {'title': f'miraheze-wikibackups-{args.name}-{date.day}{date.month}{date.year}', 'mediatype': 'web', 'subject': 'miraheze;wikiteam', 'date': date}
# upload
item.upload(args.file, metadata=md)

0 comments on commit 97cadb2

Please sign in to comment.