Logo Search packages:      
Sourcecode: aegir-provision version File versions  Download package

_provision_mysql_new_site_db ( db_name,
db_grant_host = NULL 

Generate a new mysql database and user account for the specified credentials

Definition at line 46 of file provision_mysql.drush.inc.

References _provision_mysql_grant_host().

  if (is_null($db_grant_host)) {
    $db_grant_host = _provision_mysql_grant_host(
      drush_get_option('db_host', ''), 
      drush_get_option('web_ip', null), 
      drush_get_option('web_host', 'localhost'));
  if (!_provision_mysql_create_database($db_name) ||
      !_provision_mysql_database_exists($db_name) ) {
   drush_log("Database could not be created.", 'error');
   return FALSE;
  drush_log(dt("Granting privileges to %user@%client on %database", array('%user' => $db_user, '%client' => $db_grant_host, '%database' => $db_name)));
  if (!_provision_mysql_grant($db_name, $db_user, $db_passwd, $db_grant_host)) {
    drush_log("Could not GRANT user access.", 'warning');

  $status = _provision_mysql_database_exists($db_name);

  if ($status) {
    drush_log(dt('Created @name database', array("@name" => $db_name)), 'success');
  else {
    drush_set_error('PROVISION_CREATE_DB_FAILED', dt("Could not create @name database", array("@name" => $db_name)));
  return $status; 
   //TODO : Test to confirm that the database is actually writeable. Taking this on faith for now.

Generated by  Doxygen 1.6.0   Back to index