From b2585459e337b31f607941a418fe0d85a87e1bbf Mon Sep 17 00:00:00 2001 From: wpdev Date: Sun, 27 Sep 2026 16:50:01 +0800 Subject: [PATCH] fix(2meet-data-optimizer-hivepress-addon): declare the listing indexes only on a core that adds them outside web requests - the hp_listing_core indexes are declared only when TMDO_Schema_Manager has ddl_allowed() (core 1.3.0+); core 1.2.0 would run the ALTER on 900k rows inside the first request after deploy, a visitor's included, if this AddOn were deployed first - Verify: unit 145, integration 53, phpcs - PR: PR-090b (found while writing the 0.4.0 notes) --- includes/class-tmdo-hivepress-entity-groups.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/class-tmdo-hivepress-entity-groups.php b/includes/class-tmdo-hivepress-entity-groups.php index eed41ea..27d41ee 100644 --- a/includes/class-tmdo-hivepress-entity-groups.php +++ b/includes/class-tmdo-hivepress-entity-groups.php @@ -262,10 +262,12 @@ final class TMDO_HivePress_Entity_Groups { // Filtered and sorted on by HivePress search. Declared as indexes // (added in place) rather than `searchable`, which would change // the schema hash and rebuild a table that may hold aeav_only data. - 'indexes' => array( + // Only with core 1.3.0+ (ddl_allowed()): older cores run the ALTER + // inside whatever request comes first, a visitor's included. + 'indexes' => method_exists( 'TMDO_Schema_Manager', 'ddl_allowed' ) ? array( 'hourly_rate' => array( 'hp_hourly_rate' ), 'rating_count' => array( 'hp_rating_count' ), - ), + ) : array(), ) ); }