- 0.6.2: get-media-usage, list-largest-attachments and get-attachment-size now take site_id through LH MCP Adapter Extensions instead of their own handling. Before, site_id worked only on the main site for install_plugins holders, and manage_options was not checked on the site named. Now it works from any connector for a site you belong to, with manage_options checked on that site. Without LH MCP Adapter Extensions they report on the current site only. The network abilities are unchanged.
- 0.6.1: Ability descriptions now open with a one-line summary for discover-abilities: get-attachment-size, get-media-usage, get-orphan-report, get-site-storage, list-largest-attachments, list-scans, measure-sites and start-orphan-report each lead with a sentence of at most 150 characters saying what they do and return. measure-sites and start-orphan-report now say they run on Action Scheduler where available, otherwise WP-Cron, as they have since 0.6.0, rather than WP-Cron only. get-orphan-report’s output schema now describes its folders (folder, files, bytes), largest (path, bytes, modified_gmt) and missing (path, attachment_id) lists. Behaviour is unchanged.
- 0.6.0: Background jobs now run on Action Scheduler when a site has it (for example through WooCommerce), falling back to WP-Cron, so a queued scan, unattached files report or measuring pass is durable and visible under Tools > Scheduled Actions instead of disappearing when WP-Cron is late. All scheduling goes through one queue class. The daily network measurement checks itself every hour and moves to whichever runner the main site has. Attachment re-measuring no longer starts a second batch chain while one is running. Deactivating the plugin removes its scheduled jobs on both runners (and the per-site backfill on every site when network-deactivated), and marks any scan still waiting as failed rather than leaving it queued forever.
- 0.5.1: Unattached files report: files WordPress keeps as image-edit backups (the originals saved before a crop, rotate or scale in the media editor, recorded in _wp_attachment_backup_sizes) now count as belonging to their attachment instead of being reported as unattached. The report also shows how many files and bytes those edit backups take up.
- 0.5.0: Unattached files reports, and modern image format copies counted. Super admins can now find the files in a site’s uploads directory that no attachment accounts for: every file on disk is compared with every file the site’s attachments, in any status, refer to, and the report gives totals for all files, attachment files and unattached files, unattached files grouped by top-level folder, the largest of them with size and date, and attachment files that are missing from disk. Reports run in the background (find through the shell, or a time-limited PHP walk); the main site’s report skips the other sites’ uploads/sites folders, and only the latest report per site is kept. Nothing is deleted. Network Tools > Disk Usage has a Check button and an Unattached files column for every site, with a report view, and two new abilities, lh-disk-usage/start-orphan-report and lh-disk-usage/get-orphan-report, do the same over MCP; list-scans now says which background jobs are scans and which are reports. Sizes now include the WebP and AVIF copies that modern image format plugins such as Performance Lab record in attachment metadata (sources), which were missed before; every attachment on every site is measured again once, in the background, to pick them up.
- 0.4.1: Attachments in the trash are now measured and reported. Until now attachments in every status were measured except trash and auto-draft, which WordPress leaves out of its “any status” queries; trashed attachments (on sites where MEDIA_TRASH is on) still take up disk space until the trash is emptied, so they now count towards every total and appear in a breakdown by status. Tools > Disk Usage says how much is in the trash and when WordPress will empty it, the largest attachments list marks trashed ones, get-media-usage returns the breakdown by status with the trash total, and list-largest-attachments returns each attachment’s status. Every site measures any attachments it skipped before, once, in the background. The background measurement also now starts on every site from the daily network measurement, not only on sites whose dashboard an administrator opens, so sites nobody manages in wp-admin get their media library measured too.
- 0.4.0: MCP abilities for disk usage, in a new lh-disk-usage ability category. On every site: lh-disk-usage/get-media-usage (the media library total, measured and unmeasured attachments, whether the background measurement has finished, and a breakdown by type), lh-disk-usage/list-largest-attachments (largest first, optionally one MIME type group, up to 100) and lh-disk-usage/get-attachment-size (one attachment measured live with every variant). These need manage_options on the site; on the main site, users who can install plugins can pass site_id to report on any other site. On the main site of a multisite only, for users who can install plugins: lh-disk-usage/get-site-storage (every site’s uploads on disk and media library with network totals), lh-disk-usage/measure-sites (starts a measurement pass in the background now, optionally from the first site again), lh-disk-usage/start-scan (queues an install scan of install, wp-content, uploads, plugins or themes at depth 1 to 4, run in the background by WP-Cron, and returns a job ID at once), lh-disk-usage/list-scans (saved scans and recent jobs) and lh-disk-usage/get-scan (a saved scan or a job’s progress, with the tree optionally trimmed to fewer levels). Background scan jobs are kept in a network option and forgotten a day after they finish; scans saved this way record the user who asked for them.
- 0.3.1: Install scans and site measurements no longer stop early on large installs. Commands run through the shell (du and find) now get their own time limit, 240 seconds by default (filter lh_disk_usage_return_shell_time_budget), held 30 seconds under PHP’s max_execution_time and with PHP’s own limit raised to match; the 20-second limit (lh_disk_usage_return_time_budget) now applies only to the PHP fallback. Before, du was stopped after 20 seconds, which on a network with tens of gigabytes of uploads ended scans part way through. When a scan is still cut short, directories du had not finished totalling are now given the sum of what it measured inside them, instead of zero, so an incomplete tree still adds up. The main site’s uploads figure now comes from a single pass over the uploads directory, subtracting its sites folder, instead of measuring every other site’s uploads a second time.
- 0.3.0: Network-wide disk usage for super admins, under Network Tools > Disk Usage (install_plugins, filter lh_disk_usage_return_network_capability). A Sites table shows each site’s uploads directory on disk (the main site’s figure excludes the other sites’ uploads/sites folders) next to its measured media library and attachment count, with network totals; every site is measured daily by WP-Cron on the main site, resuming where it stopped when the time limit is reached, and Measure sites now runs a pass on demand. Install scans break down the install, wp-content, uploads, plugins or themes directory up to four levels deep and list files over 10 MB; each scan is saved as a snapshot (the newest 20 are kept, in one network table) and shown as a sunburst chart, a top-level table and the large files list. Directories are measured with GNU du and find through the shell when the server allows it (each command is fixed, its path checked to be inside the install and escaped, and limited by timeout; filter lh_disk_usage_use_shell switches this off), and with a time-limited PHP walk otherwise; sizes are apparent sizes in bytes. A one-off action removes the SS88MLFS and SS88MLFSV post meta Media Library File Size leaves on every site, shown only while any remains. Network features load on multisite only.
- 0.2.0: First working release. LH Disk Usage measures every media library attachment, the original file plus every generated variant (each size counted once, including the pre-scaling original image WordPress keeps for large uploads), and keeps the result in post meta that updates whenever attachment metadata is saved. Existing attachments are measured in the background in batches of 100 through WP-Cron. Site administrators get a sortable File size column in the Media list (original size, with the variants total beneath), a Disk usage field on the attachment edit screen and media modal listing every variant with its dimensions and size, and a Tools > Disk Usage report with the library total, a breakdown by type and the 20 largest attachments. Site-level screens need manage_options (filter lh_disk_usage_return_capability). It replaces the Media Library File Size plugin; network-wide reporting, abilities and blocks follow in later releases. The plugin is network-only and requires WordPress 6.9 and PHP 7.4.
- 0.1.0: Initial scaffold.
Changelog
If you like this plugin please consider making a donation to further development