8 use Elgg\Traits\Loggable;
9 use Symfony\Component\Console\Input\InputInterface;
10 use Symfony\Component\Console\Input\InputOption;
11 use Symfony\Component\Console\Output\OutputInterface;
34 protected InputInterface
$input,
35 protected OutputInterface
$output
40 $this->console = $console;
49 $commands = array_merge($this->getCoreCommands(), $this->getPluginCommands());
50 $commands = $this->events->triggerResults(
'commands',
'cli', [], $commands);
52 foreach ($commands as $command) {
63 $conf = \
Elgg\Project\
Paths::
elgg() .
'engine/cli_commands.php';
64 return \Elgg\Includer::includeFile($conf);
77 $plugin_commands =
$plugin->getStaticConfig(
'cli_commands', []);
78 if (empty($plugin_commands)) {
82 $return = array_merge($return, $plugin_commands);
96 public function add(
string $command): void {
97 if (!class_exists($command)) {
101 if (!is_subclass_of($command, BaseCommand::class)) {
105 $command =
new $command();
107 $command->setLogger($this->getLogger());
109 if (!is_subclass_of($command, Command::class)) {
110 $this->console->add($command);
115 $command->addOption(
'as',
'u', InputOption::VALUE_OPTIONAL,
120 $command->addOption(
'language',
null, InputOption::VALUE_OPTIONAL,
124 $this->console->add($command);
134 public function run(
bool $bootstrap =
true): void {
139 $this->console->run($this->input, $this->output);
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Wrapper for console application.
Adds interaction to a console command.
Abstract command with some utility methods.
__construct(protected EventsService $events, protected InputInterface $input, protected OutputInterface $output)
Constructor.
add(string $command)
Add a new CLI command.
getOutput()
Returns console output.
getPluginCommands()
Returns the cli commands registered in plugins.
getInput()
Returns console input.
getCoreCommands()
Returns the core cli commands.
run(bool $bootstrap=true)
Bootstrap and run console application.
bootstrap()
Add CLI tools to the console application.
Find Elgg and project paths.
elgg_get_release()
Get the current Elgg release.
elgg()
Bootstrapping and helper procedural code available for use in Elgg core and plugins.
elgg_get_plugins(string $status='active')
Returns an ordered list of plugins.
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.