脚本备份
This commit is contained in:
parent
a1b2fb2fd0
commit
f67455e37a
5 changed files with 519 additions and 0 deletions
39
test-plugin.php
Normal file
39
test-plugin.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
define('WP_USE_THEMES', false);
|
||||
require_once('/Users/feibisi-studio/Local Sites/mall/app/public/wp-load.php');
|
||||
|
||||
echo "=== YITH 品牌数据状态检查 ===\n\n";
|
||||
|
||||
global $wpdb;
|
||||
|
||||
echo "🔗 数据库连接状态: ";
|
||||
if ($wpdb->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";
|
||||
Loading…
Add table
Add a link
Reference in a new issue