Add file orphaned command implementation #536
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello there!
This command is useful for maintaining the integrity of the Moodle database and file system.
This command helps administrators identify discrepancies between the Moodle
database (
mdl_files
table) and the physical file storage (moodledata/filedir
).It operates in two primary modes:
db
mode (default): Scans themdl_files
table and verifies that eachfile record corresponds to an existing physical file in the
filedir
. Itreports database entries for which the physical file is missing.
fs
mode: Scans themoodledata/filedir
directory and verifies thateach physical file has a corresponding record in the
mdl_files
table.It reports physical files that are not referenced in the database.
The output can be formatted as plain text, JSON, XML, or CSV, making it
easy to parse or use in other scripts. A summary of the total number and
size of orphaned files can also be displayed.
If file option is given all output will be redirected to the specified file.
Example 1: Check for DB entries missing from the filesystem (default mode).
Example 2: Check for filesystem entries missing from the DB.
Example 3: Output the results in JSON format to a file1 and show a summary.