fix: postmeta tracking on synchronous AVIF + add reconcile-meta (v0.2.2)

Two improvements after v0.2.1 deploy revealed the avif_status bug
wasn't fully fixed:

Fix:
  Format_Generator::make_avif() now calls record_avif_outcome() at the
  end of the synchronous path. Previously only the cron path recorded
  outcomes, so wp h4b-img generate-missing-siblings (synchronous) left
  4067 stale 'queued' rows even though it successfully generated 603
  AVIFs on disk. process_avif_job() simplified to a thin wrapper
  around make_avif(avif_async=false).

Added:
  wp h4b-img reconcile-meta — walks _h4b_img_optim postmeta, checks
  for .webp / .avif files on disk, and updates avif_status / webp size
  fields to match reality. One-shot reconciliation for stale records
  left by earlier plugin versions. --dry-run supported.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Henk
2026-05-19 14:59:18 +10:00
parent 868dbe0ff4
commit c54eccc2d5
4 changed files with 112 additions and 6 deletions

View File

@@ -19,6 +19,10 @@ final class CLI {
\WP_CLI::add_command( 'h4b-img rescue', CLI_Rescue::class );
\WP_CLI::add_command( 'h4b-img migrate-from-smush', CLI_Migrate::class );
\WP_CLI::add_command( 'h4b-img generate-missing-siblings', CLI_Siblings::class );
\WP_CLI::add_command( 'h4b-img reconcile-meta',
function ( $args, $assoc ) {
( new CLI_Siblings() )->reconcile_meta( $args, $assoc );
} );
}
/**