脚本备份
This commit is contained in:
parent
a1b2fb2fd0
commit
f67455e37a
5 changed files with 519 additions and 0 deletions
47
verify-data.php
Normal file
47
verify-data.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
define('WP_USE_THEMES', false);
|
||||
require_once('/Users/feibisi-studio/Local Sites/mall/app/public/wp-load.php');
|
||||
|
||||
echo "=== 数据验证脚本 ===\n\n";
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$yith_count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->term_taxonomy} WHERE taxonomy = 'yith_product_brand'");
|
||||
$native_count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->term_taxonomy} WHERE taxonomy = 'product_brand'");
|
||||
|
||||
echo "📊 当前数据统计:\n";
|
||||
echo " YITH 品牌数量: " . ($yith_count ?: 0) . "\n";
|
||||
echo " 原生品牌数量: " . ($native_count ?: 0) . "\n\n";
|
||||
|
||||
if ($native_count > 0) {
|
||||
$brands = $wpdb->get_results("
|
||||
SELECT t.name, t.slug, tt.count
|
||||
FROM {$wpdb->terms} t
|
||||
INNER JOIN {$wpdb->term_taxonomy} tt ON t.term_id = tt.term_id
|
||||
WHERE tt.taxonomy = 'product_brand'
|
||||
ORDER BY tt.count DESC
|
||||
LIMIT 10
|
||||
");
|
||||
|
||||
echo "🏷️ 前10个原生品牌:\n";
|
||||
foreach ($brands as $brand) {
|
||||
echo " - " . $brand->name . " (" . $brand->count . "个产品)\n";
|
||||
}
|
||||
|
||||
$relationships = $wpdb->get_var("
|
||||
SELECT COUNT(*) FROM {$wpdb->term_relationships} tr
|
||||
INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
|
||||
WHERE tt.taxonomy = 'product_brand'
|
||||
");
|
||||
|
||||
$meta_count = $wpdb->get_var("
|
||||
SELECT COUNT(*) FROM {$wpdb->termmeta} tm
|
||||
INNER JOIN {$wpdb->term_taxonomy} tt ON tm.term_id = tt.term_id
|
||||
WHERE tt.taxonomy = 'product_brand'
|
||||
");
|
||||
|
||||
echo "\n🔗 产品-品牌关联数量: " . $relationships . "\n";
|
||||
echo "📝 品牌元数据记录: " . $meta_count . "\n";
|
||||
}
|
||||
|
||||
echo "\n=== 验证完成 ===\n";
|
||||
Loading…
Add table
Add a link
Reference in a new issue