From 7e48ea11cff5ec5d83d45dbab212fa00cd85e427 Mon Sep 17 00:00:00 2001 From: qw5414 Date: Mon, 1 Feb 2016 08:03:03 +0900 Subject: [PATCH] =?UTF-8?q?slowlog=20=EB=A5=BC=20=EC=9B=90=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=95=84=EC=9D=B4=ED=94=BC=EC=97=90=EC=84=9C?= =?UTF-8?q?=EB=A7=8C=20=EC=8B=A4=ED=96=89=20=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/debug.php | 19 +++++++++++++++++++ common/legacy.php | 1 + 2 files changed, 20 insertions(+) diff --git a/common/debug.php b/common/debug.php index 4c8f0db89..0e56fac0b 100644 --- a/common/debug.php +++ b/common/debug.php @@ -109,6 +109,25 @@ if(!defined('__LOG_SLOW_WIDGET__')) define('__LOG_SLOW_WIDGET__', 0); } +/** + * output comments of the slowlog files + * + * 0: No limit (not recommended) + * 1: Allow only specified IP addresses + */ +if(!defined('__LOG_SLOW_PROTECT__')) +{ + define('__LOG_SLOW_PROTECT__', 1); +} + +/** + * Set a ip address to allow slowlog + */ +if(!defined('__LOG_SLOW_PROTECT_IP__')) +{ + define('__LOG_SLOW_PROTECT_IP__', '127.0.0.1'); +} + /** * Leave DB query information * diff --git a/common/legacy.php b/common/legacy.php index b2739bf07..82ddabc8b 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -822,6 +822,7 @@ function debugPrint($debug_output = NULL, $display_option = TRUE, $file = '_debu function writeSlowlog($type, $elapsed_time, $obj) { if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; + if(__LOG_SLOW_PROTECT__ === 1 && __LOG_SLOW_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) return; static $log_filename = array( 'query' => 'files/_slowlog_query.php',