You are here

class Drush in MongoDB 8

Hierarchy

  • class \Drupal\Driver\Database\mongodb\Drush extends \Drush\Sql\SqlBase

Expanded class hierarchy of Drush

File

drivers/lib/Drupal/Driver/Database/mongodb/Drush.php, line 7

Namespace

Drupal\Driver\Database\mongodb
View source
class Drush extends SqlBase {
  public function command() {
    return 'mongo';
  }
  public function __construct($db_spec = NULL) {
    if (isset($db_spec['host'])) {
      $db_spec['database'] = 'mongodb://' . $db_spec['host'] . '/' . $db_spec['database'];
    }
    parent::__construct($db_spec);
  }
  public function creds($hide_password = TRUE) {
    $parameters = [];
    if ($this->db_spec['username']) {
      $parameters['u'] = $this->db_spec['username'];
    }
    if ($this->db_spec['password']) {
      $parameters['p'] = $this->db_spec['password'];
    }
    $return = $parameters ? $this
      ->params_to_options($parameters) : '';

    // The mongo shell doesn't want the mongodb:// in the beginning.
    return $return . ' ' . substr($this->db_spec['database'], 10);
  }
  public function createdb($quoted = FALSE) {
  }
  public function drop_or_create() {
    $this
      ->query("db.dropDatabase()");
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Drush::command public function
Drush::createdb public function
Drush::creds public function
Drush::drop_or_create public function
Drush::__construct public function