From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:DumpUploads.php and the translation is 31% complete.
Other languages:
English • ‎español • ‎polski • ‎português do Brasil • ‎日本語


dumpUploads.php file is a maintenance script which dumps a list of files uploaded to a wiki. It can be used to create a backup of all uploaded files on the wiki.


Generate a list of uploaded files:

php maintenance/dumpUploads.php

Save all uploaded files to a tar file:

php maintenance/dumpUploads.php | tar cfT backup_files.tar -
Uwaga Uwaga: You should nearly never use xargs with tar -c. Doing so runs the risk that xargs will run a second time with the same initial arguments, creating an archive that contains only the last few files that were intended. In the strict POSIX world, there is no good solution to this -- use cpio instead. With GNU tar (ie, Linux, FreeBSD), either use the T argument as above, or the A argument with xargs.

Copy to a temp directory, untar within that directory, and flatten sub-directories:

tar xcf backup_files.tar
find backup_files.tar -type f -exec cp {} . \;

This collection of files can then be imported into another wiki using the importImages.php maintenance script.


A list of available commands can be found inside dumpUploads.php, it is a generated list of uploaded files which can be fed to tar or similar. By default, outputs relative paths against the parent directory of $wgUploadDirectory .

php dumpUploads.php [--base|--conf|--dbpass|--dbuser|--globals|--help|--local|--memory-limit|--quiet|--server|--shared|--used|--wiki]

Generic maintenance parameters

Opcja/Parametr Opis
--help (-h) Display this help message
--quiet (-q) Whether to suppress non-error output
--conf Location of LocalSettings.php, if not default
--wiki For specifying the wiki ID
--globals Output globals at the end of processing for debugging
--memory-limit Set a specific memory limit for the script, "max" for no limit or "default" to avoid changing it
--server The protocol and server name to use in URLs, e.g. https://en.wikipedia.org. This is sometimes necessary because server name detection may fail in command line scripts.

Script dependant parameters

Opcja/Parametr Opis
--dbuser The DB user to use for this script
--dbpass The password to use for this script

Script specific parameters

Opcja/Parametr Opis
--base Set base relative path instead of wiki include root
--local List all local files, used or not. No shared files included
--shared Include images used from shared repository
--used Skip local images that are not used

Zobacz też