prefix . 'wpdo_hot_hp_listing'; $now = time(); // Indexed range scan replaces O(N) postmeta walk. $ids = (array) $wpdb->get_col( // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $table is wpdb prefix + literal. $wpdb->prepare( "SELECT post_id FROM `{$table}` WHERE expired_time > 0 AND expired_time <= %d", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $table is wpdb prefix + literal. $now ) ); $count = 0; foreach ( $ids as $post_id ) { $post_id = (int) $post_id; if ( $post_id <= 0 ) { continue; } do_action( 'hivepress/v1/models/listing/expire', $post_id ); ++$count; } return $count; } /** * Whether the `hot_hp_listing` module is in a state where the hot * table reflects current truth (cutover or complete). */ private static function module_can_read(): bool { if ( ! class_exists( 'TMDO_Feature_Flags' ) ) { return false; } return TMDO_Feature_Flags::is_query_active( self::MODULE ); } } } // end if ( ! class_exists )