Manual:dumpUploads.php
Appearance
| MediaWiki version: | ≥ 1.8 |
| MediaWiki file: dumpUploads.php | |
|---|---|
| Location: | maintenance/ |
| Source code: | master • 1.44.2 • 1.43.5 • 1.39.15 |
| Classes: | UploadDumper |
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.
Options/Arguments
[edit]| Option | Description | Required? |
|---|---|---|
| --base | Set base relative path instead of wiki include root | Optional |
| --local | List all local files, used or not. No shared files included | Optional |
| --shared | Include images used from shared repository | Optional |
| --used | Skip local images that are not used | Optional |
Usage
[edit]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/run.php dumpUploads [ --base| --local| --shared| --used ]
In MediaWiki version 1.39.15 and earlier, you must invoke maintenance scripts using
php maintenance/scriptName.php instead of php maintenance/run.php scriptName.Generate a list of uploaded files:
Terminal
$ php maintenance/run.php dumpUploads images/e/eb/Screenshot_2022-03-11_at_3.58.12_PM.png images/a/a9/Screenshot_2022-03-11_at_3.58.05_PM.png images/9/98/Screenshot_2022-03-11_at_1.47.10_PM.png
Save all uploaded files to a tar file:
Terminal
$ php maintenance/run.php dumpUploads | tar cfT backup_files.tar -
Untaring or extracting to a directory:
Terminal
$ tar xzf backup_files.tar
This collection of files can then be imported into another wiki using the importImages.php maintenance script.
See also
[edit]- Manual:ImportImages.php - for importing images
- Manual:ImportDump.php - for importing pages
- Manual:DumpBackup.php - for exporting pages