diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-03-10 07:01:14 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-03-10 07:01:14 +0300 |
commit | 090f9a418db83677431a5f6a5b26dea83789eb13 (patch) | |
tree | df7686583460b2bdb21d057f9cab86ad4c684e33 /plugins/Provider | |
parent | a1fe093ab4cd5243ef3ff22ebd5f6814a6e1c4a7 (diff) |
Removed all deprecated methods of the Piwik\IP class
This should fix the unit tests.
Diffstat (limited to 'plugins/Provider')
-rw-r--r-- | plugins/Provider/Columns/Provider.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/Provider/Columns/Provider.php b/plugins/Provider/Columns/Provider.php index 24ab6cecd2..b7ca57e9c9 100644 --- a/plugins/Provider/Columns/Provider.php +++ b/plugins/Provider/Columns/Provider.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\Provider\Columns; use Piwik\Common; -use Piwik\IP; +use Piwik\Network\IP; use Piwik\Network\IPUtils; use Piwik\Piwik; use Piwik\Plugin\Dimension\VisitDimension; @@ -87,12 +87,17 @@ class Provider extends VisitDimension /** * Returns the hostname given the IP address string * - * @param string $ip IP Address + * @param string $ipStr IP Address * @return string hostname (or human-readable IP address) */ - private function getHost($ip) + private function getHost($ipStr) { - return trim(strtolower(@IP::getHostByAddr($ip))); + $ip = IP::fromStringIP($ipStr); + + $host = $ip->getHostname(); + $host = ($host === null ? $ipStr : $host); + + return trim(strtolower($host)); } public function getName() |