Manuel:FindOrphanedFiles.php
Fichier MediaWiki : findOrphanedFiles.php | |
---|---|
Emplacement : | maintenance/ |
Code source : | master • 1.42.3 • 1.41.4 • 1.39.10 |
Classes : | FindOrphanedFiles |
Détails
findOrphanedFiles.php est un script de maintenance qui cherche les fichiers non enregistrés dans la zone 'publique' du dépôt.
MediaWiki utilise le répertoire « image/ » pour les images publiques. Ce script cherche les images qui se trouvent dans le répertoire publique, et qui ne sont pas enregistrées dans la base de données.
Options
Option | Description | Obligatoire |
---|---|---|
--subdir | Only scan files in this subdirectory (for example: "a/a0") | optionnel |
--verbose | Mention file paths checked | optionnel |
Utilisation
php maintenance/findOrphanedFiles.php [ --verbose| --subdir ]
Exécution de base
Terminal
$ php maintenance/findOrphanedFiles.php README https://mediawikiexampledomain.com/w/images/c/c4/README .DS_Store https://mediawikiexampledomain.com/w/images/e/ed/.DS_Store Asdeer.jpeg https://mediawikiexampledomain.com/w/images/e/e4/Asdeer.jpeg .htaccess https://mediawikiexampledomain.com/w/images/8/80/.htaccess
Exécution de base verbeuse
Terminal
$ php maintenance/findOrphanedFiles.php --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://mediawikiexampledomain.com/w/images/c/c4/README .DS_Store https://mediawikiexampledomain.com/w/images/e/ed/.DS_Store Asdeer.jpeg https://mediawikiexampledomain.com/w/images/e/e4/Asdeer.jpeg .htaccess https://mediawikiexampledomain.com/w/images/8/80/.htaccess
Erreur courante
- 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.