hypejunction/elgg-cli

一套Elgg的CLI工具

1.2.1 2017-07-06 12:55 UTC

This package is auto-updated.

Last update: 2024-09-22 03:39:33 UTC


README

Elgg 2.2

安装

项目范围

cd /path/to/elgg/
composer require hypejunction/elgg-cli:~1.0
vendor/bin/elgg-cli --help

全局范围

composer global require hypejunction/elgg-cli:~1.0
cd /path/to/elgg
# if you have composer bin in your environment variables use the shortcut
elgg-cli --help

运行命令

cd /path/to/elgg/

# Get help
vendor/bin/elgg-cli --help

# List all commands
vendor/bin/elgg-cli list

# Install Elgg
vendor/bin/elgg-cli install

# Flush caches
vendor/bin/elgg-cli site:flush_cache

# Run upgrades
vendor/bin/elgg-cli site:upgrade

# Activate plugins
vendor/bin/elgg-cli plugins:activate [--all]

# Deactivate plugins
vendor/bin/elgg-cli plugins:deactivate [--all]

# Add a new user
vendor/bin/elgg-cli user:add [--admin] [--notify]

# Display or change site URL
vendor/bin/elgg-cli site:url <new_url>

# Display or change root path
vendor/bin/elgg-cli config:path <new_path>

# Display or change data directory path
vendor/bin/elgg-cli config:dataroot <new_path>

# Request a page
vendor/bin/elgg-cli route <uri> <method> [--tokens] [--export] [--as]

# Execute an action
vendor/bin/elgg-cli action <action_name> [--as]

# Run cron
vendor/bin/elgg-cli route cron/run

# List/search entities
vendor/bin/elgg-cli entities:get [--guid] [--type] [--subtype] [--limit] [--offset] [--keyword] [--full-view]

自定义命令

插件可以通过添加命令类名通过 'commands','cli' 钩子将其命令添加到CLI应用程序中。命令类必须扩展 \Symfony\Component\Console\Command\Command

class MyCommand extends \Symfony\Component\Console\Command\Command {}

elgg_register_plugin_hook_handler('commands', 'cli', function($hook, $type, $return) {
	$return[] = MyCommand::class;
	return $return;
});