Store pusher remote address and push protocol in PushLog
Summary: Ref T4195. Stores remote address and protocol in the logs, where possible. Test Plan: Pushed some stuff, looked at the log, saw data. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4195 Differential Revision: https://secure.phabricator.com/D7711
This commit is contained in:
@@ -18,9 +18,19 @@ abstract class DiffusionSSHWorkflow extends PhabricatorSSHWorkflow {
|
||||
}
|
||||
|
||||
public function getEnvironment() {
|
||||
return array(
|
||||
'PHABRICATOR_USER' => $this->getUser()->getUsername(),
|
||||
$env = array(
|
||||
DiffusionCommitHookEngine::ENV_USER => $this->getUser()->getUsername(),
|
||||
DiffusionCommitHookEngine::ENV_REMOTE_PROTOCOL => 'ssh',
|
||||
);
|
||||
|
||||
$ssh_client = getenv('SSH_CLIENT');
|
||||
if ($ssh_client) {
|
||||
// This has the format "<ip> <remote-port> <local-port>". Grab the IP.
|
||||
$remote_address = head(explode(' ', $ssh_client));
|
||||
$env[DiffusionCommitHookEngine::ENV_REMOTE_ADDRESS] = $remote_address;
|
||||
}
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
abstract protected function executeRepositoryOperations();
|
||||
|
||||
Reference in New Issue
Block a user