Files
ny-exam-platform/lib/Db.php
T
nxxy335 3952c77afe refactor: 取消 install.php 安装向导 + 下线 pgsql/mysql 支持 + 班级看板独立
- 删除 install.php:所有入口(index/dashboard/draw/login/api)不再跳安装,
  未登录统一跳 login.php;连接信息变更在【设置】里直接修改 data/config.json
- 下线 pgsql/mysql:
  * bootstrap.php 简化为单文件存储路径(ny_load_config/ny_save_config 直接读写 data/config.json),
    删除 ny_db_config、配置迁移、配置双写分支
  * lib/Db.php 改为纯 stub:pdo() 恒返回 null,避免上层误连;migrate/ensureRosterLogin 等为 no-op
  * Roster.php 经 useDb 永远 false,自动走 roster.json
  * api.php 不再返回 db_driver/db_connected/db_error 诊断
- 班级看板独立(dashboard.php 重写):
  * 删除"← 返回总览"按钮 + 整体概况 #overview 区
  * 进入即展示单班看板:6 张汇总卡 + 分组对比/成员榜
  * 顶部 hero 区动态显示当前班级名 + 问卷名
  * 工具栏新增 #classSel 班级选择器(切换班级不离开本页)
  * URL 支持 ?pid=&class=&auto=1|0 分享与刷新恢复
  * 下拉班级选项随数据动态刷新;保留自动刷新 + 全屏 + 缓存
- e2e 测试(test-config-save)加固 cleanup 钩子:
  * 统一 cleanup() 函数接管所有退出路径
  * 解决之前 e2e 留 residue 把 data/config.json 改成 mock 地址的问题(导致本机登录失败)
- php -l 全文件通过;node --check 内嵌 JS 通过;e2e test-config-save 27/27 + test-draw-alloc 29/29 全过
2026-09-09 14:04:59 +08:00

84 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 数据库适配层(旧:pgsql/mysql/sqlite 三方言支持)
* 本批次已下线,仅保留文件存储。如未来需要接入 DB,请在此文件实现 PDO 单例。
*/
declare(strict_types=1);
class Db
{
/** @var PDO|null 当前不可用,始终返回 null */
private static ?PDO $pdo = null;
public static function isConfigured(): bool
{
return false;
}
public static function isConnected(): bool
{
return false;
}
public static function driver(): string
{
return '';
}
public static function lastError(): string
{
return '';
}
public static function params(): array
{
return [];
}
public static function saveParams(array $p): bool
{
return false;
}
public static function connect(array $p): PDO
{
throw new RuntimeException('数据库后端已下线,请使用文件存储(data/config.json / data/roster.json)');
}
public static function pdo(): ?PDO
{
return null;
}
public static function prefix(): string
{
return 'ny_';
}
public static function migrate(): int
{
return 0;
}
public static function ensureRosterLogin(): void {}
public static function settingsAll(): array
{
return [];
}
public static function settingsSet(string $k, string $v): void {}
public static function rosterAll(): array
{
return [];
}
public static function rosterReplace(array $students): void {}
public static function rosterCount(): int
{
return 0;
}
}