# mlsimport/7.1.2/includes/mlsimport-reconciliation-guard.php

MLSImport: IDX Plugin &amp; MLS Plugin for Real Estate Listings, version 7.1.2. 34 lines.

- Page: https://pluginprobe.com/plugins/mlsimport/7.1.2/code/includes/mlsimport-reconciliation-guard.php
- Raw: https://pluginprobe.com/plugins/mlsimport/7.1.2/raw/includes/mlsimport-reconciliation-guard.php
- Modified: 2026-07-25T14:20:50+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/mlsimport/7.1.2/code/includes/mlsimport-reconciliation-guard.php#L10-L20`.

```php
<?php
/**
 * Reconciliation feed sanity guard.
 *
 * Pure function (no WordPress dependency) so it can be unit tested in
 * isolation. Reconciliation deletes every local listing absent from the MLS
 * feed; a well-formed but truncated feed would therefore trigger a mass
 * deletion. This decides whether the feed is a plausible size before any
 * deletion is allowed.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

/** Feed must carry at least this fraction of the local ListingKey count. */
const MLSIMPORT_RECONCILIATION_MIN_FEED_FRACTION = 0.8;

/**
 * Whether the reconciliation feed is a plausible size relative to the local set.
 *
 * @param int   $feed_count   Number of ListingKeys returned by the MLS feed.
 * @param int   $local_count  Number of local listings carrying a ListingKey.
 * @return bool True when reconciliation may proceed.
 */
function mlsimport_reconciliation_feed_is_plausible( int $feed_count, int $local_count ): bool {
	// With no local listings there is nothing to reconcile against; refuse.
	if ( $local_count <= 0 ) {
		return false;
	}
	// Plausible only when the feed covers at least the required fraction of locals.
	return $feed_count >= $local_count * MLSIMPORT_RECONCILIATION_MIN_FEED_FRACTION;
}

```
