Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepositoryURI.php
Show First 20 Lines • Show All 373 Lines • ▼ Show 20 Lines | switch ($this->getBuiltinProtocol()) { | ||||
case self::BUILTIN_PROTOCOL_HTTPS: | case self::BUILTIN_PROTOCOL_HTTPS: | ||||
return $phabricator_host; | return $phabricator_host; | ||||
default: | default: | ||||
return null; | return null; | ||||
} | } | ||||
} | } | ||||
private function getForcedPort() { | private function getForcedPort() { | ||||
switch ($this->getBuiltinProtocol()) { | $protocol = $this->getBuiltinProtocol(); | ||||
case self::BUILTIN_PROTOCOL_SSH: | |||||
if ($protocol == self::BUILTIN_PROTOCOL_SSH) { | |||||
return PhabricatorEnv::getEnvConfig('diffusion.ssh-port'); | return PhabricatorEnv::getEnvConfig('diffusion.ssh-port'); | ||||
case self::BUILTIN_PROTOCOL_HTTP: | } | ||||
case self::BUILTIN_PROTOCOL_HTTPS: | |||||
default: | // If Phabricator is running on a nonstandard port, use that as the defualt | ||||
// port for URIs with the same protocol. | |||||
$is_http = ($protocol == self::BUILTIN_PROTOCOL_HTTP); | |||||
$is_https = ($protocol == self::BUILTIN_PROTOCOL_HTTPS); | |||||
if ($is_http || $is_https) { | |||||
$uri = PhabricatorEnv::getURI('/'); | |||||
$uri = new PhutilURI($uri); | |||||
$port = $uri->getPort(); | |||||
if (!$port) { | |||||
return null; | |||||
} | |||||
$uri_protocol = $uri->getProtocol(); | |||||
$use_port = | |||||
($is_http && ($uri_protocol == 'http')) || | |||||
($is_https && ($uri_protocol == 'https')); | |||||
if (!$use_port) { | |||||
return null; | return null; | ||||
} | } | ||||
return $port; | |||||
} | |||||
return null; | |||||
} | } | ||||
private function getForcedPath() { | private function getForcedPath() { | ||||
if (!$this->isBuiltin()) { | if (!$this->isBuiltin()) { | ||||
return null; | return null; | ||||
} | } | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
▲ Show 20 Lines • Show All 346 Lines • Show Last 20 Lines |