1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Use setConcreteOnly() in Phabricator and only list/launch concrete Daemons

Summary: We currently allow you to launch abstract daemons; use
setConcreteOnly() to only list/launch concrete daemons.

Test Plan: Ran "phd list" (no abstract daemons listed), "phd launch
PhabricatorRepositoryCommitDiscoveryDaemon" (reasonable error message).

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T801

Differential Revision: https://secure.phabricator.com/D1487
This commit is contained in:
epriestley 2012-01-25 11:50:59 -08:00
parent 16bcd5112a
commit add1ae945d
3 changed files with 7 additions and 15 deletions

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -178,17 +178,10 @@ class PhabricatorConduitConsoleController
$classes = id(new PhutilSymbolLoader())
->setAncestorClass('ConduitAPIMethod')
->setType('class')
->setConcreteOnly(true)
->selectSymbolsWithoutLoading();
$class_names = array_values(ipull($classes, 'name'));
foreach ($class_names as $key => $class_name) {
$class_info = new ReflectionClass($class_name);
if ($class_info->isAbstract()) {
unset($class_names[$key]);
}
}
return array_values($class_names);
return array_values(ipull($classes, 'name'));
}
}

View file

@ -39,13 +39,10 @@ abstract class DrydockBlueprint {
$blueprints = id(new PhutilSymbolLoader())
->setType('class')
->setAncestorClass('DrydockBlueprint')
->setConcreteOnly(true)
->selectAndLoadSymbols();
$list = ipull($blueprints, 'name', 'name');
foreach ($list as $class_name => $ignored) {
$reflection = new ReflectionClass($class_name);
if ($reflection->isAbstract()) {
continue;
}
$list[$class_name] = newv($class_name, array());
}
}

View file

@ -203,7 +203,8 @@ EOHELP
$symbols = $this->loadAvailableDaemonClasses();
$symbols = ipull($symbols, 'name', 'name');
if (empty($symbols[$daemon])) {
throw new Exception("Daemon '{$daemon}' is not known.");
throw new Exception(
"Daemon '{$daemon}' is not loaded, misspelled or abstract.");
}
$pid_dir = $this->getControlDirectory('pid');
@ -299,6 +300,7 @@ EOHELP
$loader = new PhutilSymbolLoader();
return $loader
->setAncestorClass('PhutilDaemon')
->setConcreteOnly(true)
->selectSymbolsWithoutLoading();
}