Backup MediaWiki MediaFiles

From PKC
Revision as of 13:03, 13 January 2022 by Benkoo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The most essential command is the following:

First, create a temporary working directory: mkdir /tmp/workingBackupMediaFiles It is common to have files not being dumped out, due to errors caused by escape characters in File names. This will be resolved in the future. You must first go to the proper directory, in the case of standard PKC configuration, you must make sure you launch the following command at this location /var/www/html:

php maintenance/dumpUploads.php \
   | sed 's~mwstore://local-backend/local-public~./images~' \
   | xargs cp -t /tmp/MediaFiles

Then, compress the file in a zip directory. zip -r ~/Mediafiles.zip /tmp/MediaFiles

Remember to remove the temporary files and its directory. rm -r /tmp/workingBackupMediaFiles


For more information: Reference the following Stack Overflow answer:

  1. Exporting and importing images in MediaWiki
  2. MediaWiki data backup
  3. MediaWiki Backup and Restore Bash Scripts