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:
epriestley
2013-12-05 11:59:22 -08:00
parent caa6fdf56d
commit e28b848ab2
5 changed files with 80 additions and 13 deletions

View File

@@ -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();