When I set a variable using vset $ drush vset var 1, it appears to be setting it as a string.

Running $ drush vget var returns var: "1" and not var: 1 as expected.

Could this be a bash config? OR am I just misunderstanding the display? How would I set something to TRUE?

Comments

moshe weitzman’s picture

Status: Active » Closed (won't fix)

thats the best we can do with vset. if you really need non strings, use eval: drush eval "variable_set('foo', TRUE);"

klokie’s picture

Status: Closed (won't fix) » Needs review

That's a bit odd - the first example for drush help vset is drush vset --yes preprocess_css 1. One might think that would set the variable as an integer, but since Drush sets a string and Drupal 7 expects the variable to be an integer, this example does not work as expected.

greg.1.anderson’s picture

StatusFileSize
new3.83 KB

How about this?

greg.1.anderson’s picture

StatusFileSize
new8.45 KB

Same thing, cleaned up a bit and with a bit of extra polish on make maintenance_mode (plus docs and shell aliases for taking a site offline and brining it back online again).

Might as well make common things easy.

moshe weitzman’s picture

Status: Needs review » Needs work

I need to look more closely at this over the weekend. In general, looks good. Meanwhile, minor comments:

We mention 'We don't support earlier than Drupal 6 or earlier' but Drush5 does not support anything earlier.

+++ b/commands/core/variable.drush.incundefined
@@ -58,10 +57,12 @@ function variable_drush_command() {
       'yes' => 'Skip confirmation if only one variable name matches.',
+      'exact' => 'Only delete the one variable that exactly matches the specified name.',

Should this be called 'always-delete'?

+    $options['state-def']           = array('hidden' => TRUE, 'merge-associative' => TRUE, 'description' => 'State definitions for core-state command.');

Whats this?

greg.1.anderson’s picture

'state-def' is leftover cruft from a Drush experimental command that I worked on for a few minutes before realizing that it was unnecessary, as the use case can already be served by shell aliases. I will get rid of it; it will not return.

'always-delete' does have good alignment with 'always-set', but in the case of variable-delete, 'exact' will only cause a deletion to happen if the variable name matches exactly. For example, if you have variables 'foo', 'foo_a', 'foo_b' and so on, drush vdel --exact foo will delete 'foo', but not 'foo_a' etc. I suppose that 'always-delete' does match this behavior, but to me it seemed to imply that all of the 'foo's would be deleted. I could go with it if you thought it better.

I'll wait for your further review before re-rolling.

moshe weitzman’s picture

Status: Needs work » Reviewed & tested by the community

Looks good. There are two lines with only several spaces in them.

greg.1.anderson’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.