Skip to content

Commit

Permalink
Fix issue when we displayed local plugins as core plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Dec 12, 2023
1 parent 2a80937 commit fb0b2ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
19 changes: 18 additions & 1 deletion src/Lib/QueryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,29 @@ public static function getSettings(): ManticoreSettings {
return static::$settings;
}

/**
* Display installed plugins information to the STDOUT
* @return void
*/
public static function printPluginsInfo(): void {
echo 'Loaded plugins:' . PHP_EOL;
foreach (['core', 'local', 'extra'] as $type) {
$method = 'get' . ucfirst($type) . 'Plugins';
$plugins = array_map(
fn ($v) => explode('/', $v)[1],
QueryProcessor::$method()
);
$pluginsLine = implode(', ', $plugins) . PHP_EOL;
echo " {$type}: $pluginsLine";
}
}

/**
* Get core plugins and exclude local one that does not start with our prefix
* @return array<string>
*/
public static function getCorePlugins(): array {
return array_filter(static::$corePlugins, fn ($v) => !str_starts_with($v, 'manticoresoftware/'));
return array_filter(static::$corePlugins, fn ($v) => str_starts_with($v, 'manticoresoftware/'));
}

/**
Expand Down
6 changes: 1 addition & 5 deletions src/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@ static function () use ($initBuffer) {

Task::setSettings(QueryProcessor::getSettings());
// Dispay all loaded plugins
echo 'Loaded plugins:' . PHP_EOL
. ' core: ' . implode(', ', QueryProcessor::getCorePlugins()) . PHP_EOL
. ' local: ' . implode(', ', QueryProcessor::getLocalPlugins()) . PHP_EOL
. ' extra: ' . implode(', ', QueryProcessor::getExtraPlugins()) . PHP_EOL
;
QueryProcessor::printPluginsInfo();
}
)
->onStart(
Expand Down

0 comments on commit fb0b2ef

Please sign in to comment.