Description

In the process of implementing the move to configuration in core (CMI) it was found that several core systems store things in the variables table that aren't actually configuration.

Most of these have the following in common:

  • They are never set via the UI or custom code.
  • Some of them are not really cache items - more for tracking state between requests (and different sessions).
  • Some that look like cache items (path alias whitelist, css/js) are expensive to build and don't necessarily need to be wiped on a cache flush.
  • Some of them are requested on more or less every request to Backdrop.
  • They are never transferred between sites.

The States storage system was implemented in Backdrop to store these values in place of using CMI. The States system in Backdrop is built to mirror the outgoing variable table schema but doesn't load the entire table all at once. States values are cached, similar to variables.

Implementations

Old D7:
variable_set('install_task', 'done');

New Backdrop:
state_set('install_task', 'done');

Old D7:
variable_del('my_module_variable');

New Backdrop:
state_del('my_module_variable');

Old D7:
$query_string = variable_get('css_js_query_string', '0');

New Backdrop:
$query_string = state_get('css_js_query_string', '0');

Variables converted:

  • cron_key
  • cron_last
  • css_js_query_string
  • install_task
  • install_time
  • maintenance_mode

Test variables converted:

  • block_test_content
  • entity_cache_test_label
  • node_access_test_private
  • image_module_test_file_download
  • locale_test_domain
  • locale_test_content_language_type
  • locale_test_language_types
  • locale_test_language_negotiation_info
  • locale_test_language_negotiation_info_alter
  • node_test_node_access_all_uid
  • file_test_hook_file_url_alter
  • test_verbose_module_hooks
  • dependency_test
  • dependencies (this variable should be renamed to something more specific)
  • update_script_test_requirement_type
  • update_test_xml_map
  • update_test_system_info
  • update_test_update_status
  • test_dynamic_access_argument1
  • test_dynamic_access_argument2
  • views_test_views_data_count
  • views_test_schema
  • views_test_views_data
  • views_test_views_plugins
  • test_email_collector backdrop/backdrop#128
Introduced in branch: 
1.0.x
Introduced in version: 
1.0.0
Impacts: 
Module developers
Theme developers
Related Github Issues: 
https://github.com/backdrop/backdrop-issues/issues/141
https://github.com/backdrop/backdrop-issues/issues/163