Two network-wide tables on the base prefix ({base_prefix}lh_bsa_summary and {base_prefix}lh_bsa_usage, both names filterable), scoped per site by blog_id. Created and upgraded with dbDelta on init whenever the network option lh_block_and_shortcode_auditor_db_version differs from the code’s schema version (currently 1). Both are dropped on uninstall; everything in them can be regenerated by rescanning.
lh_bsa_summary
One row per site, tag type and tag: every registered tag plus every used tag that is not registered. Rewritten as a whole on each registry capture or count refresh.
| Column | Type | Notes |
|---|---|---|
| id | bigint unsigned | Primary key |
| blog_id | bigint unsigned | Site |
| tag_type | varchar(20) |
block or shortcode
|
| tag | varchar(191) | Block name or shortcode tag |
| is_registered | tinyint(1) | 1 if registered at the last capture |
| provider | varchar(191) |
plugin:slug, theme:slug, core, namespace:name or empty |
| usage_count | bigint unsigned | Total occurrences in content |
| object_count | bigint unsigned | Posts or widgets using it |
| scanned_at | datetime, GMT | When the row was written |
Keys: unique blog_tag (blog_id, tag_type, tag); blog_registered (blog_id, is_registered).
lh_bsa_usage
One row per site, object, tag type and tag. Keyed by tag type, not registration state, so a registry change only needs the summary rebuilt, never a content rescan. Rows for one object are deleted and reinserted on each scan; rows not rewritten during a full sweep are removed when it finishes.
| Column | Type | Notes |
|---|---|---|
| id | bigint unsigned | Primary key |
| blog_id | bigint unsigned | Site |
| tag_type | varchar(20) |
block or shortcode
|
| tag | varchar(191) | Block name or shortcode tag |
| object_type | varchar(20) |
post, or widget_{id_base}
|
| object_id | bigint unsigned | Post ID or widget number |
| object_subtype | varchar(64) | Post type or widget id_base |
| object_status | varchar(20) | Post status; empty for widgets |
| occurrences | int unsigned | Uses in that object |
| scanned_at | datetime, GMT | When the row was written |
Keys: unique object_tag (blog_id, object_type, object_id, tag_type, tag); blog_tag (blog_id, tag_type, tag).
Per-site options and transients
-
lh_block_and_shortcode_auditor_registry_signature,_registry_captured_at,_registry_requested: registry capture state. -
lh_block_and_shortcode_auditor_scanner_sweep_started,_scanner_sweep_completed(GMT),_scanner_scanner_version: sweep state. Clearing the scanner version forces a sweep on the site’s next request. -
lh_block_and_shortcode_auditor_scanner_sweep_token(since 0.1.13): random token for the current sweep, passed to every batch job. A batch whose token no longer matches exits, so a superseded sweep cannot race a new one. -
lh_block_and_shortcode_auditor_scanner_sweep_progress(since 0.1.17): array ofcursor(last post ID scanned),tokenandtime, written when a sweep starts and after every batch. The watchdog reads it to detect and resume a stalled sweep. - Transient
lh_block_and_shortcode_auditor_scanner_schedule_checked: throttles the daily-sweep schedule check to every 12 hours.
All are removed per site on uninstall, along with the plugin’s jobs in both Action Scheduler and WP-Cron.