https migration, or a stand->prod promotion must * never look like a new site to the license server and silently burn another * activation slot. The hash is pure random identity, generated once. * * Deliberately NEVER deleted by any plugin's own uninstall routine, even * under an explicit "delete all my data" choice — this option is not that * plugin's own data; it is shared site identity another ABDS plugin * currently installed (or installed later) may still depend on. Deleting it * would force a fresh hash next time something needs one, silently orphaning * whatever activation slot the old hash held on the license server. * * This exact file is intentionally duplicated verbatim into every ABDS * plugin that activates a license (abds-seo, abds-seo-pro, abds-connect-pro, * and abds-connect if it ever grows its own activation flow) — the same * physical-duplication pattern this codebase already uses for * ABDS_License_Client_V2 itself. Keep every copy identical. * * VERSIONING RULE (2026-09-07, preventive — see class-abds-product-updater.php's * own docblock for the incident this rule comes from). This class is NOT * currently version-suffixed, unlike ABDS_Product_Updater_V2 and * ABDS_License_Client_V2 — its public surface is a single zero-argument * static method (get_hash()) that has never changed shape since this file * was created, so there is nothing today for two products' independently * released copies to disagree about. That is a fact about this class's * history, not a permanent exemption: the FIRST incompatible change to its * public contract (a required constructor, a changed method signature, * anything another product's code would call differently) must rename the * class to a version suffix (ABDS_Site_Identity_V2) IN THE SAME RELEASE as * the change, in every product carrying a copy, before any of them ship. * On any site running more than one ABDS plugin, only ONE copy of this file * actually defines the class (class_exists() guard below) — never * necessarily the copy belonging to whichever plugin was updated most * recently. * * @package ABDS */ if ( ! defined( 'ABSPATH' ) ) { exit; } // This exact file is loaded by more than one ABDS plugin on the same // request (e.g. the free plugin's own require alongside this add-on's) -- // each is a SEPARATE file on disk, so require_once's own dedup (by path) // does not stop a second copy from re-declaring the class. Guarded the same // way ABDS_License_Client_V2's file already is, for the same reason. if ( ! class_exists( 'ABDS_Site_Identity' ) ) : // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- deliberately ABDS_, not ABDS_SEO_: shared across every ABDS product, matching ABDS_License_Client_V2's own naming for the same reason. /** * Cross-product per-site identity. */ class ABDS_Site_Identity { // phpcs:enable /** * Shared option name — deliberately NOT prefixed by product * (abds_seo_*, abds_seo_pro_*, abds_connect_*): this identifies the * WordPress installation itself, not any one plugin's private view * of it. */ const OPTION = 'abds_site_instance_hash'; /** * This site's identifier — creates it once if no ABDS plugin has * ever needed one on this site yet, otherwise returns the existing * value. * * @return string */ public static function get_hash(): string { $hash = (string) get_option( self::OPTION, '' ); if ( '' !== $hash ) { return $hash; } $hash = hash( 'sha256', wp_generate_password( 64, false ) . microtime() . wp_rand( 0, PHP_INT_MAX ) ); update_option( self::OPTION, $hash, false ); return $hash; } } endif;