class ConfigCommands extends DrushCommands implements StdinAwareInterface (View source)

Traits

StdinAwareTrait
ProcessManagerAwareTrait
LoggerAwareTrait
IO
ConfigAwareTrait

Constants

REQ

OPT

EXIT_SUCCESS

EXIT_FAILURE

Properties

protected ConfigFactoryInterface $configFactory

Methods

getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct(ConfigFactoryInterface $configFactory)

ConfigCommands constructor.

LoggerInterface
logger()

Returns a logger object.

io()

Override Robo's IO function with our custom style.

printFile(string $file)

Print the contents of a file.

bool
startBrowser($uri = null, int $sleep = 0, bool $port = false, bool $browser = true)

Starts a background browser/tab for the current site or a specified URL.

from ExecTrait
static 
programExists($program)

No description

from ExecTrait
static 
getEditor()

No description

from ExecTrait
ConfigFactoryInterface
getConfigFactory()

No description

get($config_name, $key = '', $options = ['format' => 'yaml', 'source' => 'active', 'include-overridden' => false])

Display a config value, or a whole configuration object.

set($config_name, $key, $value = null, $options = ['input-format' => 'string', 'value' => self::REQ])

Set config value directly. Does not perform a config import.

edit($config_name, $options = [])

Open a config file in a text editor. Edits are imported after closing editor.

delete($config_name, $key = null)

Delete a configuration key, or a whole object.

RowsOfFields
status($options = ['state' => 'Only in DB,Only in sync dir,Different', 'prefix' => self::REQ, 'label' => self::REQ])

Display status of configuration (differences between the filesystem configuration and database configuration).

static 
getDirectory(string $label, string $directory = null)

Determine which configuration directory to use and return directory path.

getChanges($target_storage)

Returns the difference in configuration between active storage and target storage.

getStorage($directory)

Get storage corresponding to a configuration directory.

static Table
configChangesTable(array $config_changes, OutputInterface $output, $use_color = true)

Build a table of config changes.

interactConfigName($input, $output)

No description

interactConfigLabel(InputInterface $input, ConsoleOutputInterface $output)

No description

CommandError|null
validateConfigName(CommandData $commandData)

Validate that a config name is valid.

static 
copyConfig(StorageInterface $source, StorageInterface $destination)

Copies configuration objects from source storage to target storage.

static array|bool
getDiff(StorageInterface $destination_storage, StorageInterface $source_storage, OutputInterface $output)

Get diff between two config sets.

Details

DrushConfig getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct(ConfigFactoryInterface $configFactory)

ConfigCommands constructor.

Parameters

ConfigFactoryInterface $configFactory

protected LoggerInterface logger()

Returns a logger object.

Return Value

LoggerInterface

protected io()

Override Robo's IO function with our custom style.

protected printFile(string $file)

Print the contents of a file.

Parameters

string $file Full path to a file.

bool startBrowser($uri = null, int $sleep = 0, bool $port = false, bool $browser = true)

Starts a background browser/tab for the current site or a specified URL.

Uses a non-blocking Process call, so Drush execution will continue.

Parameters

$uri Optional URI or site path to open in browser. If omitted, or if a site path is specified, the current site home page uri will be prepended if the site's hostname resolves.
int $sleep
bool $port
bool $browser

Return Value

bool TRUE if browser was opened. FALSE if browser was disabled by the user or a default browser could not be found.

static programExists($program)

Parameters

$program

static getEditor()

ConfigFactoryInterface getConfigFactory()

Return Value

ConfigFactoryInterface

get($config_name, $key = '', $options = ['format' => 'yaml', 'source' => 'active', 'include-overridden' => false])

Display a config value, or a whole configuration object.

Parameters

$config_name
$key
$options

set($config_name, $key, $value = null, $options = ['input-format' => 'string', 'value' => self::REQ])

Set config value directly. Does not perform a config import.

Parameters

$config_name
$key
$value
$options

edit($config_name, $options = [])

Open a config file in a text editor. Edits are imported after closing editor.

Parameters

$config_name
$options

delete($config_name, $key = null)

Delete a configuration key, or a whole object.

Parameters

$config_name The config object name, for example "system.site".
$key A config key to clear, for example "page.front".

RowsOfFields status($options = ['state' => 'Only in DB,Only in sync dir,Different', 'prefix' => self::REQ, 'label' => self::REQ])

Display status of configuration (differences between the filesystem configuration and database configuration).

Parameters

$options

Return Value

RowsOfFields

static getDirectory(string $label, string $directory = null)

Determine which configuration directory to use and return directory path.

Directory path is determined based on the following precedence: 1. User-provided $directory. 2. Directory path corresponding to $label (mapped via $config_directories in settings.php). 3. Default sync directory

Parameters

string $label A configuration directory label.
string $directory A configuration directory.

getChanges($target_storage)

Returns the difference in configuration between active storage and target storage.

Parameters

$target_storage

getStorage($directory)

Get storage corresponding to a configuration directory.

Parameters

$directory

static Table configChangesTable(array $config_changes, OutputInterface $output, $use_color = true)

Build a table of config changes.

Parameters

array $config_changes
OutputInterface $output
$use_color

Return Value

Table A Symfony table object.

interactConfigName($input, $output)

Parameters

$input
$output

interactConfigLabel(InputInterface $input, ConsoleOutputInterface $output)

Parameters

InputInterface $input
ConsoleOutputInterface $output

CommandError|null validateConfigName(CommandData $commandData)

Validate that a config name is valid.

If the argument to be validated is not named $config_name, pass the argument name as the value of the annotation.

Parameters

CommandData $commandData

Return Value

CommandError|null

static copyConfig(StorageInterface $source, StorageInterface $destination)

Copies configuration objects from source storage to target storage.

Parameters

StorageInterface $source The source config storage service.
StorageInterface $destination The destination config storage service.

static array|bool getDiff(StorageInterface $destination_storage, StorageInterface $source_storage, OutputInterface $output)

Get diff between two config sets.

Parameters

StorageInterface $destination_storage
StorageInterface $source_storage
OutputInterface $output

Return Value

array|bool An array of strings containing the diff.