refactor(admin): retire settings migration and compat menu demotion

Stop auto-running AKSRT_Settings_Migration, drop multi-option settings
merge and Zibll favicon aliases, remove the migration tools entry from
menus/schema, flatten admin sections so pages are not demoted into a
compat bag, and retire the migration-status payload for leftover SPA
routes after a full admin rebuild.
This commit is contained in:
2026-07-11 15:54:35 +08:00
parent b46a069ecf
commit 3b951a5a36
13 changed files with 23 additions and 284 deletions
+13 -224
View File
@@ -11,65 +11,6 @@ import { themeInfoSection } from './theme-info'
import { docsSection } from './docs'
import { toolsSection } from './tools'
const DEMOTED_CHILDREN = {
'post-list': ['post-list-submit'],
users: [
'users-level',
'users-badge',
'users-invite-codes',
'users-sms',
'users-wechat',
'users-wechat-template',
'users-messages',
'users-ban',
'users-report',
],
payment: ['payment-paid'],
shop: ['shop-dashboard'],
forum: ['forum-dashboard'],
extensions: [
'extensions-audit',
'extensions-push',
'extensions-docs-mode',
'extensions-security',
'extensions-tools',
'extensions-ai',
],
}
const COMPAT_PAGE_ORDER = [
'tools-import-export',
'tools-backup',
'tools-health',
'tools-migration',
'tools-email-rollback',
'tools-update',
'theme-info-dashboard',
'docs-dashboard',
'theme-authorization',
'payment-paid',
'post-list-submit',
'users-level',
'users-badge',
'users-invite-codes',
'users-sms',
'users-wechat',
'users-wechat-template',
'users-messages',
'users-ban',
'users-report',
'extensions-docs-mode',
'extensions-audit',
'extensions-push',
'extensions-security',
'extensions-tools',
'extensions-ai',
'shop-dashboard',
'forum-dashboard',
]
const COMPAT_PAGE_ORDER_INDEX = new Map(COMPAT_PAGE_ORDER.map((key, index) => [key, index]))
const SECTION_DEFAULT_CHILDREN = {
global: 'global-common',
'page-display': 'page-display-header-nav',
@@ -80,135 +21,9 @@ const SECTION_DEFAULT_CHILDREN = {
shop: 'shop-products',
forum: 'forum-boards',
extensions: 'extensions-ip',
'tools-compat': 'tools-import-export',
}
const DEMOTED_PAGE_OVERRIDES = {
'post-list-submit': {
label: '前台投稿(兼容)',
title: '前台投稿(兼容)',
desc: '兼容保留前台投稿入口,避免其继续主导内容主线配置。',
},
'users-level': {
label: '用户等级(后移)',
title: '用户等级(后移)',
desc: '等级规则与权益映射后移至次级入口,用户主线优先呈现登录、功能与积分。',
},
'users-badge': {
label: '用户徽章(后移)',
title: '用户徽章(后移)',
desc: '徽章规则与授予条件后移至次级入口,用户主线优先呈现登录、功能与积分。',
},
'users-invite-codes': {
label: '邀请码运营(兼容)',
title: '邀请码运营(兼容)',
desc: '兼容保留邀请码运营入口,避免其压过登录、用户功能与签到积分主线。',
},
'users-sms': {
label: '短信接口(兼容)',
title: '短信接口(兼容)',
desc: '兼容保留短信供应商配置,不再作为用户主线高权重入口。',
},
'users-wechat': {
label: '微信通知(兼容)',
title: '微信通知(兼容)',
desc: '兼容保留微信通知配置,不再进入用户主线设置前排。',
},
'users-wechat-template': {
label: '微信模板消息(兼容)',
title: '微信模板消息(兼容)',
desc: '兼容保留微信模板消息入口,作为次级通信能力访问。',
},
'users-messages': {
label: '消息中心(兼容)',
title: '消息中心(兼容)',
desc: '兼容保留站内消息治理入口,不再主导用户主线后台路径。',
},
'users-ban': {
label: '禁封管理(治理兼容)',
title: '禁封管理(治理兼容)',
desc: '兼容保留禁封治理入口,避免其压过登录与用户功能配置。',
},
'users-report': {
label: '禁封/举报(治理兼容)',
title: '禁封/举报(治理兼容)',
desc: '兼容保留举报治理入口,作为次级治理能力访问。',
},
'payment-paid': {
label: '下载/付费内容(兼容)',
title: '下载/付费内容(兼容)',
desc: '兼容保留资源型下载/付费内容入口,避免资源主线继续占据支付域前排。',
},
'shop-dashboard': {
label: '商城概览(兼容)',
title: '商城概览(兼容)',
desc: '兼容保留商城概览页,默认主路径仍以商品与订单管理为先。',
},
'forum-dashboard': {
label: '论坛概览(兼容)',
title: '论坛概览(兼容)',
desc: '兼容保留论坛概览页,默认主路径仍以板块与配置管理为先。',
},
'extensions-docs-mode': {
label: '文档模式(兼容)',
title: '文档模式(兼容)',
desc: '兼容保留 docs mode,不再作为主线产品能力入口。',
},
'extensions-audit': {
label: 'API内容审核(兼容)',
title: 'API内容审核(兼容)',
desc: '兼容保留治理型审核能力,避免其影响核心内容与用户主线。',
},
'extensions-push': {
label: '百度推送(兼容)',
title: '百度推送(兼容)',
desc: '兼容保留搜索推送能力,不再占用主线后台入口。',
},
'extensions-security': {
label: '网站安全(兼容)',
title: '网站安全(兼容)',
desc: '兼容保留扩展安全能力,作为低频次级入口访问。',
},
'extensions-tools': {
label: '系统工具(兼容)',
title: '系统工具(兼容)',
desc: '兼容保留扩展工具中心,避免与主工具区重复争夺主路径。',
},
'extensions-ai': {
label: 'AI 辅助(兼容)',
title: 'AI 辅助(兼容)',
desc: '兼容保留 AI 内容辅助能力,不再进入 Zibll 主线后台路径。',
},
}
function withoutChildren(section, childKeys = []) {
if (!childKeys.length) {
return section
}
const childKeySet = new Set(childKeys)
return {
...section,
children: (section.children || []).filter((child) => !childKeySet.has(child.key)),
}
}
function pickChildren(section, childKeys = []) {
if (!childKeys.length) {
return []
}
const childKeySet = new Set(childKeys)
return (section.children || [])
.filter((child) => childKeySet.has(child.key))
.map((child) => ({
...child,
...(DEMOTED_PAGE_OVERRIDES[child.key] || {}),
secondaryEntry: true,
compatSourceSection: section.key,
}))
tools: 'tools-import-export',
'theme-info': 'theme-info-dashboard',
docs: 'docs-dashboard',
}
function attachSectionDefaultRoute(section) {
@@ -225,45 +40,19 @@ function attachSectionDefaultRoute(section) {
}
}
const primarySections = [
export const ADMIN_SECTIONS = [
attachSectionDefaultRoute(globalSection),
attachSectionDefaultRoute(pageDisplaySection),
attachSectionDefaultRoute(withoutChildren(postListSection, DEMOTED_CHILDREN['post-list'])),
attachSectionDefaultRoute(postListSection),
attachSectionDefaultRoute(permissionsSection),
attachSectionDefaultRoute(withoutChildren(usersSection, DEMOTED_CHILDREN.users)),
attachSectionDefaultRoute(withoutChildren(paymentSection, DEMOTED_CHILDREN.payment)),
attachSectionDefaultRoute(withoutChildren(shopSection, DEMOTED_CHILDREN.shop)),
attachSectionDefaultRoute(withoutChildren(forumSection, DEMOTED_CHILDREN.forum)),
attachSectionDefaultRoute(withoutChildren(extensionsSection, DEMOTED_CHILDREN.extensions)),
]
const compatChildren = [
...(toolsSection.children || []),
...(themeInfoSection.children || []),
...(docsSection.children || []),
...pickChildren(paymentSection, DEMOTED_CHILDREN.payment),
...pickChildren(postListSection, DEMOTED_CHILDREN['post-list']),
...pickChildren(usersSection, DEMOTED_CHILDREN.users),
...pickChildren(extensionsSection, DEMOTED_CHILDREN.extensions),
...pickChildren(shopSection, DEMOTED_CHILDREN.shop),
...pickChildren(forumSection, DEMOTED_CHILDREN.forum),
].sort((left, right) => {
const leftIndex = COMPAT_PAGE_ORDER_INDEX.get(left.key) ?? Number.MAX_SAFE_INTEGER
const rightIndex = COMPAT_PAGE_ORDER_INDEX.get(right.key) ?? Number.MAX_SAFE_INTEGER
return leftIndex - rightIndex
})
export const compatToolsSection = attachSectionDefaultRoute({
key: 'tools-compat',
label: '兼容&工具',
icon: toolsSection.icon,
route: '/tools',
children: compatChildren,
})
export const ADMIN_SECTIONS = [
...primarySections,
compatToolsSection,
attachSectionDefaultRoute(usersSection),
attachSectionDefaultRoute(paymentSection),
attachSectionDefaultRoute(shopSection),
attachSectionDefaultRoute(forumSection),
attachSectionDefaultRoute(extensionsSection),
attachSectionDefaultRoute(toolsSection),
attachSectionDefaultRoute(themeInfoSection),
attachSectionDefaultRoute(docsSection),
]
export function getAdminSections() {
+1 -10
View File
@@ -2,7 +2,7 @@ import { renderFaIcon, customPage, schemaPage } from './helpers'
export const toolsSection = {
key: 'tools-compat',
label: '兼容&工具',
label: '工具',
icon: renderFaIcon('fas fa-toolbox'),
route: '/tools',
children: [
@@ -34,15 +34,6 @@ export const toolsSection = {
desc: '查看主题环境、数据表、邮箱验证迁移和系统诊断状态。',
component: 'ToolsHealth',
}),
customPage({
key: 'tools-migration',
name: 'ToolsMigration',
label: '迁移状态',
route: '/tools/migration',
title: '迁移状态',
desc: '查看数据库 schema 版本、设置迁移版本和迁移日志。',
component: 'ToolsMigration',
}),
customPage({
key: 'tools-email-rollback',
name: 'ToolsEmailRollback',
@@ -94,7 +94,6 @@ const healthItems = ref([
const tools = ref([
{ key: 'import-export', icon: 'fas fa-exchange-alt', bg: '#1890ff', title: '导入导出', desc: '设置导入、导出和重置', route: '/tools/import-export' },
{ key: 'health', icon: 'fas fa-heartbeat', bg: '#52c41a', title: '健康检查', desc: '系统状态检测和诊断', route: '/tools/health' },
{ key: 'migration', icon: 'fas fa-exchange-alt', bg: '#722ed1', title: '数据迁移', desc: '设置迁移状态和兼容性', route: '/tools/migration' },
{ key: 'email-rollback', icon: 'fas fa-undo', bg: '#fa8c16', title: '邮箱回滚', desc: '邮箱变更 14 天内回滚', route: '/tools/email-rollback' },
])
@@ -116,10 +116,6 @@
<FaIcon icon="fas fa-exchange-alt" :size="16" />
<span>导入导出</span>
</router-link>
<router-link to="/tools/migration" class="aksrt-theme-info__link">
<FaIcon icon="fas fa-database" :size="16" />
<span>迁移状态</span>
</router-link>
</div>
</n-card>
</template>
@@ -7,7 +7,6 @@
<template #actions>
<n-space>
<n-button quaternary @click="go('/tools/import-export')">导入导出</n-button>
<n-button quaternary @click="go('/tools/migration')">迁移状态</n-button>
</n-space>
</template>
</PageHeader>
@@ -8,7 +8,6 @@
<n-space>
<n-button quaternary @click="go('/tools/backup')">数据备份</n-button>
<n-button quaternary @click="go('/tools/health')">健康检查</n-button>
<n-button quaternary @click="go('/tools/migration')">迁移状态</n-button>
</n-space>
</template>
</PageHeader>
@@ -87,7 +87,6 @@ const guides = [
{ key: 'docs-mode', title: '文档模式', desc: '配置文档分类与专题模板', url: '#/extensions/docs-mode' },
{ key: 'oauth', title: '第三方登录', desc: '检查 GitHub / Gitee / QQ / Google 登录', url: '#/users/oauth' },
{ key: 'backup', title: '设置快照', desc: '创建与恢复站点配置快照', url: '#/tools/backup' },
{ key: 'migration', title: '迁移状态', desc: '确认 schema 与设置迁移版本', url: '#/tools/migration' },
{ key: 'health', title: '健康检查', desc: '查看 PHP / WP / 数据表状态', url: '#/tools/health' },
{ key: 'meilisearch', title: 'Meilisearch', desc: '配置搜索索引与同步策略', url: '#/global/search' },
{ key: 'i18n', title: '多语言翻译', desc: '检查语言切换与术语配置', url: '#/global/i18n' },
@@ -5,14 +5,12 @@
import { importExportSchema } from './import-export.js'
import { healthSchema } from './health.js'
import { migrationSchema } from './migration.js'
import { emailRollbackSchema } from './email-rollback.js'
import { backupSchema } from './backup.js'
export const toolsSchemas = {
'import-export': importExportSchema,
health: healthSchema,
migration: migrationSchema,
'email-rollback': emailRollbackSchema,
backup: backupSchema,
}
+2 -5
View File
@@ -45,11 +45,8 @@ if (!function_exists('aksrt_get_setting')) {
return AKSRT_Settings::get_all();
}
$legacy = get_option('aksrt_settings', array());
$seo = get_option('aksrt_seo_settings', array());
$basic = get_option('aksrt_basic_settings', array());
return array_merge($legacy, $seo, $basic);
$settings = get_option('aksrt_settings', array());
return is_array($settings) ? $settings : array();
}
/**
-5
View File
@@ -121,7 +121,6 @@ require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-ext
require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-extensions.php';
require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-tools-import-export.php';
require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-tools-health.php';
require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-tools-migration.php';
require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-tools-backup.php';
require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-tools-email-rollback.php';
require_once AKSRT_DIR . '/inc/classes/admin/schema/class-aksrt-admin-schema-tools.php';
@@ -168,7 +167,6 @@ require_once AKSRT_DIR . '/inc/classes/class-aksrt-meilisearch.php';
require_once AKSRT_DIR . '/inc/classes/class-aksrt-update-checker.php';
require_once AKSRT_DIR . '/inc/classes/class-aksrt-category-rewrite.php';
require_once AKSRT_DIR . '/inc/classes/admin/class-aksrt-admin-message-controller.php';
require_once AKSRT_DIR . '/inc/classes/class-aksrt-settings-migration.php';
require_once AKSRT_DIR . '/inc/classes/class-aksrt-admin.php';
require_once AKSRT_DIR . '/inc/classes/auth/class-aksrt-auth-email-verification.php';
@@ -422,8 +420,5 @@ add_action('aksrt_email_verification_backfill_batch', function ($offset = 0) {
// 仅在后台上下文执行,前台不触发。
// ============================================================
add_action('admin_init', function () {
if (class_exists('AKSRT_Settings_Migration')) {
AKSRT_Settings_Migration::get_instance()->maybe_migrate();
}
}, 5);
@@ -4,14 +4,13 @@ defined('ABSPATH') || exit;
trait AKSRT_Admin_Import_Export_Controller_Part_1 {
public function rest_migration_status(WP_REST_Request $request): WP_REST_Response {
$schema_version = get_option('aksrt_db_schema_version', '0.0.0');
$migration = class_exists('AKSRT_Settings_Migration') ? AKSRT_Settings_Migration::get_instance() : null;
$migration_log = $migration ? $migration->get_log() : get_option('aksrt_settings_migration_log', []);
// Settings migration UI/runtime has been removed. Keep the route for old SPA chunks
// until the next full admin rebuild, but return an empty retired payload.
return $this->success([
'schema_version' => $schema_version,
'migration_version' => $migration ? $migration->get_version() : get_option('aksrt_settings_migration_version', '0.0.0'),
'migration_log' => is_array($migration_log) ? $migration_log : [],
'schema_version' => get_option('aksrt_db_schema_version', '0.0.0'),
'migration_version' => 'retired',
'migration_log' => [],
'retired' => true,
]);
}
@@ -16,7 +16,6 @@ class AKSRT_Admin_Schema_Tools {
'sections' => [
'import-export' => AKSRT_Admin_Schema_Tools_Import_Export::build(),
'health' => AKSRT_Admin_Schema_Tools_Health::build(),
'migration' => AKSRT_Admin_Schema_Tools_Migration::build(),
'backup' => AKSRT_Admin_Schema_Tools_Backup::build(),
'email-rollback' => AKSRT_Admin_Schema_Tools_Email_Rollback::build(),
],
+1 -22
View File
@@ -222,28 +222,7 @@ class AKSRT_Settings {
/** 获取Favicon URL */
public static function custom_favicon_url(): string {
$favicon = (string) self::get_value('site_favicon', '');
if ($favicon !== '') {
return $favicon;
}
// zibll 别名回退
$zibll = trim((string) get_option('favicon', ''));
if ($zibll !== '') {
return $zibll;
}
// zibll iconpng 别名回退
$iconpng = trim((string) get_option('iconpng', ''));
if ($iconpng !== '') {
return $iconpng;
}
$theme_mod = trim((string) get_theme_mod('aksrt_favicon', ''));
if ($theme_mod !== '') {
return $theme_mod;
}
return '';
return $favicon !== '' ? $favicon : '';
}
public static function favicon_url(): string {