From 39820844f7605f604ff2b307a5a25b59971daf19 Mon Sep 17 00:00:00 2001 From: mzl Date: Fri, 7 Nov 2025 16:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BF=BD=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +- webman | 142 ++++++++++++++++++++++++++--------------------------- 2 files changed, 75 insertions(+), 72 deletions(-) mode change 100644 => 100755 webman diff --git a/.gitignore b/.gitignore index fa572a1..c08e119 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ /tests/tmp /tests/.phpunit.result.cache /public/uploads -/webman \ No newline at end of file +/webman +/start.php +/windows.php +/bootstrap.php \ No newline at end of file diff --git a/webman b/webman old mode 100644 new mode 100755 index c853676..3f55062 --- a/webman +++ b/webman @@ -1,71 +1,71 @@ -#!/usr/bin/env php -load(); - } else { - Dotenv::createMutable(run_path())->load(); - } -} - -$appConfig = require $appConfigFile; -if ($timezone = $appConfig['default_timezone'] ?? '') { - date_default_timezone_set($timezone); -} - -if ($errorReporting = $appConfig['error_reporting'] ?? '') { - error_reporting($errorReporting); -} - -if (!in_array($argv[1] ?? '', ['start', 'restart', 'stop', 'status', 'reload', 'connections'])) { - require_once __DIR__ . '/support/bootstrap.php'; -} else { - if (class_exists('Support\App')) { - Support\App::loadAllConfig(['route']); - } else { - Config::reload(config_path(), ['route', 'container']); - } -} - -$cli = new Command(); -$cli->setName('webman cli'); -$cli->installInternalCommands(); -if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) { - $cli->installCommands($command_path); -} - -foreach (config('plugin', []) as $firm => $projects) { - if (isset($projects['app'])) { - foreach (['', '/app'] as $app) { - if ($command_str = Util::guessPath(base_path() . "/plugin/$firm{$app}", 'command')) { - $command_path = base_path() . "/plugin/$firm{$app}/$command_str"; - $cli->installCommands($command_path, "plugin\\$firm" . str_replace('/', '\\', $app) . "\\$command_str"); - } - } - } - foreach ($projects as $name => $project) { - if (!is_array($project)) { - continue; - } - $project['command'] ??= []; - array_walk($project['command'], [$cli, 'createCommandInstance']); - } -} - -$cli->run(); +#!/usr/bin/env php +load(); + } else { + Dotenv::createMutable(run_path())->load(); + } +} + +$appConfig = require $appConfigFile; +if ($timezone = $appConfig['default_timezone'] ?? '') { + date_default_timezone_set($timezone); +} + +if ($errorReporting = $appConfig['error_reporting'] ?? '') { + error_reporting($errorReporting); +} + +if (!in_array($argv[1] ?? '', ['start', 'restart', 'stop', 'status', 'reload', 'connections'])) { + require_once __DIR__ . '/support/bootstrap.php'; +} else { + if (class_exists('Support\App')) { + Support\App::loadAllConfig(['route']); + } else { + Config::reload(config_path(), ['route', 'container']); + } +} + +$cli = new Command(); +$cli->setName('webman cli'); +$cli->installInternalCommands(); +if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) { + $cli->installCommands($command_path); +} + +foreach (config('plugin', []) as $firm => $projects) { + if (isset($projects['app'])) { + foreach (['', '/app'] as $app) { + if ($command_str = Util::guessPath(base_path() . "/plugin/$firm{$app}", 'command')) { + $command_path = base_path() . "/plugin/$firm{$app}/$command_str"; + $cli->installCommands($command_path, "plugin\\$firm" . str_replace('/', '\\', $app) . "\\$command_str"); + } + } + } + foreach ($projects as $name => $project) { + if (!is_array($project)) { + continue; + } + $project['command'] ??= []; + array_walk($project['command'], [$cli, 'createCommandInstance']); + } +} + +$cli->run();