backdrop-contrib / examples

Examples for Developers
GNU General Public License v2.0
7 stars 9 forks source link

Verify that configuration values are not used for values that are not configuration #79

Open avpaderno opened 1 year ago

avpaderno commented 1 year ago

On #43, values stored as configuration values have been replaced by state values. That issue fixed the most obvious cases of configuration values that instead were values describing the state of the site, which for example are the last time cron tasks have been execute, or the last time a site checked for module/theme updates.

There are other cases where configuration values should not be used. For example, the ajax_example/ajax_example_progressbar.inc contains the following code.

$variable_name = 'example_progressbar_' . $form_state['time'];
$commands = array();

config_set('ajax_example', $variable_name, 10);
sleep(2);
config_set('ajax_example', $variable_name, 40);
sleep(2);
config_set('ajax_example', $variable_name, 70);
sleep(2);
config_set('ajax_example', $variable_name, 90);
sleep(2);
config_set('ajax_example', $variable_name, NULL);

That code is saving a temporary value, not a value that needs to be exported, for example, from a development site to a production site.
In those cases, another way to store those values should be used.