1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 04:42:40 +01:00

Use PhutilClassMapQuery instead of PhutilSymbolLoader

Summary: Use `PhutilClassMaQuery` instead of `PhutilSymbolLoader`, mostly for consistency. Depends on D13588.

Test Plan: Poked around a bunch of pages.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13589
This commit is contained in:
Joshua Spence 2015-08-14 07:49:00 +10:00
parent 7938d9a529
commit 368f359114
73 changed files with 180 additions and 257 deletions

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('AlmanacManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorCacheManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -16,8 +16,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorDaemonManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOHELP
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('DivinerWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('DrydockManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -15,8 +15,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorFactManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorFilesManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorLipsumManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorMailManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -15,8 +15,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorRepositoryManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSearchManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorAuditManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorAuthManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('CelerityManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorConfigManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorFeedManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('HarbormasterManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorHunksManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorInternationalizationManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorPhortuneManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorPolicyManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSystemRemoveWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorWorkerTriggerManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorWorkerManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,8 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSMSManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -160,9 +160,9 @@ try {
exit(1);
}
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorStorageManagementWorkflow')
->loadObjects();
->execute();
$patches = PhabricatorSQLPatchList::buildAllPatches();

View file

@ -190,11 +190,10 @@ try {
$user->getUsername()));
}
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSSHWorkflow')
->loadObjects();
$workflow_names = mpull($workflows, 'getName', 'getName');
->setUniqueMethod('getName')
->execute();
if (!$original_argv) {
throw new Exception(
@ -210,7 +209,7 @@ try {
$user->getUsername(),
'git clone',
'hg push',
implode(', ', $workflow_names)));
implode(', ', array_keys($workflows))));
}
$log_argv = implode(' ', $original_argv);

View file

@ -3,9 +3,9 @@
final class PhabricatorConduitTestCase extends PhabricatorTestCase {
public function testConduitMethods() {
$methods = id(new PhutilSymbolLoader())
$methods = id(new PhutilClassMapQuery())
->setAncestorClass('ConduitAPIMethod')
->loadObjects();
->execute();
// We're just looking for a side effect of ConduitCall construction
// here: it will throw if any methods define reserved parameter names.

View file

@ -139,34 +139,10 @@ abstract class ConduitAPIMethod
}
public static function loadAllConduitMethods() {
static $method_map = null;
if ($method_map === null) {
$methods = id(new PhutilSymbolLoader())
->setAncestorClass(__CLASS__)
->loadObjects();
foreach ($methods as $method) {
$name = $method->getAPIMethodName();
if (empty($method_map[$name])) {
$method_map[$name] = $method;
continue;
}
$orig_class = get_class($method_map[$name]);
$this_class = get_class($method);
throw new Exception(
pht(
'Two Conduit API method classes (%s, %s) both have the same '.
'method name (%s). API methods must have unique method names.',
$orig_class,
$this_class,
$name));
}
}
return $method_map;
return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->setUniqueMethod('getAPIMethodName')
->execute();
}
public static function getConduitMethod($method_name) {

View file

@ -19,10 +19,9 @@ final class ConduitQueryConduitAPIMethod extends ConduitAPIMethod {
}
protected function execute(ConduitAPIRequest $request) {
$classes = id(new PhutilSymbolLoader())
$classes = id(new PhutilClassMapQuery())
->setAncestorClass('ConduitAPIMethod')
->setType('class')
->loadObjects();
->execute();
$names_to_params = array();
foreach ($classes as $class) {

View file

@ -47,14 +47,10 @@ final class PhabricatorConduitMethodQuery
}
private function getAllMethods() {
static $methods;
if ($methods === null) {
$methods = id(new PhutilSymbolLoader())
->setAncestorClass('ConduitAPIMethod')
->loadObjects();
$methods = msort($methods, 'getSortOrder');
}
return $methods;
return id(new PhutilClassMapQuery())
->setAncestorClass('ConduitAPIMethod')
->setSortMethod('getSortOrder')
->execute();
}
private function filterMethods(array $methods) {

View file

@ -9,9 +9,9 @@ final class PhabricatorConfigCoreSchemaSpec
public function buildSchemata() {
// Build all Lisk table schemata.
$lisk_objects = id(new PhutilSymbolLoader())
$lisk_objects = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorLiskDAO')
->loadObjects();
->execute();
$counters = array();
foreach ($lisk_objects as $object) {

View file

@ -155,9 +155,9 @@ final class PhabricatorConfigSchemaQuery extends Phobject {
$databases = $this->getDatabaseNames();
$info = $this->getAPI()->getCharsetInfo();
$specs = id(new PhutilSymbolLoader())
$specs = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorConfigSchemaSpec')
->loadObjects();
->execute();
$server_schema = new PhabricatorConfigServerSchema();
foreach ($specs as $spec) {

View file

@ -6,19 +6,13 @@ final class DarkConsoleCore extends Phobject {
const STORAGE_VERSION = 1;
public function __construct() {
$symbols = id(new PhutilSymbolLoader())
->setType('class')
$this->plugins = id(new PhutilClassMapQuery())
->setAncestorClass('DarkConsolePlugin')
->selectAndLoadSymbols();
->execute();
foreach ($symbols as $symbol) {
$plugin = newv($symbol['name'], array());
if (!$plugin->shouldStartup()) {
continue;
}
foreach ($this->plugins as $plugin) {
$plugin->setConsoleCore($this);
$plugin->didStartup();
$this->plugins[$symbol['name']] = $plugin;
}
}

View file

@ -62,10 +62,6 @@ abstract class DarkConsolePlugin extends Phobject {
return $this->getRequest()->getRequestURI();
}
public function shouldStartup() {
return true;
}
public function didStartup() {
return null;
}

View file

@ -6,8 +6,7 @@ abstract class PhabricatorDaemonManagementWorkflow
private $runDaemonsAsUser = null;
final protected function loadAvailableDaemonClasses() {
$loader = new PhutilSymbolLoader();
return $loader
return id(new PhutilSymbolLoader())
->setAncestorClass('PhutilDaemon')
->setConcreteOnly(true)
->selectSymbolsWithoutLoading();

View file

@ -12,11 +12,11 @@ final class PhabricatorDashboardPanelSearchApplicationCustomField
}
public function renderEditControl(array $handles) {
$engines = id(new PhutilSymbolLoader())
$engines = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorApplicationSearchEngine')
->loadObjects();
$engines = mfilter($engines, 'canUseInPanelContext');
->setFilterMethod('canUseInPanelContext')
->execute();
$all_apps = id(new PhabricatorApplicationQuery())
->setViewer($this->getViewer())
->withUnlisted(false)

View file

@ -12,11 +12,10 @@ final class PhabricatorDashboardPanelSearchQueryCustomField
}
public function renderEditControl(array $handles) {
$engines = id(new PhutilSymbolLoader())
$engines = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorApplicationSearchEngine')
->loadObjects();
$engines = mfilter($engines, 'canUseInPanelContext');
->setFilterMethod('canUseInPanelContext')
->execute();
$value = $this->getFieldValue();

View file

@ -37,9 +37,10 @@ final class DifferentialLandingActionMenuEventListener
return null;
}
$strategies = id(new PhutilSymbolLoader())
$strategies = id(new PhutilClassMapQuery())
->setAncestorClass('DifferentialLandingStrategy')
->loadObjects();
->execute();
foreach ($strategies as $strategy) {
$viewer = $event->getUser();
$action = $strategy->createMenuItem($viewer, $revision, $repository);

View file

@ -64,9 +64,10 @@ final class DiffusionSymbolController extends DiffusionController {
$external_query->withLanguages(array($request->getStr('lang')));
}
$external_sources = id(new PhutilSymbolLoader())
$external_sources = id(new PhutilClassMapQuery())
->setAncestorClass('DiffusionExternalSymbolsSource')
->loadObjects();
->execute();
$results = array($symbols);
foreach ($external_sources as $source) {
$results[] = $source->executeQuery($external_query);

View file

@ -414,10 +414,9 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
$version['atom'] = DivinerAtom::getAtomSerializationVersion();
$version['rules'] = $this->getRules();
$atomizers = id(new PhutilSymbolLoader())
$atomizers = id(new PhutilClassMapQuery())
->setAncestorClass('DivinerAtomizer')
->setConcreteOnly(true)
->selectAndLoadSymbols();
->execute();
$atomizer_versions = array();
foreach ($atomizers as $atomizer) {

View file

@ -88,14 +88,12 @@ final class DoorkeeperImportEngine extends Phobject {
}
if (!$this->localOnly) {
$bridges = id(new PhutilSymbolLoader())
$bridges = id(new PhutilClassMapQuery())
->setAncestorClass('DoorkeeperBridge')
->loadObjects();
->setFilterMethod('isEnabled')
->execute();
foreach ($bridges as $key => $bridge) {
if (!$bridge->isEnabled()) {
unset($bridges[$key]);
}
$bridge->setViewer($viewer);
$bridge->setThrowOnMissingLink($this->throwOnMissingLink);
}

View file

@ -120,9 +120,9 @@ final class PhabricatorAsanaConfigOptions
$viewer = $request->getUser();
$publishers = id(new PhutilSymbolLoader())
$publishers = id(new PhutilClassMapQuery())
->setAncestorClass('DoorkeeperFeedStoryPublisher')
->loadObjects();
->execute();
$out = array();
$out[] = pht(

View file

@ -125,9 +125,9 @@ abstract class DoorkeeperFeedWorker extends FeedPushWorker {
$viewer = $this->getViewer();
$object = $this->getStoryObject();
$publishers = id(new PhutilSymbolLoader())
$publishers = id(new PhutilClassMapQuery())
->setAncestorClass('DoorkeeperFeedStoryPublisher')
->loadObjects();
->execute();
foreach ($publishers as $publisher) {
if (!$publisher->canPublishStory($story, $object)) {

View file

@ -23,6 +23,7 @@ final class FeedPublisherWorker extends FeedPushWorker {
);
// Find and schedule all the enabled Doorkeeper publishers.
// TODO: Use PhutilClassMapQuery?
$doorkeeper_workers = id(new PhutilSymbolLoader())
->setAncestorClass('DoorkeeperFeedWorker')
->loadObjects($argv);

View file

@ -882,18 +882,9 @@ final class PhabricatorFile extends PhabricatorFileDAO
}
public static function buildAllEngines() {
$engines = id(new PhutilSymbolLoader())
->setType('class')
->setConcreteOnly(true)
return id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorFileStorageEngine')
->selectAndLoadSymbols();
$results = array();
foreach ($engines as $engine_class) {
$results[] = newv($engine_class['name'], array());
}
return $results;
->execute();
}
public function getViewableMimeType() {

View file

@ -100,11 +100,13 @@ final class PhabricatorFlagSearchEngine
}
private function getObjectFilterOptions() {
$objects = id(new PhutilSymbolLoader())
$objects = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorFlaggableInterface')
->loadObjects();
->execute();
$all_types = PhabricatorPHIDType::getAllTypes();
$options = array();
foreach ($objects as $object) {
$phid = $object->generatePHID();
$phid_type = phid_get_type($phid);

View file

@ -291,9 +291,9 @@ final class HarbormasterBuild extends HarbormasterDAO
}
public static function getAvailableBuildVariables() {
$objects = id(new PhutilSymbolLoader())
$objects = id(new PhutilClassMapQuery())
->setAncestorClass('HarbormasterBuildableInterface')
->loadObjects();
->execute();
$variables = array();
$variables[] = array(

View file

@ -20,9 +20,9 @@ final class PhabricatorLipsumGenerateWorkflow
public function execute(PhutilArgumentParser $args) {
$console = PhutilConsole::getConsole();
$supported_types = id(new PhutilSymbolLoader())
$supported_types = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorTestDataGenerator')
->loadObjects();
->execute();
$console->writeOut(
"%s:\n\t%s\n",

View file

@ -105,15 +105,13 @@ final class PhabricatorMailManagementReceiveTestWorkflow
'to' => $to.'+1+'.$pseudohash,
));
$receivers = id(new PhutilSymbolLoader())
$receivers = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorMailReceiver')
->loadObjects();
->setFilterMethod('isEnabled')
->execute();
$receiver = null;
foreach ($receivers as $possible_receiver) {
if (!$possible_receiver->isEnabled()) {
continue;
}
if (!$possible_receiver->canAcceptMail($pseudomail)) {
continue;
}

View file

@ -265,15 +265,13 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
* accepts this mail, if one exists.
*/
private function loadReceiver() {
$receivers = id(new PhutilSymbolLoader())
$receivers = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorMailReceiver')
->loadObjects();
->setFilterMethod('isEnabled')
->execute();
$accept = array();
foreach ($receivers as $key => $receiver) {
if (!$receiver->isEnabled()) {
continue;
}
if ($receiver->canAcceptMail($this)) {
$accept[$key] = $receiver;
}

View file

@ -307,9 +307,9 @@ final class PhabricatorPolicyTestCase extends PhabricatorTestCase {
}
public function testAllQueriesBelongToActualApplications() {
$queries = id(new PhutilSymbolLoader())
$queries = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorPolicyAwareQuery')
->loadObjects();
->execute();
foreach ($queries as $qclass => $query) {
$class = $query->getQueryApplicationClass();

View file

@ -4,10 +4,10 @@ final class PolicyLockOptionType
extends PhabricatorConfigJSONOptionType {
public function validateOption(PhabricatorConfigOption $option, $value) {
$capabilities = id(new PhutilSymbolLoader())
$capabilities = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorPolicyCapability')
->loadObjects();
$capabilities = mpull($capabilities, null, 'getCapabilityKey');
->setUniqueMethod('getCapabilityKey')
->execute();
$policy_phids = array();
foreach ($value as $capability_key => $policy) {

View file

@ -37,9 +37,9 @@ final class PhabricatorPolicyEditController
PhabricatorPolicy::ACTION_DENY => pht('Deny'),
);
$rules = id(new PhutilSymbolLoader())
$rules = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorPolicyRule')
->loadObjects();
->execute();
foreach ($rules as $key => $rule) {
if (!$rule->canApplyToObject($object)) {

View file

@ -305,9 +305,9 @@ final class PhabricatorPolicyQuery
}
public static function getObjectPolicyRules($object) {
$rules = id(new PhutilSymbolLoader())
$rules = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorPolicyRule')
->loadObjects();
->execute();
$results = array();
foreach ($rules as $rule) {

View file

@ -15,9 +15,9 @@ final class PhabricatorSearchIndexer extends Phobject {
}
public function indexDocumentByPHID($phid, $context) {
$indexers = id(new PhutilSymbolLoader())
$indexers = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSearchDocumentIndexer')
->loadObjects();
->execute();
foreach ($indexers as $indexer) {
if ($indexer->shouldIndexDocumentByPHID($phid)) {

View file

@ -122,9 +122,9 @@ final class PhabricatorSearchManagementIndexWorkflow
}
private function loadPHIDsByTypes($type) {
$indexers = id(new PhutilSymbolLoader())
$indexers = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSearchDocumentIndexer')
->loadObjects();
->execute();
$phids = array();
foreach ($indexers as $indexer) {

View file

@ -204,9 +204,9 @@ final class PhabricatorSearchApplicationSearchEngine
// TODO: This is inelegant and not very efficient, but gets us reasonable
// results. It would be nice to do this more elegantly.
$indexers = id(new PhutilSymbolLoader())
$indexers = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSearchDocumentIndexer')
->loadObjects();
->execute();
if ($viewer) {
$types = PhabricatorPHIDType::getAllInstalledTypes($viewer);

View file

@ -75,19 +75,11 @@ final class PhabricatorSettingsMainController
}
private function buildPanels() {
$panel_specs = id(new PhutilSymbolLoader())
$panels = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSettingsPanel')
->setConcreteOnly(true)
->selectAndLoadSymbols();
$panels = array();
foreach ($panel_specs as $spec) {
$class = newv($spec['name'], array());
$panels[] = $class->buildPanels();
}
$panels = array_mergev($panels);
$panels = mpull($panels, null, 'getPanelKey');
->setExpandMethod('buildPanels')
->setUniqueMethod('getPanelKey')
->execute();
$result = array();
foreach ($panels as $key => $panel) {

View file

@ -191,16 +191,12 @@ final class PhabricatorEmailPreferencesSettingsPanel
}
private function getAllEditorsWithTags(PhabricatorUser $user) {
$editors = id(new PhutilSymbolLoader())
$editors = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorApplicationTransactionEditor')
->loadObjects();
->setFilterMethod('getMailTagsMap')
->execute();
foreach ($editors as $key => $editor) {
// Remove editors which do not support mail tags.
if (!$editor->getMailTagsMap()) {
unset($editors[$key]);
}
// Remove editors for applications which are not installed.
$app = $editor->getEditorApplicationClass();
if ($app !== null) {

View file

@ -23,9 +23,9 @@ final class PhabricatorApplicationTransactionShowOlderController
}
$template = $object->getApplicationTransactionTemplate();
$queries = id(new PhutilSymbolLoader())
$queries = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorApplicationTransactionQuery')
->loadObjects();
->execute();
$object_query = null;
foreach ($queries as $query) {

View file

@ -28,9 +28,9 @@ final class PhabricatorApplicationTransactionTransactionPHIDType
static $queries;
if ($queries === null) {
$objects = id(new PhutilSymbolLoader())
$objects = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorApplicationTransactionQuery')
->loadObjects();
->execute();
$queries = array();
foreach ($objects as $object) {

View file

@ -112,9 +112,9 @@ final class PhabricatorApplicationTransactionPublishWorker
* the transactions.
*/
private function buildTransactionQuery($type) {
$queries = id(new PhutilSymbolLoader())
$queries = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorApplicationTransactionQuery')
->loadObjects();
->execute();
foreach ($queries as $query) {
$query_type = $query

View file

@ -11,9 +11,10 @@ final class PhabricatorTypeaheadFunctionHelpController
$viewer = $this->getViewer();
$class = $request->getURIData('class');
$sources = id(new PhutilSymbolLoader())
$sources = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorTypeaheadDatasource')
->loadObjects();
->execute();
if (!isset($sources[$class])) {
return new Aphront404Response();
}

View file

@ -29,9 +29,10 @@ final class PhabricatorTypeaheadModularDatasourceController
// This makes form submission easier in the debug view.
$class = nonempty($request->getURIData('class'), $request->getStr('class'));
$sources = id(new PhutilSymbolLoader())
$sources = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorTypeaheadDatasource')
->loadObjects();
->execute();
if (isset($sources[$class])) {
$source = $sources[$class];
$source->setParameters($request->getRequestData());

View file

@ -9,10 +9,10 @@ final class PhabricatorUIExampleRenderController extends PhabricatorController {
public function handleRequest(AphrontRequest $request) {
$id = $request->getURIData('class');
$classes = id(new PhutilSymbolLoader())
$classes = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorUIExample')
->loadObjects();
$classes = msort($classes, 'getName');
->setSortMethod('getName')
->execute();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));

View file

@ -22,10 +22,10 @@ abstract class PhabricatorStandardCustomField
PhabricatorCustomField $template,
array $config) {
$types = id(new PhutilSymbolLoader())
$types = id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->loadObjects();
$types = mpull($types, null, 'getFieldType');
->setUniqueMethod('getFieldType')
->execute();
$fields = array();
foreach ($config as $key => $value) {

View file

@ -385,9 +385,9 @@ final class PhabricatorTriggerDaemon
* @task garbage
*/
private function loadGarbageCollectors() {
return id(new PhutilSymbolLoader())
return id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorGarbageCollector')
->loadObjects();
->execute();
}

View file

@ -200,10 +200,11 @@ final class PhabricatorEnv extends Phobject {
$default_source->loadExternalOptions();
// If this install has site config sources, load them now.
$site_sources = id(new PhutilSymbolLoader())
$site_sources = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorConfigSiteSource')
->loadObjects();
$site_sources = msort($site_sources, 'getPriority');
->setSortMethod('getPriority')
->execute();
foreach ($site_sources as $site_source) {
$stack->pushSource($site_source);
}

View file

@ -9,9 +9,9 @@ final class PhabricatorEventEngine extends Phobject {
// be able to run `bin/config` in order to remove an invalid listener.
// Load automatic listeners.
$listeners = id(new PhutilSymbolLoader())
$listeners = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorAutoEventListener')
->loadObjects();
->execute();
// Load configured listeners.
$config_listeners = PhabricatorEnv::getEnvConfig('events.listeners');

View file

@ -622,15 +622,15 @@ final class PhabricatorMarkupEngine extends Phobject {
}
private static function loadCustomInlineRules() {
return id(new PhutilSymbolLoader())
return id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorRemarkupCustomInlineRule')
->loadObjects();
->execute();
}
private static function loadCustomBlockRules() {
return id(new PhutilSymbolLoader())
return id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorRemarkupCustomBlockRule')
->loadObjects();
->execute();
}
}

View file

@ -37,31 +37,15 @@ abstract class PhabricatorSQLPatchList extends Phobject {
}
final public static function buildAllPatches() {
$patch_lists = id(new PhutilSymbolLoader())
$patch_lists = id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->setConcreteOnly(true)
->selectAndLoadSymbols();
->setUniqueMethod('getNamespace')
->execute();
$specs = array();
$seen_namespaces = array();
foreach ($patch_lists as $patch_class) {
$patch_class = $patch_class['name'];
$patch_list = newv($patch_class, array());
$namespace = $patch_list->getNamespace();
if (isset($seen_namespaces[$namespace])) {
$prior = $seen_namespaces[$namespace];
throw new Exception(
pht(
"%s '%s' has the same namespace, '%s', as another patch list ".
"class, '%s'. Each patch list MUST have a unique namespace.",
__CLASS__,
$patch_class,
$namespace,
$prior));
}
foreach ($patch_lists as $patch_list) {
$last_key = null;
foreach ($patch_list->getPatches() as $key => $patch) {
if (!is_array($patch)) {
@ -69,7 +53,7 @@ abstract class PhabricatorSQLPatchList extends Phobject {
pht(
"%s '%s' has a patch '%s' which is not an array.",
__CLASS__,
$patch_class,
get_class($patch_list),
$key));
}
@ -88,7 +72,7 @@ abstract class PhabricatorSQLPatchList extends Phobject {
"%s '%s' has a patch, '%s', with an unknown property, '%s'.".
"Patches must have only valid keys: %s.",
__CLASS__,
$patch_class,
get_class($patch_list),
$key,
$pkey,
implode(', ', array_keys($valid))));
@ -101,7 +85,7 @@ abstract class PhabricatorSQLPatchList extends Phobject {
"%s '%s' has a patch with a numeric key, '%s'. ".
"Patches must use string keys.",
__CLASS__,
$patch_class,
get_class($patch_list),
$key));
}
@ -111,10 +95,11 @@ abstract class PhabricatorSQLPatchList extends Phobject {
"%s '%s' has a patch with a colon in the key name, '%s'. ".
"Patch keys may not contain colons.",
__CLASS__,
$patch_class,
get_class($patch_list),
$key));
}
$namespace = $patch_list->getNamespace();
$full_key = "{$namespace}:{$key}";
if (isset($specs[$full_key])) {
@ -123,7 +108,7 @@ abstract class PhabricatorSQLPatchList extends Phobject {
"%s '%s' has a patch '%s' which duplicates an ".
"existing patch key.",
__CLASS__,
$patch_class,
get_class($patch_list),
$key));
}
@ -152,7 +137,7 @@ abstract class PhabricatorSQLPatchList extends Phobject {
"determined implicitly. The first patch in a patch list must ".
"list the patch or patches it depends on explicitly.",
$full_key,
$patch_class));
get_class($patch_list)));
} else {
$patch['after'] = array($last_key);
}

View file

@ -16,8 +16,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorAphlictManagementWorkflow')
->loadObjects();
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);