mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Disable Geoip if in CLI mode - this fixes the tests from breaking. The geoip command won't be available in CLI context
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@75161 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8e72a975b0
commit
d8b22a0582
@ -278,6 +278,9 @@ class Geoip extends Object {
|
||||
* @param boolean $codeOnly Returns just the country code
|
||||
*/
|
||||
static function ip2country($address, $codeOnly = false) {
|
||||
// Return if in CLI, or you'll get this error: "sh: geoiplookup: command not found"
|
||||
if(Director::is_cli()) return false;
|
||||
|
||||
$cmd = 'geoiplookup ' . escapeshellarg($address);
|
||||
exec($cmd, $result, $code);
|
||||
// Note: At time of writing, $result is always zero for this program
|
||||
|
Loading…
x
Reference in New Issue
Block a user