# double-opt-in/5.6.1/src/Providers/HealthServiceProvider.php

Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification, version 5.6.1. 113 lines.

- Page: https://pluginprobe.com/plugins/double-opt-in/5.6.1/code/src/Providers/HealthServiceProvider.php
- Raw: https://pluginprobe.com/plugins/double-opt-in/5.6.1/raw/src/Providers/HealthServiceProvider.php
- Modified: 2026-09-10T15:20:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/double-opt-in/5.6.1/code/src/Providers/HealthServiceProvider.php#L10-L20`.

```php
<?php
/**
 * Health Service Provider
 *
 * @package Forge12\DoubleOptIn\Providers
 * @since   5.3.0
 */

namespace Forge12\DoubleOptIn\Providers;

use Forge12\DoubleOptIn\Container\BootableProviderInterface;
use Forge12\DoubleOptIn\Container\Container;
use Forge12\DoubleOptIn\Health\DatabaseTableHealthCheck;
use Forge12\DoubleOptIn\Health\HealthCheckRegistry;
use Forge12\DoubleOptIn\Health\HealthRepairController;
use Forge12\DoubleOptIn\Health\LegacyMonolithCheck;
use Forge12\DoubleOptIn\Health\SiteHealthIntegration;
use Forge12\DoubleOptIn\Health\StaleConsentFieldCheck;
use Forge12\DoubleOptIn\Health\StaleProMarkersCheck;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class HealthServiceProvider
 *
 * Wires the health-check registry and its Site Health surfaces.
 *
 * Registration of *addon* checks happens through the
 * `f12_doi_health_checks` filter, which the registry applies lazily on
 * first read — so this provider does not need to run after addon boot,
 * and addons do not need a Core new enough to know about this API.
 *
 * Only the Core's own tables are registered here. They are the three
 * that `OnActivation.php` creates; if one of them is missing the plugin
 * is broken in a way that has, historically, only shown up as a silent
 * failure much later.
 */
class HealthServiceProvider implements BootableProviderInterface {

	/**
	 * {@inheritdoc}
	 */
	public function register( Container $container ): void {
		$container->singleton(
			HealthCheckRegistry::class,
			function () {
				return new HealthCheckRegistry();
			}
		);
	}

	/**
	 * {@inheritdoc}
	 */
	public function boot( Container $container ): void {
		$registry = $container->get( HealthCheckRegistry::class );

		$optInsUrl = admin_url( 'admin.php?page=f12-doi-admin' );

		$registry->register(
			new DatabaseTableHealthCheck(
				'f12_doi_table_optin',
				'core',
				'f12_cf7_doubleoptin',
				__( 'Opt-in records', 'double-opt-in' ),
				__( 'Open Double Opt-In', 'double-opt-in' ),
				$optInsUrl
			)
		);

		$registry->register(
			new DatabaseTableHealthCheck(
				'f12_doi_table_categories',
				'core',
				'f12_cf7_doubleoptin_categories',
				__( 'Opt-in categories', 'double-opt-in' ),
				__( 'Open Double Opt-In', 'double-opt-in' ),
				$optInsUrl
			)
		);

		$registry->register(
			new DatabaseTableHealthCheck(
				'f12_doi_table_audit_log',
				'core',
				'f12_cf7_doubleoptin_audit_log',
				__( 'Consent audit log', 'double-opt-in' ),
				__( 'Open Double Opt-In', 'double-opt-in' ),
				$optInsUrl
			)
		);

		// Not a table check: this one asks whether the forms' consent
		// settings still match the forms. A stale acceptance field does
		// not break anything visibly — it quietly turns every opt-in of
		// that form into consent evidence nobody ever confirmed.
		$registry->register( new StaleConsentFieldCheck() );

		// The two checks around the Pro 3.x -> 4.x upgrade. They live in
		// free Core on purpose: both describe a site where Pro is broken
		// or absent, so a check shipped inside bundle-pro would be the one
		// thing not loaded when it is needed.
		$registry->register( new LegacyMonolithCheck() );
		$registry->register( new StaleProMarkersCheck() );

		( new HealthRepairController() )->register();

		( new SiteHealthIntegration( $registry ) )->register();
	}
}

```
