From 24446dca9e5d1e9f13f8372f7e5010f417555a34 Mon Sep 17 00:00:00 2001 From: Darren Gao Date: Thu, 16 Nov 2017 11:30:46 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fixed=20issue=20#893=20=20=20=20=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=9C=AB=E5=B0=BE=E5=A4=9A=E4=BD=99=E7=9A=84?= =?UTF-8?q?=E2=80=9C=E5=B9=B6=E2=80=9D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6cefcb38..8b40ef90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ ThinkPHP 目前使用 Git 来控制程序版本,如果你想为 ThinkPHP 贡献源代码,请先大致了解 Git 的使用方法。我们目前把项目托管在 GitHub 上,任何 GitHub 用户都可以向我们贡献代码。 -参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请并。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。 +参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。 我们希望你贡献的代码符合: From 21c1dc40e8676000478b3668964bbd75b9d1a971 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 16 Nov 2017 14:18:00 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BBsave?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=AF=B9oracle=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index d7f91db0..dc150d78 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1103,9 +1103,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 检测字段 $allowFields = $this->checkAllowField(array_merge($this->auto, $this->insert)); if (!empty($allowFields)) { - $result = $this->getQuery()->strict(false)->field($allowFields)->insert($this->data); + $result = $this->getQuery()->strict(false)->field($allowFields)->insert($this->data, false, false, $sequence); } else { - $result = $this->getQuery()->insert($this->data); + $result = $this->getQuery()->insert($this->data, false, false, $sequence); } // 获取自动增长主键 From 9f8b4f935768d938891ced5b4f50021858a764b8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 16 Nov 2017 15:43:21 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8D=95=E4=B8=AA=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=94=AF=E6=8C=81=E5=A4=A7=E5=B0=8F=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/log/driver/File.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 98f117af..37d2ca8d 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -20,10 +20,10 @@ class File { protected $config = [ 'time_format' => ' c ', + 'single' => false, 'file_size' => 2097152, 'path' => LOG_PATH, 'apart_level' => [], - 'single' => false, ]; protected $writed = []; @@ -84,7 +84,7 @@ class File protected function write($message, $destination, $apart = false) { //检测日志文件大小,超过配置大小则备份日志文件重新生成 - if (!$this->config['single'] && is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { + if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { rename($destination, dirname($destination) . DS . time() . '-' . basename($destination)); $this->writed[$destination] = false; } From 3fd0d5eb00cd9722d1a7f799faf05ac9691e6291 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 16 Nov 2017 16:01:48 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/log/driver/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 37d2ca8d..f3abc3d7 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -66,7 +66,7 @@ class File if (in_array($type, $this->config['apart_level'])) { // 独立记录的日志级别 if ($this->config['single']) { - $filename = $path . $type . '.log'; + $filename = $path . DS . $type . '.log'; } else { $filename = $path . DS . date('d') . '_' . $type . $cli . '.log'; } From c661cc7c467676bb9f2430037cebbe1d800a96bd Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 16 Nov 2017 17:45:21 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84ip=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 2 +- library/think/log/driver/File.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/Request.php b/library/think/Request.php index 9d215bb5..1124700d 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -1265,7 +1265,7 @@ class Request * @param boolean $adv 是否进行高级模式获取(有可能被伪装) * @return mixed */ - public function ip($type = 0, $adv = false) + public function ip($type = 0, $adv = true) { $type = $type ? 1 : 0; static $ip = null; diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index f3abc3d7..236e21bd 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -12,6 +12,7 @@ namespace think\log\driver; use think\App; +use think\Request; /** * 本地化调试输出到文件 @@ -108,11 +109,10 @@ class File $message = '[ info ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n" . $message; } $now = date($this->config['time_format']); - $server = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '0.0.0.0'; - $remote = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; + $ip = Request::instance()->ip(); $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'CLI'; $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; - $message = "---------------------------------------------------------------\r\n[{$now}] {$server} {$remote} {$method} {$uri}\r\n" . $message; + $message = "---------------------------------------------------------------\r\n[{$now}] {$ip} {$method} {$uri}\r\n" . $message; $this->writed[$destination] = true; }