Path: blob/master/src/applications/diffusion/ssh/DiffusionGitUploadPackSSHWorkflow.php
12242 views
<?php12final class DiffusionGitUploadPackSSHWorkflow3extends DiffusionGitSSHWorkflow {45protected function didConstruct() {6$this->setName('git-upload-pack');7$this->setArguments(8array(9array(10'name' => 'dir',11'wildcard' => true,12),13));14}1516protected function executeRepositoryOperations() {17$is_proxy = $this->shouldProxy();18if ($is_proxy) {19return $this->executeRepositoryProxyOperations($for_write = false);20}2122$viewer = $this->getSSHUser();23$repository = $this->getRepository();24$device = AlmanacKeys::getLiveDevice();2526$skip_sync = $this->shouldSkipReadSynchronization();2728$command = csprintf('git-upload-pack -- %s', $repository->getLocalPath());29if (!$skip_sync) {30$cluster_engine = id(new DiffusionRepositoryClusterEngine())31->setViewer($viewer)32->setRepository($repository)33->setLog($this)34->synchronizeWorkingCopyBeforeRead();3536if ($device) {37$this->writeClusterEngineLogMessage(38pht(39"# Cleared to fetch on cluster host \"%s\".\n",40$device->getName()));41}42}4344$command = PhabricatorDaemon::sudoCommandAsDaemonUser($command);4546$pull_event = $this->newPullEvent();4748$future = id(new ExecFuture('%C', $command))49->setEnv($this->getEnvironment());5051$log = $this->newProtocolLog($is_proxy);52if ($log) {53$this->setProtocolLog($log);54$log->didStartSession($command);55}5657if (PhabricatorEnv::getEnvConfig('phabricator.show-prototypes')) {58$protocol = new DiffusionGitUploadPackWireProtocol();59if ($log) {60$protocol->setProtocolLog($log);61}62$this->setWireProtocol($protocol);63}6465$err = $this->newPassthruCommand()66->setIOChannel($this->getIOChannel())67->setCommandChannelFromExecFuture($future)68->execute();6970if ($log) {71$log->didEndSession();72}7374if ($err) {75$pull_event76->setResultType(PhabricatorRepositoryPullEvent::RESULT_ERROR)77->setResultCode($err);78} else {79$pull_event80->setResultType(PhabricatorRepositoryPullEvent::RESULT_PULL)81->setResultCode(0);82}8384$pull_event->save();8586if (!$err) {87$this->waitForGitClient();88}8990return $err;91}9293}949596