diff --git a/README.md b/README.md index e65de3b..316ab1b 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # CodeIgniter4-Burner

- + logo

Burner is an out-of-the-box library for CodeIgniter4 that supports [RoadRunner](https://roadrunner.dev/), [Workerman](https://github.com/walkor/workerman), and [OpenSwoole](https://openswoole.com/) high-performance web servers. All you need to do is open a few php extensions to dramatically speed up your CodeIgniter4 applications, allowing them to handle higher loads and more connections at the same time. -[English Document](https://burner.monken.tw/en/introduction) +[English Document](https://ciburner.com//en/introduction) [正體中文簡介](README_zh-TW.md) diff --git a/README_zh-TW.md b/README_zh-TW.md index 40bfcb7..712b911 100644 --- a/README_zh-TW.md +++ b/README_zh-TW.md @@ -1,14 +1,14 @@ # Codeigniter4-Burner

- + logo

Burner 是一款專屬於 CodeIgniter4 的開箱即用的程式庫,它支援 [RoadRunner](https://roadrunner.dev/) , [Workerman](https://github.com/walkor/workerman) 與 , [OpenSwoole](https://openswoole.com/) 高效能網頁伺服器。你只需要開啟一些 php 擴充套件,即可大幅度地加速你的 CodeIgniter4 應用程式,使其能承受更高的負載並同時處理更多的連線。 -[正體中文文件](https://burner.monken.tw/zh_TW/introduction) +[正體中文文件](https://ciburner.com/zh_TW/introduction) ## 安裝 diff --git a/src/App.php b/src/App.php index a0c4209..5f9e757 100644 --- a/src/App.php +++ b/src/App.php @@ -46,7 +46,7 @@ public static function run(ServerRequestInterface $request, bool $isWebsocket = { // handle request object try { - $ci4Request = RequestHandler::initRequest($request, 'workerman'); + $ci4Request = RequestHandler::initRequest($request); } catch (Throwable $e) { dump((string) $e); } @@ -119,7 +119,6 @@ public static function clean() self::resetServices(); Factories::reset(); HandleConnections::close(self::$config); - unset($_SERVER['HTTP_X_FORWARDED_FOR'], $_SERVER['HTTP_X_REAL_IP'], $_SERVER['HTTP_USER_AGENT']); UploadedFileBridge::reset(); } diff --git a/src/Bridge/RequestHandler.php b/src/Bridge/RequestHandler.php index d8ba064..a318244 100644 --- a/src/Bridge/RequestHandler.php +++ b/src/Bridge/RequestHandler.php @@ -18,14 +18,12 @@ public static function initRequest(ServerRequestInterface $rRequest) $appConfig = new App(); self::$_rRequest = $rRequest; self::setFile(); - self::setServer(); Services::createRequest($appConfig, false); - Services::request()->getUserAgent()->parse($_SERVER['HTTP_USER_AGENT']); + Services::request()->getUserAgent()->parse(self::$_rRequest->getHeaderLine('User-Agent')); UriBridge::setUri(self::$_rRequest->getUri()); - // $rRequest->g Services::request()->setBody(self::getBody()); self::setParams(); @@ -35,17 +33,6 @@ public static function initRequest(ServerRequestInterface $rRequest) return Services::request(); } - protected static function setServer() - { - $_SERVER['HTTP_USER_AGENT'] = self::$_rRequest->getHeaderLine('User-Agent'); - if (self::$_rRequest->getHeaderLine('x-forwarded-for') !== '') { - $_SERVER['HTTP_X_FORWARDED_FOR'] = self::$_rRequest->getHeaderLine('x-forwarded-for'); - } - if (self::$_rRequest->getHeaderLine('x-real-ip') !== '') { - $_SERVER['HTTP_X_REAL_IP'] = self::$_rRequest->getHeaderLine('x-real-ip'); - } - } - protected static function setFile() { if (self::$_rRequest->getUploadedFiles() !== []) { diff --git a/src/Bridge/UploadedFileBridge.php b/src/Bridge/UploadedFileBridge.php index 3d77fc1..a5d0b2c 100644 --- a/src/Bridge/UploadedFileBridge.php +++ b/src/Bridge/UploadedFileBridge.php @@ -42,20 +42,20 @@ public static function getPsr7UploadedFiles( ): array { if (! (self::$_instance instanceof UploadedFileBridge)) { if ($isBurner) { - $isWorkerMan = false; + $needNewInstance = false; $check = reset($files); if (is_array($check)) { - $isWorkerMan = true; + $needNewInstance = true; $multiCheck = reset($check); if ($multiCheck instanceof \Psr\Http\Message\UploadedFileInterface) { - $isWorkerMan = false; + $needNewInstance = false; } } self::$_instance = new UploadedFileBridge( $files, $isBurner, - // is WorkerMan files? - $isWorkerMan + // is need new file instance ? + $needNewInstance ); } else { self::$_instance = new UploadedFileBridge(); diff --git a/src/Commands/InitLibrary.php b/src/Commands/InitLibrary.php index 802f0e8..a42477f 100644 --- a/src/Commands/InitLibrary.php +++ b/src/Commands/InitLibrary.php @@ -89,7 +89,7 @@ public function run(array $params) protected function publishBurnerConfig(string $driver) { - $basePath = ROOTPATH . 'app/Config' . DIRECTORY_SEPARATOR; + $basePath = APPPATH . 'Config' . DIRECTORY_SEPARATOR; $configPath = $basePath . 'Burner.php'; if (file_exists($configPath)) { diff --git a/src/FrontLoader.php b/src/FrontLoader.php index 6450f32..5cd4fa7 100644 --- a/src/FrontLoader.php +++ b/src/FrontLoader.php @@ -18,10 +18,8 @@ exit; } -$paths = 'app/Config/Paths.php'; - require_once realpath($vendorPath . 'autoload.php'); -$pathsConfig = realpath($vendorPath . '../app/Config/Paths.php'); +$pathsConfig = realpath( APPPATH . '/Config/Paths.php'); // Path to the front loader (this file) defined('FCPATH') || define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR); chdir(FCPATH);