Manual:dumpUploads.php

From Linux Web Expert

<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.8
<translate> MediaWiki version:</translate>

Details

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.

Options/Arguments

Option Description Required?
--base Set base relative path instead of wiki include root <translate> Optional</translate>
--local List all local files, used or not. No shared files included <translate> Optional</translate>
--shared Include images used from shared repository <translate> Optional</translate>
--used Skip local images that are not used <translate> Optional</translate>

Usage

This generates list of uploaded files which can be fed to tar or similar. By default, outputs relative paths against the parent directory of $wgUploadDirectory .

php maintenance/dumpUploads.php [ --base| --local| --shared| --used ]

Generate a list of uploaded files:

Terminal

Save all uploaded files to a tar file:

Terminal
File:OOjs UI icon notice-destructive.svg <translate> Warning:</translate> 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.

Untaring or extracting to a directory:

Terminal

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

See also