Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/ssh/ConduitSSHWorkflow.php
| Show All 40 Lines | public function execute(PhutilArgumentParser $args) { | ||||
| unset($params['__conduit__']); | unset($params['__conduit__']); | ||||
| $call = null; | $call = null; | ||||
| $error_code = null; | $error_code = null; | ||||
| $error_info = null; | $error_info = null; | ||||
| try { | try { | ||||
| $call = new ConduitCall($method, $params); | $call = new ConduitCall($method, $params); | ||||
| $call->setUser($this->getUser()); | $call->setUser($this->getSSHUser()); | ||||
| $result = $call->execute(); | $result = $call->execute(); | ||||
| } catch (ConduitException $ex) { | } catch (ConduitException $ex) { | ||||
| $result = null; | $result = null; | ||||
| $error_code = $ex->getMessage(); | $error_code = $ex->getMessage(); | ||||
| if ($ex->getErrorDescription()) { | if ($ex->getErrorDescription()) { | ||||
| $error_info = $ex->getErrorDescription(); | $error_info = $ex->getErrorDescription(); | ||||
| } else if ($call) { | } else if ($call) { | ||||
| Show All 14 Lines | public function execute(PhutilArgumentParser $args) { | ||||
| // NOTE: Flush here so we can get an accurate result for the duration, | // NOTE: Flush here so we can get an accurate result for the duration, | ||||
| // if the response is large and the receiver is slow to read it. | // if the response is large and the receiver is slow to read it. | ||||
| $this->getIOChannel()->flush(); | $this->getIOChannel()->flush(); | ||||
| $time_end = microtime(true); | $time_end = microtime(true); | ||||
| $connection_id = idx($metadata, 'connectionID'); | $connection_id = idx($metadata, 'connectionID'); | ||||
| $log = id(new PhabricatorConduitMethodCallLog()) | $log = id(new PhabricatorConduitMethodCallLog()) | ||||
| ->setCallerPHID($this->getUser()->getPHID()) | ->setCallerPHID($this->getSSHUser()->getPHID()) | ||||
| ->setConnectionID($connection_id) | ->setConnectionID($connection_id) | ||||
| ->setMethod($method) | ->setMethod($method) | ||||
| ->setError((string)$error_code) | ->setError((string)$error_code) | ||||
| ->setDuration(1000000 * ($time_end - $time_start)) | ->setDuration(1000000 * ($time_end - $time_start)) | ||||
| ->save(); | ->save(); | ||||
| } | } | ||||
| } | } | ||||