Automattic\WooCommerce\Internal\DataStores\Orders
DataSynchronizer::process_updated_option()
Process an option change for specific keys.
Метод класса: DataSynchronizer{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->process_updated_option( $option_key, $old_value, $new_value );
- $option_key(строка) (обязательный)
- The option key.
- $old_value(строка) (обязательный)
- The previous value.
- $new_value(строка) (обязательный)
- The new value.
Код DataSynchronizer::process_updated_option() DataSynchronizer::process updated option WC 9.5.1
private function process_updated_option( $option_key, $old_value, $new_value ) { $sync_option_keys = array( self::ORDERS_DATA_SYNC_ENABLED_OPTION, self::BACKGROUND_SYNC_MODE_OPTION ); if ( ! in_array( $option_key, $sync_option_keys, true ) || $new_value === $old_value ) { return; } if ( self::BACKGROUND_SYNC_MODE_OPTION === $option_key ) { $mode = $new_value; } else { $mode = $this->get_background_sync_mode(); } switch ( $mode ) { case self::BACKGROUND_SYNC_MODE_INTERVAL: $this->schedule_background_sync(); break; case self::BACKGROUND_SYNC_MODE_CONTINUOUS: case self::BACKGROUND_SYNC_MODE_OFF: default: $this->unschedule_background_sync(); break; } if ( self::ORDERS_DATA_SYNC_ENABLED_OPTION === $option_key ) { if ( ! $this->check_orders_table_exists() ) { $this->create_database_tables(); } if ( $this->data_sync_is_enabled() ) { wc_get_container()->get( LegacyDataCleanup::class )->toggle_flag( false ); $this->batch_processing_controller->enqueue_processor( self::class ); } else { $this->batch_processing_controller->remove_processor( self::class ); } } }