Files
webman-buildadmin/phinx-bootstrap.php
zhenhui 8a1287d8ed 1.修复矿建鉴权报错
2.优化登录跳转接口
3.优化登录跳转接口
4.修复CURD生成代码模块表不加前缀访问返回404问题
5.系统级报错***优化报错Fatal error: Type of app\common\library\token\TokenExpirationException::$message
2026-04-13 16:48:37 +08:00

65 lines
2.2 KiB
PHP
Raw Permalink 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
/**
* Phinx 迁移引导:加载配置使 support\think\Db 可用InstallData 等迁移需检查数据是否存在)
*/
declare(strict_types=1);
$baseDir = __DIR__;
if (!defined('BASE_PATH')) {
define('BASE_PATH', $baseDir);
}
require $baseDir . '/vendor/autoload.php';
if (class_exists('Dotenv\Dotenv') && is_file($baseDir . '/.env')) {
Dotenv\Dotenv::createMutable($baseDir)->load();
}
if (!function_exists('env')) {
function env(string $key, mixed $default = null): mixed
{
$value = $_ENV[$key] ?? getenv($key);
if ($value !== false && $value !== null) {
return $value;
}
if (strpos($key, '.') !== false) {
$parts = explode('.', $key);
$upper = strtoupper(implode('_', $parts));
$value = $_ENV[$upper] ?? getenv($upper);
if ($value !== false && $value !== null) {
return $value;
}
}
return $default;
}
}
require $baseDir . '/vendor/workerman/webman-framework/src/support/helpers.php';
require $baseDir . '/app/functions.php';
use Webman\Config;
Config::clear();
Config::load($baseDir . '/config', ['route', 'middleware', 'process', 'server', 'static']);
// 与 Webman\ThinkOrm\ThinkOrm::start() 一致,并与 phinx.php 中 $thinkorm 来源一致
$thinkorm = array_replace_recursive(config('thinkorm', []), config('think-orm', []));
if (!empty($thinkorm)) {
support\think\Db::setConfig($thinkorm);
// Webman DbManager 使用连接池且忽略 force安装向导在同进程内迁移时若不清理会沿用旧前缀连接
// 导致 Phinx 已建带前缀表而 Db::name() 仍查无前缀表(如 menu_rule 不存在)。
if (class_exists(\Webman\ThinkOrm\DbManager::class)) {
$ref = new \ReflectionClass(\Webman\ThinkOrm\DbManager::class);
if ($ref->hasProperty('pools')) {
$poolsProp = $ref->getProperty('pools');
$poolsProp->setAccessible(true);
$poolsProp->setValue(null, []);
}
}
if (class_exists(\Webman\Context::class)) {
foreach (array_keys($thinkorm['connections'] ?? []) as $connName) {
\Webman\Context::set('think-orm.connections.' . $connName, null);
}
}
}