#!/bin/bash
# 修复系统配置中「分流设置 / 平台分配域名」不显示的问题（需 root）
set -e
BASE="$(cd "$(dirname "$0")" && pwd)"

if [ "$(id -u)" -ne 0 ]; then
  echo "请使用 root 执行: sudo bash $0"
  exit 1
fi

php "$BASE/runtime/install_split_config_standalone.php"

cp "$BASE/patches/application/common/model/Config.php" "$BASE/application/common/model/Config.php"
chown www:www "$BASE/application/common/model/Config.php"
php -l "$BASE/application/common/model/Config.php"

chown www:www "$BASE/application/extra/site.php" 2>/dev/null || true

echo "完成。请刷新后台「常规管理 -> 系统配置」，应能看到「分流设置」标签及「平台分配域名」字段。"
