修改忽略

This commit is contained in:
mzl
2025-11-07 16:34:57 +08:00
parent 6ab4505e17
commit 39820844f7
2 changed files with 75 additions and 72 deletions
+4 -1
View File
@@ -7,4 +7,7 @@
/tests/tmp /tests/tmp
/tests/.phpunit.result.cache /tests/.phpunit.result.cache
/public/uploads /public/uploads
/webman /webman
/start.php
/windows.php
/bootstrap.php
Regular → Executable
+71 -71
View File
@@ -1,71 +1,71 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
use Webman\Config; use Webman\Config;
use Webman\Console\Command; use Webman\Console\Command;
use Webman\Console\Util; use Webman\Console\Util;
use support\Container; use support\Container;
use Dotenv\Dotenv; use Dotenv\Dotenv;
if (!Phar::running()) { if (!Phar::running()) {
chdir(__DIR__); chdir(__DIR__);
} }
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
if (!$appConfigFile = config_path('app.php')) { if (!$appConfigFile = config_path('app.php')) {
throw new RuntimeException('Config file not found: app.php'); throw new RuntimeException('Config file not found: app.php');
} }
if (class_exists(Dotenv::class) && file_exists(run_path('.env'))) { if (class_exists(Dotenv::class) && file_exists(run_path('.env'))) {
if (method_exists(Dotenv::class, 'createUnsafeImmutable')) { if (method_exists(Dotenv::class, 'createUnsafeImmutable')) {
Dotenv::createUnsafeImmutable(run_path())->load(); Dotenv::createUnsafeImmutable(run_path())->load();
} else { } else {
Dotenv::createMutable(run_path())->load(); Dotenv::createMutable(run_path())->load();
} }
} }
$appConfig = require $appConfigFile; $appConfig = require $appConfigFile;
if ($timezone = $appConfig['default_timezone'] ?? '') { if ($timezone = $appConfig['default_timezone'] ?? '') {
date_default_timezone_set($timezone); date_default_timezone_set($timezone);
} }
if ($errorReporting = $appConfig['error_reporting'] ?? '') { if ($errorReporting = $appConfig['error_reporting'] ?? '') {
error_reporting($errorReporting); error_reporting($errorReporting);
} }
if (!in_array($argv[1] ?? '', ['start', 'restart', 'stop', 'status', 'reload', 'connections'])) { if (!in_array($argv[1] ?? '', ['start', 'restart', 'stop', 'status', 'reload', 'connections'])) {
require_once __DIR__ . '/support/bootstrap.php'; require_once __DIR__ . '/support/bootstrap.php';
} else { } else {
if (class_exists('Support\App')) { if (class_exists('Support\App')) {
Support\App::loadAllConfig(['route']); Support\App::loadAllConfig(['route']);
} else { } else {
Config::reload(config_path(), ['route', 'container']); Config::reload(config_path(), ['route', 'container']);
} }
} }
$cli = new Command(); $cli = new Command();
$cli->setName('webman cli'); $cli->setName('webman cli');
$cli->installInternalCommands(); $cli->installInternalCommands();
if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) { if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) {
$cli->installCommands($command_path); $cli->installCommands($command_path);
} }
foreach (config('plugin', []) as $firm => $projects) { foreach (config('plugin', []) as $firm => $projects) {
if (isset($projects['app'])) { if (isset($projects['app'])) {
foreach (['', '/app'] as $app) { foreach (['', '/app'] as $app) {
if ($command_str = Util::guessPath(base_path() . "/plugin/$firm{$app}", 'command')) { if ($command_str = Util::guessPath(base_path() . "/plugin/$firm{$app}", 'command')) {
$command_path = base_path() . "/plugin/$firm{$app}/$command_str"; $command_path = base_path() . "/plugin/$firm{$app}/$command_str";
$cli->installCommands($command_path, "plugin\\$firm" . str_replace('/', '\\', $app) . "\\$command_str"); $cli->installCommands($command_path, "plugin\\$firm" . str_replace('/', '\\', $app) . "\\$command_str");
} }
} }
} }
foreach ($projects as $name => $project) { foreach ($projects as $name => $project) {
if (!is_array($project)) { if (!is_array($project)) {
continue; continue;
} }
$project['command'] ??= []; $project['command'] ??= [];
array_walk($project['command'], [$cli, 'createCommandInstance']); array_walk($project['command'], [$cli, 'createCommandInstance']);
} }
} }
$cli->run(); $cli->run();