mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Merge pull request #207 from vvavrychuk/daemon
use available api to check daemon status
This commit is contained in:
commit
7dd8851a61
1 changed files with 10 additions and 7 deletions
|
@ -37,12 +37,15 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
|
|||
return $response->setContent($page->render());
|
||||
}
|
||||
|
||||
private function isPullDaemonRunningOnThisMachine() {
|
||||
|
||||
// This is sort of hacky, but should probably work.
|
||||
|
||||
list($stdout) = execx('ps auxwww');
|
||||
return preg_match('/PhabricatorRepositoryPullLocalDaemon/', $stdout);
|
||||
private function isPullDaemonRunning() {
|
||||
$control = new PhabricatorDaemonControl();
|
||||
$daemons = $control->loadRunningDaemons();
|
||||
foreach ($daemons as $daemon) {
|
||||
if ($daemon->isRunning() &&
|
||||
$daemon->getName() == 'PhabricatorRepositoryPullLocalDaemon')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function renderDaemonNotice() {
|
||||
|
@ -60,7 +63,7 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
|
|||
"<strong>{$documentation}</strong>.";
|
||||
|
||||
try {
|
||||
$daemon_running = $this->isPullDaemonRunningOnThisMachine();
|
||||
$daemon_running = $this->isPullDaemonRunning();
|
||||
if ($daemon_running) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue