Code Duplication    Length = 5-6 lines in 2 locations

includes/wc-term-functions.php 1 location

@@ 258-263 (lines=6) @@
255
 * @param  string $wp_current_db_version The old (current) $wp_db_version.
256
 */
257
function wc_taxonomy_metadata_migrate_data( $wp_db_version, $wp_current_db_version ) {
258
	if ( $wp_db_version >= 34370 && $wp_current_db_version < 34370 ) {
259
		global $wpdb;
260
		if ( $wpdb->query( "INSERT INTO {$wpdb->termmeta} ( term_id, meta_key, meta_value ) SELECT woocommerce_term_id, meta_key, meta_value FROM {$wpdb->prefix}woocommerce_termmeta;" ) ) {
261
			$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_termmeta" );
262
		}
263
	}
264
}
265
add_action( 'wp_upgrade', 'wc_taxonomy_metadata_migrate_data', 10, 2 );
266

includes/wc-update-functions.php 1 location

@@ 859-863 (lines=5) @@
856
	/**
857
	 * Migrate term meta to WordPress tables
858
	 */
859
	if ( get_option( 'db_version' ) >= 34370 && $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}woocommerce_termmeta';" ) ) {
860
		if ( $wpdb->query( "INSERT INTO {$wpdb->termmeta} ( term_id, meta_key, meta_value ) SELECT woocommerce_term_id, meta_key, meta_value FROM {$wpdb->prefix}woocommerce_termmeta;" ) ) {
861
			$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_termmeta" );
862
		}
863
	}
864
}
865
866
function wc_update_260_zones() {