Manual:FindOrphanedFiles.php/ja
MediaWiki ファイル: findOrphanedFiles.php | |
---|---|
場所: | maintenance/ |
ソース コード: | master • 1.44.0 • 1.43.3 • 1.39.13 |
クラス: | FindOrphanedFiles |
詳細
findOrphanedFiles.php is a maintenance script that finds unregistered files in the 'public' repo zone.
MediaWiki uses the directory defined by $wgUploadDirectory ("images/"
by default) to store uploaded files.
This script finds files that exist in the upload directory but that are not registered in the database.
オプション
オプション | 説明 | 必須かどうか |
---|---|---|
--subdir | Only scan files in this subdirectory (for example: "a/a0") | 省略可能 |
--verbose | Mention file paths checked | 省略可能 |
使用法
php maintenance/run.php findOrphanedFiles [ --verbose| --subdir ]
MediaWiki バージョン 1.39.13 以前では、メンテナンス スクリプトを
php maintenance/run.php スクリプト名
ではなく php maintenance/スクリプト名.php
を使用して実行する必要があります。Basic run
Terminal
$ php maintenance/run.php findOrphanedFiles README https://example.org/w/images/c/c4/README .DS_Store https://example.org/w/images/e/ed/.DS_Store Asdeer.jpeg https://example.org/w/images/e/e4/Asdeer.jpeg .htaccess https://example.org/w/images/8/80/.htaccess
Basic run with verbose
Terminal
$ php maintenance/run.php findOrphanedFiles --verbose Scanning files under mwstore://local-backend/local-public: Checking current file .DS_Store Checking current file 1631330937964.jpeg Checking current file README Checking current file Logo.jpg Checking current file .DS_Store Checking current file 1631330937964.jpeg Checking current file Asdeer.jpeg Checking current file Example_Main_Page.png Checking current file .htaccess README https://example.org/w/images/c/c4/README .DS_Store https://example.org/w/images/e/ed/.DS_Store Asdeer.jpeg https://example.org/w/images/e/e4/Asdeer.jpeg .htaccess https://example.org/w/images/8/80/.htaccess
よくあるエラー
- Local repo uses SHA-1 file storage names; aborting.
This script does not work if your local storage uses SHA-1 hashing.
- Could not get file listing.
This error occurs when the directory does not exist or the user running the script does not have permission to read the directory.
If directory does exist, check the file permissions. If you are a root user, you can run script with sudo.