You are here

warden.drush.inc in Warden 7

Drush integration with the Warden module.

File

warden.drush.inc
View source
<?php

/**
 * @file
 * Drush integration with the Warden module.
 */

/**
 * Implements of hook_drush_command().
 */
function warden_drush_command() {
  $items = array();
  $items['warden-check-connection'] = array(
    'description' => 'Test the connection to Warden by getting its public key',
  );
  $items['warden-update'] = array(
    'description' => 'Update Warden with the lastest site data',
  );
  $items['warden-show-module-data'] = array(
    'description' => 'Displays the module data that will be sent to Warden',
  );
  return $items;
}

/**
 * Test the connection to warden.
 */
function drush_warden_check_connection() {
  drush_print(dt('Going to check connection to Warden server by retreiving the public key ...'));
  try {
    $key = warden_get_api()
      ->getPublicKey();
    drush_print($key);
  } catch (Exception $e) {
    drush_set_error($e
      ->getMessage());
  }
}

/**
 * Test the connection to warden.
 */
function drush_warden_update() {
  module_load_include('inc', 'warden', 'warden.page');
  drush_print(dt('Going to update Warden ...'));
  try {
    _warden_update_warden();
    drush_print(dt('... success'));
  } catch (Exception $e) {
    return drush_set_error($e
      ->getMessage());
  }
}

/**
 * Prints out the details of the data that the will be reported to Warden.
 *
 * This shows the module name and version data that will be reported.
 */
function drush_warden_show_module_data() {
  module_load_include('inc', 'warden', 'warden.page');
  $data = _warden_generate_site_data();
  drush_print_r($data);
}

Functions

Namesort descending Description
drush_warden_check_connection Test the connection to warden.
drush_warden_show_module_data Prints out the details of the data that the will be reported to Warden.
drush_warden_update Test the connection to warden.
warden_drush_command Implements of hook_drush_command().