Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | public function setRemoteAddress($remote_address) { | ||||
$this->remoteAddress = $remote_address; | $this->remoteAddress = $remote_address; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getRemoteAddress() { | public function getRemoteAddress() { | ||||
return $this->remoteAddress; | return $this->remoteAddress; | ||||
} | } | ||||
private function getRemoteAddressForLog() { | |||||
// If whatever we have here isn't a valid IPv4 address, just store `null`. | |||||
// Older versions of PHP return `-1` on failure instead of `false`. | |||||
$remote_address = $this->getRemoteAddress(); | |||||
$remote_address = max(0, ip2long($remote_address)); | |||||
$remote_address = nonempty($remote_address, null); | |||||
return $remote_address; | |||||
} | |||||
public function setSubversionTransactionInfo($transaction, $repository) { | public function setSubversionTransactionInfo($transaction, $repository) { | ||||
$this->subversionTransaction = $transaction; | $this->subversionTransaction = $transaction; | ||||
$this->subversionRepository = $repository; | $this->subversionRepository = $repository; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setStdin($stdin) { | public function setStdin($stdin) { | ||||
$this->stdin = $stdin; | $this->stdin = $stdin; | ||||
▲ Show 20 Lines • Show All 997 Lines • ▼ Show 20 Lines | return PhabricatorRepositoryPushLog::initializeNewLog($this->getViewer()) | ||||
->attachRepository($this->getRepository()) | ->attachRepository($this->getRepository()) | ||||
->setEpoch(time()); | ->setEpoch(time()); | ||||
} | } | ||||
private function newPushEvent() { | private function newPushEvent() { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
return PhabricatorRepositoryPushEvent::initializeNewEvent($viewer) | return PhabricatorRepositoryPushEvent::initializeNewEvent($viewer) | ||||
->setRepositoryPHID($this->getRepository()->getPHID()) | ->setRepositoryPHID($this->getRepository()->getPHID()) | ||||
->setRemoteAddress($this->getRemoteAddressForLog()) | ->setRemoteAddress($this->getRemoteAddress()) | ||||
->setRemoteProtocol($this->getRemoteProtocol()) | ->setRemoteProtocol($this->getRemoteProtocol()) | ||||
->setEpoch(time()); | ->setEpoch(time()); | ||||
} | } | ||||
public function loadChangesetsForCommit($identifier) { | public function loadChangesetsForCommit($identifier) { | ||||
$byte_limit = HeraldCommitAdapter::getEnormousByteLimit(); | $byte_limit = HeraldCommitAdapter::getEnormousByteLimit(); | ||||
$time_limit = HeraldCommitAdapter::getEnormousTimeLimit(); | $time_limit = HeraldCommitAdapter::getEnormousTimeLimit(); | ||||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |