final class UpdateDBCommand extends Command (View source)

Traits

A copy of \Drupal\Core\DependencyInjection\AutowireTrait with first params' type hint changed.

Constants

NAME

Methods

static 
create(ContainerInterface $container)

Instantiates a new instance of the implementing class using autowiring.

__construct(BootstrapManager $bootstrapManager, LoggerInterface $logger, ProcessManager $processManager, SiteAliasManagerInterface $siteAliasManager, DrushConfig $drushConfig)

Note - can't inject @database since a method below is static.

configure()

No description

int
execute(InputInterface $input, OutputInterface $output)

No description

bool
updateCheckRequirements()

Log messages for any requirements warnings/errors.

bool
updateBatch()

Start the database update batch process.

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

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

static void
updateDoOnePostUpdate(string $function, array $context)

Batch command that executes a single post-update.

static void
updateFinished(bool $success, array $results, array $operations)

Batch finished callback.

static void
restoreMaintMode($status)

No description

array
getUpdateList()

No description

static void
cacheRebuild()

Clears caches and rebuilds the container.

Details

static create(ContainerInterface $container)

Instantiates a new instance of the implementing class using autowiring.

Parameters

ContainerInterface $container

The service container this instance should use.

__construct(BootstrapManager $bootstrapManager, LoggerInterface $logger, ProcessManager $processManager, SiteAliasManagerInterface $siteAliasManager, DrushConfig $drushConfig)

Note - can't inject @database since a method below is static.

Parameters

BootstrapManager $bootstrapManager
LoggerInterface $logger
ProcessManager $processManager
SiteAliasManagerInterface $siteAliasManager
DrushConfig $drushConfig

protected configure()

No description

protected int execute(InputInterface $input, OutputInterface $output)

No description

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

bool updateCheckRequirements()

Log messages for any requirements warnings/errors.

Return Value

bool

bool updateBatch()

Start the database update batch process.

Return Value

bool

static void updateDoOne(string $module, int $number, array $dependency_map, array $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.

array $context

The batch context object.

Return Value

void

static void updateDoOnePostUpdate(string $function, array $context)

Batch command that executes a single post-update.

Parameters

string $function

The post-update function to execute. The batch context object.

array $context

Return Value

void

static void updateFinished(bool $success, array $results, array $operations)

Batch finished callback.

Parameters

bool $success

Whether the batch ended without a fatal error.

array $results
array $operations

Return Value

void

static void restoreMaintMode($status)

No description

Parameters

$status

Return Value

void

array getUpdateList()

No description

Return Value

array

static void 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.

Return Value

void

See also

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