| 1 |
<?php |
| 2 |
/** |
| 3 |
* Update to 1.8.13. |
| 4 |
* |
| 5 |
* Safely remove exact duplicate postmeta rows from POS-touched products and |
| 6 |
* variations. This repair keeps one row per exact |
| 7 |
* (post_id, meta_key, meta_value) tuple. |
| 8 |
* |
| 9 |
* @author Paul Kilmurray <paul@kilbot.com> |
| 10 |
* |
| 11 |
* @see http://wcpos.com |
| 12 |
* @package WCPOS\WooCommercePOS |
| 13 |
*/ |
| 14 |
|
| 15 |
namespace WCPOS\WooCommercePOS; |
| 16 |
|
| 17 |
use WCPOS\WooCommercePOS\Services\Meta_Data_Repair; |
| 18 |
|
| 19 |
$woocommerce_pos_meta_repair_result = Meta_Data_Repair::remove_exact_duplicate_postmeta_rows( |
| 20 |
array( |
| 21 |
'dry_run' => false, |
| 22 |
'batch_size' => 500, |
| 23 |
'max_batches' => 400, |
| 24 |
) |
| 25 |
); |
| 26 |
|
| 27 |
if ( \function_exists( 'wc_get_logger' ) ) { |
| 28 |
$wcpos_logger = wc_get_logger(); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- update script file scope. |
| 29 |
|
| 30 |
$wcpos_logger->info( // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- update script file scope. |
| 31 |
sprintf( |
| 32 |
'WCPOS 1.8.13 migration: processed %1$d duplicate groups, deleted %2$d rows (errors: %3$d, batch_limit_hit: %4$s).', |
| 33 |
(int) $woocommerce_pos_meta_repair_result['groups_processed'], |
| 34 |
(int) $woocommerce_pos_meta_repair_result['rows_deleted'], |
| 35 |
(int) $woocommerce_pos_meta_repair_result['errors'], |
| 36 |
$woocommerce_pos_meta_repair_result['hit_batch_limit'] ? 'yes' : 'no' |
| 37 |
), |
| 38 |
array( 'source' => 'woocommerce-pos' ) |
| 39 |
); |
| 40 |
} |
| 41 |
|