Skip to content

Drupal\helper\Commands\ModuleCommands

Drush commands for working with module schemas.

Implements:

Consolidation\Config\ConfigAwareInterface, Robo\Contract\OutputAwareInterface, Symfony\Component\Console\Input\InputAwareInterface, Consolidation\AnnotatedCommand\State\SavableState, Consolidation\AnnotatedCommand\Output\OutputAwareInterface, Consolidation\SiteProcess\ProcessManagerAwareInterface, Robo\Contract\ConfigAwareInterface, Psr\Log\LoggerAwareInterface, Robo\Contract\IOAwareInterface

Extend:

Drush\Commands\DrushCommands

Methods

Name Description
cleanupSchemaVersion Cleans up the schema versions for deleted modules.
deleteSchemaVersion Deletes the schema version for a module.
getSchemaVersion Gets the schema version for a module.
interactResetPostUpdate Interaction hook for the module:post-update:reset command.
interactSchemaVersion Sets the schema version for module.
resetPostUpdate Resets a post-update hook for a module.
setSchemaVersion Sets the schema version for a module.
validateModule Validation hook to check that a module name is valid.

Inherited methods

Name Description
__construct -
configure -
currentState -
getConfig Replaces same method in ConfigAwareTrait in order to provide a
DrushConfig as return type. Helps with IDE completion.
getEditor -
hasProcessManager -
initHook Configure Laravel prompts package.
logger Returns a logger object.
parentGetConfig Get the config management object.
preHook Persist commandData for use in primary command callback. Used by 'topic' commands.
processManager This method overrides the trait in order to provide a more specific return type.
programExists -
restoreState -
setConfig Set the config management object.
setInput -
setLogger Sets a logger.
setOutput -
setProcessManager -
startBrowser Starts a background browser/tab for the current site or a specified URL.

ModuleCommands::cleanupSchemaVersion

Description

public cleanupSchemaVersion (void)

Cleans up the schema versions for deleted modules.

Parameters

This function has no parameters.

Return Values

void


ModuleCommands::deleteSchemaVersion

Description

public deleteSchemaVersion (string $module)

Deletes the schema version for a module.

This is useful for removing leftover schemas of deleted modules.

Parameters

  • (string) $module :
    The module name, for example "system".

Return Values

void


ModuleCommands::getSchemaVersion

Description

public getSchemaVersion (string $module)

Gets the schema version for a module.

Parameters

  • (string) $module :
    The module name, for example "system".

Return Values

void


ModuleCommands::interactResetPostUpdate

Description

public interactResetPostUpdate (void)

Interaction hook for the module:post-update:reset command.

Parameters

This function has no parameters.

Return Values

void


ModuleCommands::interactSchemaVersion

Description

public interactSchemaVersion (void)

Sets the schema version for module.

Parameters

This function has no parameters.

Return Values

void


ModuleCommands::resetPostUpdate

Description

public resetPostUpdate (string $module, string $hook)

Resets a post-update hook for a module.

Parameters

  • (string) $module :
    The module name, for example "system".
  • (string) $hook :
    The post-update hook name.

Return Values

void

Throws Exceptions

\InvalidArgumentException

\Drush\Exceptions\UserAbortException

\RuntimeException


ModuleCommands::setSchemaVersion

Description

public setSchemaVersion (string $module, int|string $version)

Sets the schema version for a module.

Parameters

  • (string) $module :
    The module name, for example "system".
  • (int|string) $version :
    The version to set or the string
    "current[+-]number" to set a relative value to the current version.

Return Values

void

Throws Exceptions

\InvalidArgumentException

\Drush\Exceptions\UserAbortException

\RuntimeException


ModuleCommands::validateModule

Description

public validateModule (\Consolidation\AnnotatedCommand\CommandData $commandData)

Validation hook to check that a module name is valid.

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

Parameters

  • (\Consolidation\AnnotatedCommand\CommandData) $commandData :
    The command data.

Return Values

void