Digital Sovereignty for everyone

Data, cron and hooks

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_done on each site, set (to a GMT time) once every attachment has been measured.
  • Network table {base_prefix}lh_disk_usage_snapshots on 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 option lh_disk_usage_snapshots_schema_version.
  • Network options lh_disk_usage_site_storage (each site’s latest measurement) and lh_disk_usage_measure_cursor (where an unfinished pass resumes), and the network transient lh_disk_usage_legacy_meta_count.
  • Site totals are cached in the object cache group lh_disk_usage for an hour and cleared whenever an attachment is measured or deleted.

Cron

  • lh_disk_usage_backfill: single events on each site, scheduled from admin_init until 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 argument continue.

Filters

  • lh_disk_usage_init_plugin: return false to stop the plugin loading.
  • lh_disk_usage_return_capability (default manage_options) and lh_disk_usage_return_network_capability (default install_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’s max_execution_time) and lh_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) and lh_disk_usage_return_legacy_meta_keys (SS88MLFS, SS88MLFSV).

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.