diff --git a/resources/sql/patches/daemonstatuskey.sql b/resources/sql/patches/daemonstatuskey.sql new file mode 100644 index 0000000000..9ce5291f8a --- /dev/null +++ b/resources/sql/patches/daemonstatuskey.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_daemon.daemon_log + ADD KEY `status` (`status`); diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php index 0e3bedd141..9e22d25f0c 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php @@ -21,7 +21,7 @@ final class PhabricatorDaemonConsoleController public function processRequest() { $logs = id(new PhabricatorDaemonLog())->loadAllWhere( - '1 = 1 ORDER BY id DESC LIMIT 15'); + '`status` != %s ORDER BY id DESC LIMIT 15', 'exit'); $request = $this->getRequest(); $user = $request->getUser(); @@ -31,22 +31,7 @@ final class PhabricatorDaemonConsoleController $daemon_table->setDaemonLogs($logs); $daemon_panel = new AphrontPanelView(); - $daemon_panel->setHeader( - 'Recently Launched Daemons'. - ' · '. - phutil_render_tag( - 'a', - array( - 'href' => '/daemon/log/', - ), - 'View All Daemons'). - ' · '. - phutil_render_tag( - 'a', - array( - 'href' => '/daemon/log/combined/', - ), - 'View Combined Log')); + $daemon_panel->setHeader('Recently Launched Daemons'); $daemon_panel->appendChild($daemon_table); $tasks = id(new PhabricatorWorkerTask())->loadAllWhere( diff --git a/src/applications/daemon/controller/PhabricatorDaemonController.php b/src/applications/daemon/controller/PhabricatorDaemonController.php index 7e2509142d..f4a5e90818 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonController.php @@ -24,6 +24,7 @@ abstract class PhabricatorDaemonController extends PhabricatorController { $nav->addLabel('Daemons'); $nav->addFilter('', 'Console', $this->getApplicationURI()); + $nav->addFilter('log?show=running', 'Running Daemons'); $nav->addFilter('log', 'All Daemons'); $nav->addFilter('log/combined', 'Combined Log'); diff --git a/src/applications/daemon/controller/PhabricatorDaemonLogListController.php b/src/applications/daemon/controller/PhabricatorDaemonLogListController.php index 9b1fca04bd..a06a6254b5 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonLogListController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonLogListController.php @@ -25,8 +25,14 @@ final class PhabricatorDaemonLogListController $pager = new AphrontPagerView(); $pager->setOffset($request->getInt('page')); + $clause = '1 = 1'; + if ($request->getStr('show') == 'running') { + $clause = "`status` != 'exit'"; + } + $logs = id(new PhabricatorDaemonLog())->loadAllWhere( - '1 = 1 ORDER BY id DESC LIMIT %d, %d', + '%Q ORDER BY id DESC LIMIT %d, %d', + $clause, $pager->getOffset(), $pager->getPageSize() + 1); diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php index 516d675583..a1934f6681 100644 --- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php @@ -964,6 +964,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList { 'type' => 'sql', 'name' => $this->getPatchPath('policy-project.sql'), ), + 'daemonstatuskey.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('daemonstatuskey.sql'), + ), ); }