Skip to the content
Documentation

exp:contentcheck

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

Content checks: build the reference index, list the unused assets and the broken relations below a node, list the missing files, scan the storage files (report only; --fix, --quarantine and --fix-permissions are a dry run unless --apply)

Usage

./console exp:contentcheck [options]
php bin/php/contentcheck.php [options]
./console exp:content-check [options]

Aliases

exp:content-check

Help

The output of ./console help exp:contentcheck (the script run with --help), without the standard options:

Usage: bin/php/contentcheck.php [OPTION]...
Content checks (report only; --fix, --quarantine and --fix-permissions are a dry run unless --apply)

./console exp:content-check --build-index           build the reference index (also the cronjob part contentcheck)
./console exp:content-check --unreferenced --node=2  the unused assets below node 2
./console exp:content-check --broken --node=2        the broken relations below node 2, and the layouts'
./console exp:content-check --why=123,456           what uses objects 123 and 456
./console exp:content-check --storage               scan the storage files: orphans and file problems
./console exp:content-check --storage --quarantine            which orphans would be quarantined
./console exp:content-check --storage --quarantine --apply    move them to the quarantine
./console exp:content-check --storage --fix-permissions [--apply]   set owner and mode of used files
./console exp:content-check --missing-files --node=2  files missing from the storage, stale image aliases
./console exp:content-check --missing-files --fix=regenerate   what regenerating would do
./console exp:content-check --fix=restore --items=123-4,125-2 --apply  restore two field versions
./console exp:content-check --fix=replace --items=123-4 --replace-with=photo.jpg --apply

--fix (regenerate, restore, replace, remove, review), --quarantine and --fix-permissions are the only
options that change anything, and only with --apply: without it they show the plan and change nothing.
--dry-run means the same as no --apply; --apply together with --dry-run is a usage error (exit 2).
Without --items --fix takes every finding of --missing-files.
The lists are those of the user given by --login (default admin): what that user may read.
Exit code: 0 nothing found, 1 something found, 2 error.


Options:
  --build-index         Build the reference index and keep it in the cache
  --unreferenced        List the unused assets below --node
  --broken              List the broken relations below --node (all pages) and in the layouts
  --missing-files       List the fields below --node whose files are missing, and images with missing or stale aliases
  --problems=VALUE      With --missing-files: missing,alias_missing,alias_stale,alias_absent (default: the first three)
  --versions=VALUE      With --missing-files: published,draft (default: both)
  --fix=VALUE           Resolve: regenerate, restore, replace, remove or review (the findings of --missing-files, or --items)
  --items=VALUE         With --fix: field versions as <attribute id>-<version>, separated by commas
  --replace-with=VALUE  With --fix=replace: the file put at the expected path (one item)
  --node=VALUE          The node the lists start from (default: content.ini [NodeSettings] RootNode)
  --why=VALUE           Object ids: say what uses each of them
  --login=VALUE         The user whose access the lists use (default admin)
  --json                One JSON object instead of the text
  --storage             Scan the storage files (all of it, in batches) and keep the result for the storage view
  --quarantine          With --storage: move the orphan files of the scan to the quarantine (each checked again)
  --fix-permissions     With --storage: set the expected owner and mode of used files with a wrong one
  --apply               With --fix, --quarantine or --fix-permissions: do it (the default is a dry run that shows the plan)
  --dry-run             The default, kept for scripts that pass it: show what would be done, change nothing

Options

Option Value Description
--build-index - Build the reference index and keep it in the cache
--unreferenced - List the unused assets below --node
--broken - List the broken relations below --node (all pages) and in the layouts
--missing-files - List the fields below --node whose files are missing, and images with missing or stale aliases
--problems required With --missing-files: missing,alias_missing,alias_stale,alias_absent (default: the first three)
--versions required With --missing-files: published,draft (default: both)
--fix required Resolve: regenerate, restore, replace, remove or review (the findings of --missing-files, or --items)
--items required With --fix: field versions as <attribute id>-<version>, separated by commas
--replace-with required With --fix=replace: the file put at the expected path (one item)
--node required The node the lists start from (default: content.ini [NodeSettings] RootNode)
--why required Object ids: say what uses each of them
--login required The user whose access the lists use (default admin)
--json - One JSON object instead of the text
--storage - Scan the storage files (all of it, in batches) and keep the result for the storage view
--quarantine - With --storage: move the orphan files of the scan to the quarantine (each checked again)
--fix-permissions - With --storage: set the expected owner and mode of used files with a wrong one
--apply - With --fix, --quarantine or --fix-permissions: do it (the default is a dry run that shows the plan)
--dry-run - The default, kept for scripts that pass it: show what would be done, change nothing

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/contentcheck.php, kernel/private/classes/commands/contentcheck.php

See also

Generated example: exp:contentcheck

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.