Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/protocol/DiffusionCommandEngine.php
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | public function setSudoAsDaemon($sudo_as_daemon) { | ||||
$this->sudoAsDaemon = $sudo_as_daemon; | $this->sudoAsDaemon = $sudo_as_daemon; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getSudoAsDaemon() { | public function getSudoAsDaemon() { | ||||
return $this->sudoAsDaemon; | return $this->sudoAsDaemon; | ||||
} | } | ||||
protected function shouldAlwaysSudo() { | |||||
return false; | |||||
} | |||||
public function newFuture() { | public function newFuture() { | ||||
$argv = $this->newCommandArgv(); | $argv = $this->newCommandArgv(); | ||||
$env = $this->newCommandEnvironment(); | $env = $this->newCommandEnvironment(); | ||||
$is_passthru = $this->getPassthru(); | $is_passthru = $this->getPassthru(); | ||||
if ($this->getSudoAsDaemon()) { | if ($this->getSudoAsDaemon() || $this->shouldAlwaysSudo()) { | ||||
$command = call_user_func_array('csprintf', $argv); | $command = call_user_func_array('csprintf', $argv); | ||||
$command = PhabricatorDaemon::sudoCommandAsDaemonUser($command); | $command = PhabricatorDaemon::sudoCommandAsDaemonUser($command); | ||||
$argv = array('%C', $command); | $argv = array('%C', $command); | ||||
} | } | ||||
if ($is_passthru) { | if ($is_passthru) { | ||||
$future = newv('PhutilExecPassthru', $argv); | $future = newv('PhutilExecPassthru', $argv); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |