Automattic\WooCommerce\Database\Migrations
MetaToMetaTableMigrator::process_migration_data()
Process migration data for a batch of entities.
Метод класса: MetaToMetaTableMigrator{}
Хуков нет.
Возвращает
Массив
. Array of errors and exception if any.
Использование
$MetaToMetaTableMigrator = new MetaToMetaTableMigrator(); $MetaToMetaTableMigrator->process_migration_data( $data );
- $data(массив) (обязательный)
- Data to be migrated. Should be of the form: array( 'data' => array( ... ) ) as returned by the fetch_sanitized_migration_data method.
Код MetaToMetaTableMigrator::process_migration_data() MetaToMetaTableMigrator::process migration data WC 9.3.3
public function process_migration_data( array $data ) { if ( isset( $data['data'] ) ) { $data = $data['data']; } $this->clear_errors(); $exception = null; $to_insert = $data[0]; $to_update = $data[1]; try { if ( ! empty( $to_insert ) ) { $insert_queries = $this->generate_insert_sql_for_batch( $to_insert ); $processed_rows_count = $this->db_query( $insert_queries ); $this->maybe_add_insert_or_update_error( 'insert', $processed_rows_count ); } if ( ! empty( $to_update ) ) { $update_queries = $this->generate_update_sql_for_batch( $to_update ); $processed_rows_count = $this->db_query( $update_queries ); $this->maybe_add_insert_or_update_error( 'update', $processed_rows_count ); } } catch ( \Exception $e ) { $exception = $e; } return array( 'errors' => $this->get_errors(), 'exception' => $exception, ); }