2

The drush command drush civicrm-disable-debug returns error The drush command 'civicrm-disable-debug' could not be found. Run 'drush cache-clear drush' to clear the commandfile cache if you have installed new extensions.

When entering drushto get the list of all commands, the disable command is not displayed, but the enable command is. The enable command works, and both are declared in the same way in ~/sites/all/modules/civicrm/drupal/drush/civicrm.drush.inc:

/**
 * Implementation of drush_hook_COMMAND_validate for command 'civicrm-enable-debug'
 */
function drush_civicrm_enable_debug_validate() {
  return _civicrm_init();
}

function drush_civicrm_enable_debug() {
  $settings = array(
    'debug_enabled' => 1,
    'backtrace' => 1,
  );

  foreach ($settings as $key => $val) {
    $result = civicrm_api('Setting', 'create', array('version' => 3, $key => $val));

    if ($result['is_error']) {
      drush_log(dt('An error occurred: !message', array('!message' => $result['error_message'])), 'error');
      return;
    }
  }

  drush_log(dt('CiviCRM debug setting enabled.'), 'ok');
}

/**
 * Implementation of drush_hook_COMMAND_validate for command 'civicrm-disable-debug'
 */
function drush_civicrm_disable_debug_validate() {
  return _civicrm_init();
}

function drush_civicrm_disable_debug() {
  $settings = array(
    'debug_enabled' => 0,
    'backtrace' => 0,
  );

  foreach ($settings as $key => $val) {
    $result = civicrm_api('Setting', 'create', array('version' => 3, $key => $val));

    if ($result['is_error']) {
      drush_log(dt('An error occurred: !message', array('!message' => $result['error_message'])), 'error');
      return;
    }
  }

  drush_log(dt('CiviCRM debug setting disabled.'), 'ok');
}

What to do to "enable" the "disable" command? Meanwhile, i use phpmyadmin to change the value of the field "debug_enabled" in the table "civicrm_setting" to "i:0;" (without the ").

Config: Drupal 7.53; CiviCRM 4.7.14

1 Answer 1

3

The civicrm-disable-debug command isn't defined in civicrm_drush_command(). See line 155:

$items['civicrm-enable-debug'] = array(
  'description' => "Enable CiviCRM Debugging.",
);

To solve this problem, you can add this below that:

$items['civicrm-disable-debug'] = array(
  'description' => "Disable CiviCRM Debugging.",
);

This would be an easy item to submit as a pull request so everyone could benefit.

3

Your Answer

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

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