2

How do you make drush bootstrap minimal. How do you specify the bootstrap method like DRUPAL_BOOTSTRAP_VARIABLES, DRUPAL_BOOTSTRAP_CONFIGURATION in the drush command?

Background:

I just want to have the drupal variable value in a shell script variable. I can use vget, but i donot want to make the full bootstrap.

4

The general answer to your question is that you cannot change the bootstrap level of a Drush command as a user; Drush has already specified the minimum bootstrap level in each command's command record. Running a command at a lower bootstrap than it needs will cause it to fail.

However, in the case of variable-get, it looks like you are correct. vget is set to use a full bootstrap, but it would probably work just fine with DRUSH_BOOTSTRAP_DRUPAL_DATABASE. This could be classified as a Drush (performance) bug.

If you would like to help out here, you could submit an issue to the Drush issue queue. Add DRUSH_BOOTSTRAP_DRUPAL_DATABASE to the variable commands, test it and post a patch, and the maintainers would be happy to commit it.

Here's what the record for variable-get would look like:

  $items['variable-get'] = array(
    'description' => 'Get a list of some or all site variables and values.',
    'arguments' => array(
      'name' => 'A string to filter the variables by. Variables whose name contains the string will be listed.',
    ),
    'examples' => array(
      'drush vget' => 'List all variables and values.',
      'drush vget user' => 'List all variables containing the string "user".',
      'drush vget site_mail --exact' => 'Show the variable with the exact key "site_mail".',
    ),
    'options' => array(
      'format' => array(
        'description' => 'Format to output the object. Use "print_r" for print_r (default), "export" for var_export, and "json" for JSON.',
        'example-value' => 'export',
      ),
      'pipe' => 'A synonym for --format=export. Useful for pasting into code.',
      'exact' => 'Only get the one variable that exactly matches the specified name.',
    ),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_DATABASE,       
    'aliases' => array('vget'),
  );

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.