last_error) { echo "❌ 连接失败: " . $wpdb->last_error . "\n"; exit(1); } else { echo "✅ 连接正常\n"; } $yith_brands = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->terms} t INNER JOIN {$wpdb->term_taxonomy} tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'yith_product_brand'"); $native_brands = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->terms} t INNER JOIN {$wpdb->term_taxonomy} tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'product_brand'"); echo "\n📊 当前数据统计:\n"; echo " YITH 品牌数量: " . ($yith_brands ?: 0) . "\n"; echo " 原生品牌数量: " . ($native_brands ?: 0) . "\n\n"; if ($yith_brands > 0) { echo "🔄 检测到 YITH 品牌数据,可以执行迁移\n"; echo " 运行命令: php migrate-script.php\n"; } elseif ($native_brands > 0) { echo "✅ 检测到原生品牌数据,迁移已完成\n"; echo " 如需回滚: php rollback-script.php\n"; } else { echo "ℹ️ 未检测到任何品牌数据\n"; } echo "\n=== 检查完成 ===\n";