1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

Merge pull request #207 from vvavrychuk/daemon

use available api to check daemon status
This commit is contained in:
Evan Priestley 2012-09-27 12:53:54 -07:00
commit 7dd8851a61

View file

@ -37,12 +37,15 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
return $response->setContent($page->render()); return $response->setContent($page->render());
} }
private function isPullDaemonRunningOnThisMachine() { private function isPullDaemonRunning() {
$control = new PhabricatorDaemonControl();
// This is sort of hacky, but should probably work. $daemons = $control->loadRunningDaemons();
foreach ($daemons as $daemon) {
list($stdout) = execx('ps auxwww'); if ($daemon->isRunning() &&
return preg_match('/PhabricatorRepositoryPullLocalDaemon/', $stdout); $daemon->getName() == 'PhabricatorRepositoryPullLocalDaemon')
return true;
}
return false;
} }
protected function renderDaemonNotice() { protected function renderDaemonNotice() {
@ -60,7 +63,7 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
"<strong>{$documentation}</strong>."; "<strong>{$documentation}</strong>.";
try { try {
$daemon_running = $this->isPullDaemonRunningOnThisMachine(); $daemon_running = $this->isPullDaemonRunning();
if ($daemon_running) { if ($daemon_running) {
return null; return null;
} }