1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +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());
}
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;
}