Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistInstallCertificateWorkflow.php
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | public function run() { | ||||
$console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
$uri = $this->determineConduitURI(); | $uri = $this->determineConduitURI(); | ||||
$this->setConduitURI($uri); | $this->setConduitURI($uri); | ||||
$configuration_manager = $this->getConfigurationManager(); | $configuration_manager = $this->getConfigurationManager(); | ||||
$config = $configuration_manager->readUserConfigurationFile(); | $config = $configuration_manager->readUserConfigurationFile(); | ||||
$console->writeOut( | $this->writeInfo( | ||||
"%s\n", | pht('CONNECT'), | ||||
pht('Trying to connect to server...')); | pht( | ||||
'Connecting to "%s"...', | |||||
$uri)); | |||||
$conduit = $this->establishConduit()->getConduit(); | $conduit = $this->establishConduit()->getConduit(); | ||||
try { | try { | ||||
$conduit->callMethodSynchronous('conduit.ping', array()); | $conduit->callMethodSynchronous('conduit.ping', array()); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
pht( | pht( | ||||
'Failed to connect to server (%s): %s', | 'Failed to connect to server (%s): %s', | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | if (count($uri) > 1) { | ||||
pht( | pht( | ||||
'Specify an explicit URI or run this command from within a '. | 'Specify an explicit URI or run this command from within a '. | ||||
'project which is configured with a %s.', | 'project which is configured with a %s.', | ||||
'.arcconfig')); | '.arcconfig')); | ||||
} | } | ||||
$uri = $conduit_uri; | $uri = $conduit_uri; | ||||
} | } | ||||
$uri = new PhutilURI($uri); | $uri_object = new PhutilURI($uri); | ||||
$uri->setPath('/api/'); | if (!$uri_object->getProtocol() || !$uri_object->getDomain()) { | ||||
throw new ArcanistUsageException( | |||||
pht( | |||||
'Server URI "%s" must include a protocol and domain. It should be '. | |||||
'in the form "%s".', | |||||
$uri, | |||||
'https://phabricator.example.com/')); | |||||
} | |||||
$uri_object->setPath('/api/'); | |||||
return (string)$uri; | return (string)$uri_object; | ||||
} | } | ||||
} | } |