Report when a migration finishes
benecaster_migration_import_complete fires once when a Migration Wizard import has finished, after its counts and its reconciliation report are written. This recipe logs the result.
A large skipped count is not a failure. Running the wizard again on a show you have already migrated skips almost every row, because people already brought across are left untouched. A healthy top-up can report 12 imported and 340 skipped. Report both numbers, and don’t treat the second as an error count. The batch’s reconciliation report says why each row was skipped.
Imported plus skipped is the number of rows in the file. A row whose join date could not be read counts as imported, because the person was migrated. The reconciliation report lists it too.
It fires even when every row was skipped. It does not fire when the import was refused before it started, and in that case benecaster_migration_import_started did not fire either.
It is not guaranteed to follow benecaster_migration_import_started. A fatal error part-way through an import fires the opener and never this hook. If you pause something when an import opens and resume it here, give the pause its own expiry.
$batch_id is the import’s ID in benecaster_migration_imports, the same value the other migration import hooks pass.
Code
<?php
add_action(
'benecaster_migration_import_complete',
static function ( int $show_id, string $platform, int $imported, int $skipped, int $batch_id ): void {
// "skipped" is not "failed" — report both, and do not colour the
// second one red. A top-up import skips almost everybody by design.
error_log( sprintf(
'Migration %d finished: %d imported, %d skipped (see the batch reconciliation for reasons).',
$batch_id,
$imported,
$skipped
) );
},
10,
5
);
Hooks Used
Need this built rather than just documented? See our services →