54 $console->setup($input, $output);
56 $this->console = $console;
57 $this->hooks = $hooks;
67 $commands = array_merge($this->getCoreCommands(), $this->getPluginCommands());
68 $commands = $this->hooks->trigger(
'commands',
'cli', null, $commands);
70 foreach ($commands as $command) {
81 return \Elgg\Includer::includeFile($conf);
93 $plugin_commands = $plugin->getStaticConfig(
'cli_commands', []);
94 if (empty($plugin_commands)) {
98 $return = array_merge($return, $plugin_commands);
112 public function add($command) {
113 if (!class_exists($command)) {
117 if (!is_subclass_of($command, BaseCommand::class)) {
121 $command =
new $command();
126 if (!is_subclass_of($command, Command::class)) {
127 $this->console->add($command);
132 $command->addOption(
'as',
'u', InputOption::VALUE_OPTIONAL,
137 $command->addOption(
'language', null, InputOption::VALUE_OPTIONAL,
141 $this->console->add($command);
151 public function run(
bool $bootstrap =
true) {
155 $this->console->run($this->input, $this->output);
elgg_get_release()
Get the current Elgg release.
elgg_get_plugins(string $status= 'active')
Returns an ordered list of plugins.
static elgg()
Get the Elgg codebase path with "/".
getOutput()
Returns console output.
Wrapper for console application.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
__construct(PluginHooksService $hooks, InputInterface $input, OutputInterface $output)
Constructor.
trait Loggable
Enables adding a logger.
getCoreCommands()
Returns the core cli commands.
getInput()
Returns console input.
getLogger()
Returns logger.
getPluginCommands()
Returns the cli commands registered in plugins.
run(bool $bootstrap=true)
Bootstrap and run console application.
add($command)
Add a new CLI command.
bootstrap()
Add CLI tools to the console application.