class SqlCommands extends DrushCommands implements StdinAwareInterface (View source)

Traits

StdinAwareTrait
ProcessManagerAwareTrait
LoggerAwareTrait
IO
ConfigAwareTrait

Constants

REQ

OPT

EXIT_SUCCESS

EXIT_FAILURE

Methods

getConfig()

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

__construct()

No description

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
conf($options = ['format' => 'yaml', 'all' => false, 'show-passwords' => false])

Print database connection details.

connect($options = ['extra' => self::REQ])

A string for connecting to the DB.

create($options = ['db-su' => self::REQ, 'db-su-pw' => self::REQ])

Create a database.

drop($options = [])

Drop all tables in a given database.

cli(InputInterface $input, $options = ['extra' => self::REQ])

Open a SQL command-line interface using Drupal's credentials.

query($query = '', $options = ['result-file' => null, 'file' => self::REQ, 'file-delete' => false, 'extra' => self::REQ, 'db-prefix' => false])

Execute a query against a database.

PropertyList
dump($options = ['result-file' => self::REQ, 'create-db' => false, 'data-only' => false, 'ordered-dump' => false, 'gzip' => false, 'extra' => self::REQ, 'extra-dump' => self::REQ, 'format' => 'null'])

Exports the Drupal DB as SQL using mysqldump or equivalent.

bool
validate(CommandData $commandData)

Assert that mysql or similar are on the user's PATH.

Details

DrushConfig getConfig()

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

__construct()

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()

conf($options = ['format' => 'yaml', 'all' => false, 'show-passwords' => false])

Print database connection details.

Parameters

$options

connect($options = ['extra' => self::REQ])

A string for connecting to the DB.

Parameters

$options

create($options = ['db-su' => self::REQ, 'db-su-pw' => self::REQ])

Create a database.

Parameters

$options

drop($options = [])

Drop all tables in a given database.

Parameters

$options

cli(InputInterface $input, $options = ['extra' => self::REQ])

Open a SQL command-line interface using Drupal's credentials.

Parameters

InputInterface $input
$options

query($query = '', $options = ['result-file' => null, 'file' => self::REQ, 'file-delete' => false, 'extra' => self::REQ, 'db-prefix' => false])

Execute a query against a database.

Parameters

$query
$options

PropertyList dump($options = ['result-file' => self::REQ, 'create-db' => false, 'data-only' => false, 'ordered-dump' => false, 'gzip' => false, 'extra' => self::REQ, 'extra-dump' => self::REQ, 'format' => 'null'])

Exports the Drupal DB as SQL using mysqldump or equivalent.

Parameters

$options

Return Value

PropertyList

bool validate(CommandData $commandData)

Assert that mysql or similar are on the user's PATH.

Parameters

CommandData $commandData

Return Value

bool

Exceptions

Exception