Skip to content

state:set

Set a state value.

Examples

  • drush sset system.maintenance_mode 1 --input-format=integer. Put site into Maintenance mode.
  • drush state:set system.cron_last 1406682882 --input-format=integer. Sets a timestamp for last cron run.
  • php -r "print json_encode(array('drupal', 'simpletest'));" | drush state-set --input-format=json foo.name -. Set a key to a complex value (e.g. array)
  • drush state:set twig_debug TRUE. Enable the Twig debug mode (since Drupal 10.1)
  • drush state:set twig_autoreload TRUE. Enable Twig auto reload (since Drupal 10.1)
  • drush state:set twig_cache_disable TRUE. Disable the Twig, page, render and dynamic page caches (since Drupal 10.1)
  • drush state:set disable_rendered_output_cache_bins TRUE. Disables render cache, dynamic page cache, and page cache. (since Drupal 10.1)

Arguments

  • key. The state key, for example: system.cron_last.
  • value. The value to assign to the state key. Use - to read from Stdin.

Options

  • --input-format[=INPUT-FORMAT]. Type for the value. Other recognized values: string, integer, float, boolean, json, yaml. [default: auto]

Global Options

  • -v|vv|vvv, --verbose. Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  • -y, --yes. Auto-accept the default for all user prompts. Equivalent to --no-interaction.
  • -l, --uri=URI. A base URL for building links and selecting a multi-site. Defaults to https://default.
  • To see all global options, run drush topic and pick the first choice.

Aliases

  • sset
  • state-set

Legend

  • An argument or option with square brackets is optional.
  • Any default value is listed at end of arg/option description.
  • An ellipsis indicates that an argument accepts multiple values separated by a space.