Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/log/PhabricatorSSHLog.php
Show All 29 Lines | if (!self::$log) { | ||||
if (function_exists('posix_geteuid')) { | if (function_exists('posix_geteuid')) { | ||||
$system_uid = posix_geteuid(); | $system_uid = posix_geteuid(); | ||||
$system_info = posix_getpwuid($system_uid); | $system_info = posix_getpwuid($system_uid); | ||||
$data['s'] = idx($system_info, 'name'); | $data['s'] = idx($system_info, 'name'); | ||||
} | } | ||||
$client = getenv('SSH_CLIENT'); | $client = getenv('SSH_CLIENT'); | ||||
if (strlen($client)) { | if (phutil_nonempty_string($client)) { | ||||
valerio.bozzolan: This replacement has sense since everything from `getenv()` should be a string and we should… | |||||
$remote_address = head(explode(' ', $client)); | $remote_address = head(explode(' ', $client)); | ||||
$data['r'] = $remote_address; | $data['r'] = $remote_address; | ||||
} | } | ||||
$log = id(new PhutilDeferredLog($path, $format)) | $log = id(new PhutilDeferredLog($path, $format)) | ||||
->setFailQuietly(true) | ->setFailQuietly(true) | ||||
->setData($data); | ->setData($data); | ||||
self::$log = $log; | self::$log = $log; | ||||
} | } | ||||
return self::$log; | return self::$log; | ||||
} | } | ||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
This replacement has sense since everything from getenv() should be a string and we should report otherwise.