Automattic\WooCommerce\Internal\DataStores\Orders
CustomOrdersTableController::process_updated_option_fts_index()
Process option that enables FTS index on orders table. Tries to create an FTS index when option is enabled.
Метод класса: CustomOrdersTableController{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->process_updated_option_fts_index( $option, $old_value, $value );
- $option(строка) (обязательный)
- Option name.
- $old_value(строка) (обязательный)
- Old value of the option.
- $value(строка) (обязательный)
- New value of the option.
Код CustomOrdersTableController::process_updated_option_fts_index() CustomOrdersTableController::process updated option fts index WC 9.3.3
private function process_updated_option_fts_index( $option, $old_value, $value ) { if ( self::HPOS_FTS_INDEX_OPTION !== $option ) { return; } if ( 'yes' !== $value ) { return; } if ( ! $this->custom_orders_table_usage_is_enabled() ) { update_option( self::HPOS_FTS_INDEX_OPTION, 'no', true ); if ( class_exists( 'WC_Admin_Settings' ) ) { WC_Admin_Settings::add_error( __( 'Failed to create FTS index on orders table. This feature is only available when High-performance order storage is enabled.', 'woocommerce' ) ); } return; } if ( ! $this->db_util->fts_index_on_order_address_table_exists() ) { $this->db_util->create_fts_index_order_address_table(); } // Check again to see if index was actually created. if ( $this->db_util->fts_index_on_order_address_table_exists() ) { update_option( self::HPOS_FTS_ADDRESS_INDEX_CREATED_OPTION, 'yes', true ); } else { update_option( self::HPOS_FTS_ADDRESS_INDEX_CREATED_OPTION, 'no', true ); if ( class_exists( 'WC_Admin_Settings ' ) ) { WC_Admin_Settings::add_error( __( 'Failed to create FTS index on address table', 'woocommerce' ) ); } } if ( ! $this->db_util->fts_index_on_order_item_table_exists() ) { $this->db_util->create_fts_index_order_item_table(); } // Check again to see if index was actually created. if ( $this->db_util->fts_index_on_order_item_table_exists() ) { update_option( self::HPOS_FTS_ORDER_ITEM_INDEX_CREATED_OPTION, 'yes', true ); } else { update_option( self::HPOS_FTS_ORDER_ITEM_INDEX_CREATED_OPTION, 'no', true ); if ( class_exists( 'WC_Admin_Settings ' ) ) { WC_Admin_Settings::add_error( __( 'Failed to create FTS index on order item table', 'woocommerce' ) ); } } }