class UpdateDBCommands extends DrushCommands implements SiteAliasManagerAwareInterface (View source)

Traits

SiteAliasManagerAwareTrait
ProcessManagerAwareTrait
LoggerAwareTrait
IO
ConfigAwareTrait

Constants

REQ

OPT

EXIT_SUCCESS

EXIT_FAILURE

Properties

protected $cache_clear
protected $maintenanceModeOriginalState

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.

updatedb($options = ['cache-clear' => true, 'entity-updates' => false, 'post-updates' => true])

Apply any database updates required (as with running update.php).

entityUpdates($options = ['cache-clear' => true])

Apply pending entity schema updates.

RowsOfFields
updatedbStatus($options = ['format' => 'table', 'entity-updates' => true, 'post-updates' => true])

List any pending database updates.

UnstructuredListData
process($batch_id, $options = ['format' => 'json'])

Process operations in the specified batch set.

static 
updateDoOne(string $module, int $number, array $dependency_map, DrushBatchContext $context)

Perform one update and store the results which will later be displayed on the finished page.

static 
updateDoOnePostUpdate(string $function, DrushBatchContext $context)

Batch command that executes a single post-update.

updateFinished(boolean $success, array $results, array $operations)

Batch finished callback.

bool
updateBatch($options)

Start the database update batch process.

static 
restoreMaintMode($status)

No description

updateEntityDefinitions($context)

Apply entity schema updates.

getUpdateList()

No description

static 
cacheRebuild()

Clears caches and rebuilds the container.

getUpdatedbStatus(array $options)

Return a 2 item array with - an array where each item is a 4 item associative array describing a pending update.

entityUpdatesMain()

Apply pending entity schema updates.

updateCheckRequirements()

Log messages for any requirements warnings/errors.

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.

updatedb($options = ['cache-clear' => true, 'entity-updates' => false, 'post-updates' => true])

Apply any database updates required (as with running update.php).

Parameters

$options

entityUpdates($options = ['cache-clear' => true])

Apply pending entity schema updates.

Parameters

$options

RowsOfFields updatedbStatus($options = ['format' => 'table', 'entity-updates' => true, 'post-updates' => true])

List any pending database updates.

Parameters

$options

Return Value

RowsOfFields

UnstructuredListData process($batch_id, $options = ['format' => 'json'])

Process operations in the specified batch set.

Parameters

$batch_id
$options

Return Value

UnstructuredListData

static updateDoOne(string $module, int $number, array $dependency_map, DrushBatchContext $context)

Perform one update and store the results which will later be displayed on the finished page.

An update function can force the current and all later updates for this module to abort by returning a $ret array with an element like: $ret['#abort'] = array('success' => FALSE, 'query' => 'What went wrong'); The schema version will not be updated in this case, and all the aborted updates will continue to appear on update.php as updates that have not yet been run.

This method is static since since it is called by _drush_batch_worker().

Parameters

string $module The module whose update will be run.
int $number The update number to run.
array $dependency_map The update dependency map.
DrushBatchContext $context The batch context object.

static updateDoOnePostUpdate(string $function, DrushBatchContext $context)

Batch command that executes a single post-update.

Parameters

string $function The post-update function to execute.
DrushBatchContext $context The batch context object.

updateFinished(boolean $success, array $results, array $operations)

Batch finished callback.

Parameters

boolean $success Whether the batch ended without a fatal error.
array $results
array $operations

bool updateBatch($options)

Start the database update batch process.

Parameters

$options

Return Value

bool

static restoreMaintMode($status)

Parameters

$status

updateEntityDefinitions($context)

Apply entity schema updates.

Parameters

$context

getUpdateList()

static cacheRebuild()

Clears caches and rebuilds the container.

This is called in between regular updates and post updates. Do not use drush_drupal_cache_clear_all() as the cache clearing and container rebuild must happen in the same process that the updates are run in.

Drupal core's update.php uses drupal_flush_all_caches() directly without explicitly rebuilding the container as the container is rebuilt on the next HTTP request of the batch.

See also

\Drupal\system\Controller\DbUpdateController::triggerBatch()

getUpdatedbStatus(array $options)

Return a 2 item array with - an array where each item is a 4 item associative array describing a pending update.

  • an array listing the first update to run, keyed by module.

Parameters

array $options

entityUpdatesMain()

Apply pending entity schema updates.

updateCheckRequirements()

Log messages for any requirements warnings/errors.