[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorSSHLog extends Phobject { 4 5 static $log; 6 7 public static function getLog() { 8 if (!self::$log) { 9 $path = PhabricatorEnv::getEnvConfig('log.ssh.path'); 10 $format = PhabricatorEnv::getEnvConfig('log.ssh.format'); 11 $format = nonempty( 12 $format, 13 "[%D]\t%p\t%h\t%r\t%s\t%S\t%u\t%C\t%U\t%c\t%T\t%i\t%o"); 14 15 // NOTE: Path may be null. We still create the log, it just won't write 16 // anywhere. 17 18 $data = array( 19 'D' => date('r'), 20 'h' => php_uname('n'), 21 'p' => getmypid(), 22 'e' => time(), 23 ); 24 25 $sudo_user = PhabricatorEnv::getEnvConfig('phd.user'); 26 if (strlen($sudo_user)) { 27 $data['S'] = $sudo_user; 28 } 29 30 if (function_exists('posix_geteuid')) { 31 $system_uid = posix_geteuid(); 32 $system_info = posix_getpwuid($system_uid); 33 $data['s'] = idx($system_info, 'name'); 34 } 35 36 $client = getenv('SSH_CLIENT'); 37 if (strlen($client)) { 38 $remote_address = head(explode(' ', $client)); 39 $data['r'] = $remote_address; 40 } 41 42 $log = id(new PhutilDeferredLog($path, $format)) 43 ->setFailQuietly(true) 44 ->setData($data); 45 46 self::$log = $log; 47 } 48 49 return self::$log; 50 } 51 52 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |