2

I want to use Drush vset to modify a subset of values stored in the 'variable' table's theme_themeName_settings record.

I've found references to vget and vset but all I've found so far is for the entire complex-variable.

Any help would be appreciated.

1 Answer 1

1

Drush does not support modifying elements inside a complex variable directly. You could instead use php-eval to do this:

$ drush php-eval '$v = variable_get("theme_themeName_settings"); $v["key"] = "value"; variable_set("theme_themeName_settings", $v);'
3
  • Hey Greg. Thank you very much for your post. It does do what I asked for. What I trying for is to create php code I can put into a php script that reads the vget result into a array(?), test values, set other values depending on the results of the test. I can get your suggestion to run in a script but can’t access the $v variable in any other php command. I suspect that the php-eval statement is “atomic.” Is there a way do get access to it? Thanks again. --- Mike
    – Mike
    Commented Apr 29, 2015 at 19:37
  • If you need to do that, and you still want to use Drush, it is time to learn how to write your own drush commands. Commented Apr 29, 2015 at 19:41
  • Yes, your best bet is writing a Drush command. See drupal.org/project/drushify. Halfway in between php-eval and a full Drush command is the Drush php-script command, which will run a sequence of php commands from a file. A full Drush command will allow you to pass arguments and options, in addition to that. Commented Apr 29, 2015 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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