URL: http://wizzlern.nl
Drupal allows hookupdateN to run any sort of code. Most of the time, however, people only use this to alter the database scheme. But you can use it for much more. Like setting variables, creating nodes, importing views and so on. This code shows how to set a series of variables in Drupal.
When you deploy this code, running update.php will set all the variables as in the listing.
I typically catch this in a module called 'projectnamemeta'. So this function would go in projectnamemeta.install, and will be called from projectnamemetainstall and projectnamemetaupdate_5002, for example.
/** * Sets a variable range of variables to LUX-values. * * @return * An array of name=>value pairs containing the var and its value. */ function _projectname_meta_set_variables() { 'site_name' => 'My New Site!', 'site_offline' => FALSE, ); foreach($variables as $key => $value) { variable_set($key, $value); $statii[] = "$key => $value"; } }
You need to login to post a comment.
