[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/schema/ -> schema.drush.inc (source)

   1  <?php
   2  // $Id: schema.drush.inc,v 1.1.2.1 2010/02/01 17:38:06 mikeryan Exp $
   3  
   4  /**
   5   * @file
   6   *   Schema drush commands.
   7   */
   8  
   9  /**
  10   * Implementation of hook_drush_command().
  11   */
  12  function schema_drush_command() {
  13    $items = array();
  14  
  15    // the key in the $items array is the name of the command.
  16    $items['schema-inspect'] = array(
  17      'description' => "Show the Drupal schema definition for table(s)",
  18      'arguments' => array(
  19        'tables' => 'A comma delimited list of table names',
  20      ),
  21    );
  22    return $items;
  23  }
  24  
  25  /**
  26   * Implementation of hook_drush_help().
  27   */
  28  function schema_drush_help($section) {
  29    switch ($section) {
  30      case 'drush:schema-inspect':
  31        return dt("Show the Drupal schema definition for table(s).");
  32    }
  33  }
  34  
  35  /**
  36   * A drush command callback.
  37   */
  38  function drush_schema_schema_inspect() {
  39    $args = func_get_args();
  40    $names = explode(',', $args[0]);
  41    foreach ($names as $name) {
  42      if ($table = schema_invoke('inspect', $name)) {
  43        $output = schema_phpprint_table($name, $table[$name]);
  44        drush_print($output);
  45      }
  46      else {
  47        drush_set_error(dt('Mising table: @table', array('@table' => $name)));
  48      }
  49    }
  50  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7