Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/protocol/DiffusionCommandEngine.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | public function setProtocol($protocol) { | ||||
$this->protocol = $protocol; | $this->protocol = $protocol; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getProtocol() { | public function getProtocol() { | ||||
return $this->protocol; | return $this->protocol; | ||||
} | } | ||||
public function getDisplayProtocol() { | |||||
return $this->getProtocol().'://'; | |||||
} | |||||
public function setCredentialPHID($credential_phid) { | public function setCredentialPHID($credential_phid) { | ||||
$this->credentialPHID = $credential_phid; | $this->credentialPHID = $credential_phid; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getCredentialPHID() { | public function getCredentialPHID() { | ||||
return $this->credentialPHID; | return $this->credentialPHID; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | if ($this->isAnySSHProtocol()) { | ||||
if ($as_device) { | if ($as_device) { | ||||
$env['PHABRICATOR_AS_DEVICE'] = 1; | $env['PHABRICATOR_AS_DEVICE'] = 1; | ||||
} | } | ||||
} | } | ||||
return $env; | return $env; | ||||
} | } | ||||
protected function isSSHProtocol() { | public function isSSHProtocol() { | ||||
return ($this->getProtocol() == 'ssh'); | return ($this->getProtocol() == 'ssh'); | ||||
} | } | ||||
protected function isSVNProtocol() { | public function isSVNProtocol() { | ||||
return ($this->getProtocol() == 'svn'); | return ($this->getProtocol() == 'svn'); | ||||
} | } | ||||
protected function isSVNSSHProtocol() { | public function isSVNSSHProtocol() { | ||||
return ($this->getProtocol() == 'svn+ssh'); | return ($this->getProtocol() == 'svn+ssh'); | ||||
} | } | ||||
protected function isHTTPProtocol() { | public function isHTTPProtocol() { | ||||
return ($this->getProtocol() == 'http'); | return ($this->getProtocol() == 'http'); | ||||
} | } | ||||
protected function isHTTPSProtocol() { | public function isHTTPSProtocol() { | ||||
return ($this->getProtocol() == 'https'); | return ($this->getProtocol() == 'https'); | ||||
} | } | ||||
protected function isAnyHTTPProtocol() { | public function isAnyHTTPProtocol() { | ||||
return ($this->isHTTPProtocol() || $this->isHTTPSProtocol()); | return ($this->isHTTPProtocol() || $this->isHTTPSProtocol()); | ||||
} | } | ||||
protected function isAnySSHProtocol() { | public function isAnySSHProtocol() { | ||||
return ($this->isSSHProtocol() || $this->isSVNSSHProtocol()); | return ($this->isSSHProtocol() || $this->isSVNSSHProtocol()); | ||||
} | } | ||||
public function isCredentialSupported() { | |||||
return ($this->getPassphraseProvidesCredentialType() !== null); | |||||
} | |||||
public function isCredentialOptional() { | |||||
if ($this->isAnySSHProtocol()) { | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
public function getPassphraseCredentialLabel() { | |||||
if ($this->isAnySSHProtocol()) { | |||||
return pht('SSH Key'); | |||||
} | |||||
if ($this->isAnyHTTPProtocol() || $this->isSVNProtocol()) { | |||||
return pht('Password'); | |||||
} | |||||
return null; | |||||
} | |||||
public function getPassphraseDefaultCredentialType() { | |||||
if ($this->isAnySSHProtocol()) { | |||||
return PassphraseSSHPrivateKeyTextCredentialType::CREDENTIAL_TYPE; | |||||
} | |||||
if ($this->isAnyHTTPProtocol() || $this->isSVNProtocol()) { | |||||
return PassphrasePasswordCredentialType::CREDENTIAL_TYPE; | |||||
} | |||||
return null; | |||||
} | |||||
public function getPassphraseProvidesCredentialType() { | |||||
if ($this->isAnySSHProtocol()) { | |||||
return PassphraseSSHPrivateKeyCredentialType::PROVIDES_TYPE; | |||||
} | |||||
if ($this->isAnyHTTPProtocol() || $this->isSVNProtocol()) { | |||||
return PassphrasePasswordCredentialType::PROVIDES_TYPE; | |||||
} | |||||
return null; | |||||
} | |||||
protected function getSSHWrapper() { | protected function getSSHWrapper() { | ||||
$root = dirname(phutil_get_library_root('phabricator')); | $root = dirname(phutil_get_library_root('phabricator')); | ||||
return $root.'/bin/ssh-connect'; | return $root.'/bin/ssh-connect'; | ||||
} | } | ||||
} | } |