CLI Scripts

Command-line maintenance scripts

The module ships CLI-only scripts. They are guarded: requested over HTTP (the modules_v4 directory is inside the web root) they answer 403 instead of running.

ScriptPurposeNeeds a webtrees install + DB?
cli/build-link-index.php [--limit=N] [--tree=<id>] [--rebuild] [--flush]build/update the link index for the XREF overviewyes
cli/build-uid-index.php [--limit=N] [--tree=<id>] [--rebuild] [--flush] [--force]build/update the UID index for UID lookupyes
cli/refresh-wthb-toc.php [--all] [--lang=<list>] [--clear] [--force]refresh the WTHB table of contents cache (production)yes
test-text-tag-collector.phpstandalone unit tests for the text-tag collectorno
test-link-classifier.phpstandalone unit tests for the link classifier (incl. target extraction)no
test-uid-tag-collector.phpstandalone unit tests for the UID tag collectorno
test-uid-index-service.phpstandalone unit tests for the UID index serviceno
tests/smoke-text-tag-collector.php [limit]scan records containing enhanced links, print every captured valueyes
smoke-migration5.phpSQLite smoke test for Migration5 (UID index schema)yes
tests/p1-measure.php [--tree=<id>]read-only scaling measurement for the XREF overviewyes

Run them from the webtrees root with the same PHP version the instance runs on (webtrees requires PHP 8.3+):

php modules_v4/linkenhancer/tests/test-text-tag-collector.php
php modules_v4/linkenhancer/tests/smoke-text-tag-collector.php 10

Cron example (every 2 hours, 500 records per run):

15 */2 * * * cd /path/to/webtrees && php modules_v4/linkenhancer/cli/<name>.php --limit=500 >> /var/log/linkenhancer-<name>.log 2>&1