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:
@@ -41,6 +41,10 @@ final class DiffusionPushLogListController extends DiffusionController
|
||||
),
|
||||
$callsign),
|
||||
$this->getHandle($log->getPusherPHID())->renderLink(),
|
||||
$log->getRemoteAddress()
|
||||
? long2ip($log->getRemoteAddress())
|
||||
: null,
|
||||
$log->getRemoteProtocol(),
|
||||
$log->getRefType(),
|
||||
$log->getRefName(),
|
||||
$log->getRefOldShort(),
|
||||
@@ -54,6 +58,8 @@ final class DiffusionPushLogListController extends DiffusionController
|
||||
array(
|
||||
pht('Repository'),
|
||||
pht('Pusher'),
|
||||
pht('From'),
|
||||
pht('Via'),
|
||||
pht('Type'),
|
||||
pht('Name'),
|
||||
pht('Old'),
|
||||
@@ -62,6 +68,8 @@ final class DiffusionPushLogListController extends DiffusionController
|
||||
))
|
||||
->setColumnClasses(
|
||||
array(
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
|
||||
@@ -318,12 +318,11 @@ final class DiffusionServeController extends DiffusionController {
|
||||
'PATH_INFO' => $request_path,
|
||||
|
||||
'REMOTE_USER' => $viewer->getUsername(),
|
||||
'PHABRICATOR_USER' => $viewer->getUsername(),
|
||||
|
||||
// TODO: Set these correctly.
|
||||
// GIT_COMMITTER_NAME
|
||||
// GIT_COMMITTER_EMAIL
|
||||
);
|
||||
) + $this->getCommonEnvironment($viewer);
|
||||
|
||||
$input = PhabricatorStartup::getRawInput();
|
||||
|
||||
@@ -416,9 +415,7 @@ final class DiffusionServeController extends DiffusionController {
|
||||
throw new Exception("Unable to find `hg` in PATH!");
|
||||
}
|
||||
|
||||
$env = array(
|
||||
'PHABRICATOR_USER' => $viewer->getUsername(),
|
||||
);
|
||||
$env = $this->getCommonEnvironment($viewer);
|
||||
$input = PhabricatorStartup::getRawInput();
|
||||
|
||||
$cmd = $request->getStr('cmd');
|
||||
@@ -557,5 +554,15 @@ final class DiffusionServeController extends DiffusionController {
|
||||
return $has_pack && $is_hangup;
|
||||
}
|
||||
|
||||
private function getCommonEnvironment(PhabricatorUser $viewer) {
|
||||
$remote_addr = $this->getRequest()->getRemoteAddr();
|
||||
|
||||
return array(
|
||||
DiffusionCommitHookEngine::ENV_USER => $viewer->getUsername(),
|
||||
DiffusionCommitHookEngine::ENV_REMOTE_ADDRESS => $remote_addr,
|
||||
DiffusionCommitHookEngine::ENV_REMOTE_PROTOCOL => 'http',
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user