From df7366a4535c8bd7e184fa3499638bbf8644ff09 Mon Sep 17 00:00:00 2001 From: Juri Hamburg Date: Fri, 2 Mar 2012 22:45:39 +0100 Subject: [PATCH] cache resolved hosts locally --- .../serendipity_event_statistics.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/serendipity_event_statistics/serendipity_event_statistics.php b/plugins/serendipity_event_statistics/serendipity_event_statistics.php index 5fcabbdb..674841f7 100644 --- a/plugins/serendipity_event_statistics/serendipity_event_statistics.php +++ b/plugins/serendipity_event_statistics/serendipity_event_statistics.php @@ -857,7 +857,14 @@ class serendipity_event_statistics extends serendipity_event echo "".wordwrap($row['browser'], 25, "
", 1)."\n"; echo ""; if ($row['ip']){ - echo wordwrap(gethostbyaddr($row['ip']), 25, "\n", 1); + $curIP = $row['ip']; + if (array_key_exists($curIP, $resolvedHosts)) { + $resolvedHost = $resolvedHosts[$curIP]; + } else { + $resolvedHost = gethostbyaddr($curIP); + $resolvedHosts[$curIP] = $resolvedHost; + } + echo wordwrap($resolvedHost, 25, "\n", 1); } else { echo "--"; }