0

When we want to pin a variable for an environment, we'll set the value in the admin, then go look it up in the database, and copy the name and value into a bash or phing script, to insure that that variable is always set to the appropriate value for the environment.

However, for complex variables, such as options lists, what should set string look like? For example node_export_file_types looks like this in the database:

a:29:{s:4:"blog";s:4:"blog";s:10:"case_study";s:10:"case_study";s:7:"analyst";i:0;s:5:"asset";i:0;s:4:"book";i:0;s:6:"course";i:0;s:8:"download";i:0;s:8:"employee";i:0;s:19:"evaluation_download";i:0;s:4:"news";i:0;s:17:"front_page_header";i:0;s:11:"hero_banner";i:0;s:12:"landing_page";i:0;s:11:"layout_page";i:0;s:10:"news_event";i:0;s:10:"news_press";i:0;s:7:"product";i:0;s:16:"product_overview";i:0;s:17:"product_resources";i:0;s:15:"product_webinar";i:0;s:8:"workshop";i:0;s:12:"registration";i:0;s:8:"resource";i:0;s:7:"license";i:0;s:7:"support";i:0;s:16:"training_courses";i:0;s:16:"training_request";i:0;s:17:"training_webinars";i:0;s:7:"webform";i:0;}

if we wanted to set that using drush vset node_export_file_types 'somestring' what that 'somestring' look like?

1

You can use drush.

drush vget foo --pipe

The --pipe option will format the output as php code.

As far as using that with drush vset, I would recommend against that and instead set via an update hook, or directly in settings.php.

  • Thanks, I'd overlooked --pipe, and it is a really helpful piece of the the puzzle. I can live with setting complex vars in an update hook, but here's the inconvenience: we've started implementing config management with drush tasks in phing, but stuff complex vars in code; can we call a function from drush, so at least we can fire it from a phing build script, I wonder? – August1914 Jun 5 '13 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.