Stored data
- Post meta on each attachment:
_lh_disk_usage_bytes(original plus variants) and_lh_disk_usage_original_bytes, rewritten whenever the attachment’s metadata is saved. Both keys are filterable. - Option
lh_disk_usage_backfill_doneon each site, set (to a GMT time) once every attachment has been measured. - Network table
{base_prefix}lh_disk_usage_snapshotson the main site: one row per install scan with its root, depth, driver, completeness, total and a JSON payload of the tree and large files. The newest 20 are kept. Its schema is tracked by the network optionlh_disk_usage_snapshots_schema_version. - Network options
lh_disk_usage_site_storage(each site’s latest measurement) andlh_disk_usage_measure_cursor(where an unfinished pass resumes), and the network transientlh_disk_usage_legacy_meta_count. - Site totals are cached in the object cache group
lh_disk_usagefor an hour and cleared whenever an attachment is measured or deleted.
Cron
lh_disk_usage_backfill: single events on each site, scheduled fromadmin_inituntil the backfill is done, measuring 100 unmeasured attachments every 30 seconds.lh_disk_usage_measure_sites: daily on the main site, measuring sites until the 20-second budget has passed between sites; an unfinished pass reschedules itself a minute later with the argumentcontinue.
Filters
lh_disk_usage_init_plugin: return false to stop the plugin loading.lh_disk_usage_return_capability(defaultmanage_options) andlh_disk_usage_return_network_capability(defaultinstall_plugins).lh_disk_usage_calculate: the measurement of one attachment, with the attachment ID and metadata.lh_disk_usage_return_total_meta_key,lh_disk_usage_return_original_meta_key,lh_disk_usage_return_backfill_batch_size(100).lh_disk_usage_use_shell(true): return false to always use the PHP driver.lh_disk_usage_return_shell_time_budget(240 seconds per du or find command, always held 30 seconds under PHP’smax_execution_time) andlh_disk_usage_return_time_budget(20 seconds, for the PHP walk and between sites).lh_disk_usage_return_max_depth(4),lh_disk_usage_return_max_children(30 per directory),lh_disk_usage_return_large_file_bytes(10 MB),lh_disk_usage_return_large_file_limit(50).lh_disk_usage_return_allowed_roots: the directories a scan can start from, as key => path. Every path is still checked to be inside the install.lh_disk_usage_return_snapshots_keep(20) andlh_disk_usage_return_legacy_meta_keys(SS88MLFS,SS88MLFSV).