From f1ca9d9b3548351a3b02692e0f77d96d618d5489 Mon Sep 17 00:00:00 2001 From: Rhilip Date: Thu, 21 Feb 2019 20:05:25 +0800 Subject: [PATCH] build(Compatible): Remove Compatible Model Since our composer require `ext-swoole` , it's not need to keep the compatible model BREAKING CHANGE: Remove Compatible Model --- apps/config/http_compatible.php | 23 ------ apps/public/index.php | 10 --- framework/Http/Compatible/Request.php | 48 ------------ framework/Http/Compatible/Response.php | 78 ------------------- ..._permanent.nginx.conf => ridpt.nginx.conf} | 0 migration/ridpt_compatible.nginx.conf | 52 ------------- 6 files changed, 211 deletions(-) delete mode 100644 apps/config/http_compatible.php delete mode 100644 apps/public/index.php delete mode 100644 framework/Http/Compatible/Request.php delete mode 100644 framework/Http/Compatible/Response.php rename migration/{ridpt_permanent.nginx.conf => ridpt.nginx.conf} (100%) delete mode 100644 migration/ridpt_compatible.nginx.conf diff --git a/apps/config/http_compatible.php b/apps/config/http_compatible.php deleted file mode 100644 index 7811f8b..0000000 --- a/apps/config/http_compatible.php +++ /dev/null @@ -1,23 +0,0 @@ - [ - 'request' => [ - 'class' => Rid\Http\Compatible\Request::class, - ], - - 'response' => [ - 'class' => Rid\Http\Compatible\Response::class, - ], - - 'error' => [ - 'level' => E_ALL, - ], - ], -]); diff --git a/apps/public/index.php b/apps/public/index.php deleted file mode 100644 index 35396c7..0000000 --- a/apps/public/index.php +++ /dev/null @@ -1,10 +0,0 @@ -run(); diff --git a/framework/Http/Compatible/Request.php b/framework/Http/Compatible/Request.php deleted file mode 100644 index 0774e81..0000000 --- a/framework/Http/Compatible/Request.php +++ /dev/null @@ -1,48 +0,0 @@ -_get = $_GET; - $this->_post = $_POST; - $this->_files = $_FILES; - $this->_cookie = $_COOKIE; - $this->setHeader(); - $this->setServer(); - } - - // 设置 HEADER 值 - protected function setHeader() - { - $header = []; - foreach ($_SERVER as $name => $value) { - if (substr($name, 0, 5) == 'HTTP_') { - $header[str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($name, 5))))] = $value; - unset($_SERVER[$name]); - } - } - $this->_header = $header; - } - - // 设置 SERVER 值 - protected function setServer() - { - $this->_server = array_change_key_case($_SERVER, CASE_LOWER); - } - - // 返回原始的HTTP包体 - public function getRawBody() - { - return file_get_contents('php://input'); - } - -} diff --git a/framework/Http/Compatible/Response.php b/framework/Http/Compatible/Response.php deleted file mode 100644 index 842d69e..0000000 --- a/framework/Http/Compatible/Response.php +++ /dev/null @@ -1,78 +0,0 @@ -format = $this->defaultFormat; - $this->statusCode = 200; - $this->content = ''; - $this->headers = []; - $this->_isSent = false; - } - - // 设置Cookie - public function setCookie($name, $value = '', $expires = 0, $path = '', $domain = '', $secure = false, $httpOnly = false) - { - return setcookie($name, $value, $expires, $path, $domain, $secure, $httpOnly); - } - - // 重定向 - public function redirect($url) - { - $this->setHeader('Location', $url); - } - - // 发送 - public function send() - { - // 多次发送处理 - if ($this->_isSent) { - return; - } - $this->_isSent = true; - // 预处理 - $this->prepare(); - // 清扫组件容器 - \Rid::app()->cleanComponents(); - // 发送 - $this->sendStatusCode(); - $this->sendHeaders(); - $this->sendContent(); - } - - // 发送HTTP状态码 - protected function sendStatusCode() - { - header("HTTP/1.1 {$this->statusCode}"); - } - - // 发送Header信息 - protected function sendHeaders() - { - foreach ($this->headers as $key => $value) { - header("{$key}: {$value}"); - } - } - - // 发送内容 - protected function sendContent() - { - // 非标量处理 - if (!is_scalar($this->content)) { - $this->content = ucfirst(gettype($this->content)); - } - // 发送内容 - echo $this->content; - } - -} diff --git a/migration/ridpt_permanent.nginx.conf b/migration/ridpt.nginx.conf similarity index 100% rename from migration/ridpt_permanent.nginx.conf rename to migration/ridpt.nginx.conf diff --git a/migration/ridpt_compatible.nginx.conf b/migration/ridpt_compatible.nginx.conf deleted file mode 100644 index f21fbcd..0000000 --- a/migration/ridpt_compatible.nginx.conf +++ /dev/null @@ -1,52 +0,0 @@ -server - { - listen 80; - #listen [::]:80; - server_name ridpt.rhilip.info ; - index index.html index.htm index.php default.html default.htm default.php; - root /data/wwwroot/ridpt.rhilip.info/apps/public/; - index index.php index.html index.htm; - - #error_page 404 /404.html; - - # Deny access to PHP files in specific directory - location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } - - location / { - if (!-e $request_filename) { - rewrite ^/(.*)$ /index.php/$1 last; - } - } - - location ~ ^(.+\.php)(.*)$ { - #fastcgi_pass 127.0.0.1:9000; - fastcgi_pass unix:/dev/shm/php-cgi.sock; - fastcgi_split_path_info ^(.+\.php)(.*)$; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_index index.php; - include fastcgi_params; - } - - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ - { - expires 30d; - } - - location ~ .*\.(js|css)?$ - { - expires 12h; - } - - location ~ /.well-known { - allow all; - } - - location ~ /\. - { - deny all; - } - - access_log /data/wwwlogs/ridpt.rhilip.info.log; - error_log /data/wwwlogs/ridpt_error.log; - }