From c5df64ca573e58d5936dc4cc7fd8cc2b6b5bf3ca Mon Sep 17 00:00:00 2001 From: vedanshujain Date: Mon, 4 Apr 2022 13:43:19 +0530 Subject: [PATCH] Add errors to log. --- .../CustomOrderTable/MetaToCustomTableMigrator.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/MetaToCustomTableMigrator.php b/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/MetaToCustomTableMigrator.php index 7347781a3fe..d7b0b4a20f4 100644 --- a/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/MetaToCustomTableMigrator.php +++ b/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/MetaToCustomTableMigrator.php @@ -283,8 +283,7 @@ abstract class MetaToCustomTableMigrator { $result = $wpdb->query( $queries ); $wpdb->query( 'COMMIT;' ); // For some reason, this seems necessary on some hosts? Maybe a MySQL configuration? if ( count( $batch ) !== $result ) { - // Some rows were not inserted. - // TODO: Find and log the entity ids that were not inserted. + $this->errors[] = 'Error with batch: ' . $wpdb->last_error; } } @@ -304,8 +303,7 @@ abstract class MetaToCustomTableMigrator { $result = $wpdb->query( $queries ); $wpdb->query( 'COMMIT;' ); // For some reason, this seems necessary on some hosts? Maybe a MySQL configuration? if ( count( $batch ) !== $result ) { - // Some rows were not inserted. - // TODO: Find and log the entity ids that were not updateed. + $this->errors[] = 'Error with batch: ' . $wpdb->last_error; } } @@ -486,11 +484,6 @@ WHERE * @return array[] Validated and combined data with errors. */ private function process_and_sanitize_data( $entity_data, $meta_data ) { - /** - * TODO: Add more validations for: - * 1. Column size - * 2. Value limits - */ $sanitized_entity_data = array(); $error_records = array(); $this->process_and_sanitize_entity_data( $sanitized_entity_data, $error_records, $entity_data ); @@ -565,7 +558,6 @@ WHERE $value = wc_string_to_bool( $value ); break; case 'date': - // TODO: Test this validation in unit tests. try { if ( '' === $value ) { $value = null;