Manual:dumpUploads.php

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎polski • ‎português • ‎português do Brasil • ‎日本語

Details[edit]

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.

Example[edit]

Generate a list of uploaded files:

php maintenance/dumpUploads.php

Save all uploaded files to a tar file:

php maintenance/dumpUploads.php | xargs tar cf backup_files.tar

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.

Usage[edit]

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[edit]

Option/Parameter Description
--help (-h) Display this help message
--quiet (-q) Whether to supress 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. http://en.wikipedia.org. This is sometimes necessary because server name detection may fail in command line scripts.

Script dependant parameters[edit]

Option/Parameter Description
--dbuser The DB user to use for this script
--dbpass The password to use for this script

Script specific parameters[edit]

Option/Parameter Description
--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

See also[edit]