]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4392 from MrPetovan/task/add-ip-restriction-to-dlogger
authorMichael Vogel <icarus@dabo.de>
Sun, 4 Feb 2018 15:47:28 +0000 (16:47 +0100)
committerGitHub <noreply@github.com>
Sun, 4 Feb 2018 15:47:28 +0000 (16:47 +0100)
Add IP restriction to dlogger

doc/htconfig.md
include/text.php

index 8a98dc1039a2b8c930869696c858babe9c0d9a43..e09c37b74d196ae1423f4d41fabb8b1ea55f5c90 100644 (file)
@@ -41,6 +41,7 @@ Example: To set the automatic database cleanup process add this line to your .ht
 * **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
 * **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL.
 * **dlogfile - location of the developer log file
+* **dlogip - restricts develop log writes to requests originating from this IP address
 * **frontend_worker_timeout** - Value in minutes after we think that a frontend task was killed by the webserver. Default value is 10.
 * **hsts** (Boolean) - Enables the sending of HTTP Strict Transport Security headers
 * **ignore_cache** (Boolean) - For development only. Disables the item cache.
index dc604124fd4bb8fbab371d7035447809ab026a03..26b153549f3909206ff0aaae470913c4ed01bd51 100644 (file)
@@ -737,12 +737,16 @@ function dlogger($msg, $level = 0) {
                return;
        }
 
-       $logfile = Config::get('system','dlogfile');
-
+       $logfile = Config::get('system', 'dlogfile');
        if (! $logfile) {
                return;
        }
 
+       $dlogip = Config::get('system', 'dlogip');
+       if (!is_null($dlogip) && $_SERVER['REMOTE_ADDR'] != $dlogip) {
+               return;
+       }
+
        if (count($LOGGER_LEVELS) == 0) {
                foreach (get_defined_constants() as $k => $v) {
                        if (substr($k, 0, 7) == "LOGGER_") {