diff --git a/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php b/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php index 2f4ee2f4f5..113f3348d5 100644 --- a/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php +++ b/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php @@ -21,6 +21,10 @@ abstract class PhabricatorWorkerManagementWorkflow 'param' => 'int', 'help' => pht('Limit to tasks with at least this many failures.'), ), + array( + 'name' => 'active', + 'help' => pht('Select all active tasks.'), + ), ); } @@ -28,10 +32,13 @@ abstract class PhabricatorWorkerManagementWorkflow $ids = $args->getArg('id'); $class = $args->getArg('class'); $min_failures = $args->getArg('min-failure-count'); + $active = $args->getArg('active'); - if (!$ids && !$class && !$min_failures) { + if (!$ids && !$class && !$min_failures && !$active) { throw new PhutilArgumentUsageException( - pht('Use --id, --class, or --min-failure-count to select tasks.')); + pht( + 'Use "--id", "--class", "--active", and/or "--min-failure-count" '. + 'to select tasks.')); } $active_query = new PhabricatorWorkerActiveTaskQuery(); @@ -56,7 +63,13 @@ abstract class PhabricatorWorkerManagementWorkflow } $active_tasks = $active_query->execute(); - $archive_tasks = $archive_query->execute(); + + if ($active) { + $archive_tasks = array(); + } else { + $archive_tasks = $archive_query->execute(); + } + $tasks = mpull($active_tasks, null, 'getID') + mpull($archive_tasks, null, 'getID');