deploy.provision.inc 1.53 KB
Newer Older
1 2
<?php

3
function drush_provision_mysql_provision_deploy_validate() {
4 5 6
  provision_db_connect();
}

7
function drush_provision_mysql_provision_deploy($url) {
Adrian Rossouw's avatar
Adrian Rossouw committed
8 9 10 11 12 13 14 15

  $db_type = drush_get_option('db_type');
  // As of Drupal 7 there is no more mysqli type
  if (drush_drupal_major_version() >= 7) {
    $db_type = ($db_type == 'mysqli') ? 'mysql' : $db_type;
  }
  $db_type = drush_set_option('db_type', $db_type, 'site');

16 17 18 19
  $db_host = drush_set_option('db_host', drush_get_option('db_host'), 'site');
  $db_passwd = drush_set_option('db_passwd', provision_password(), 'site');
  $db_name = drush_set_option('db_name', _provision_mysql_suggest_db_name($url), 'site');
  $db_user = drush_set_option('db_user', $db_name, 'site');
20

21
  _provision_mysql_new_site_db($db_name, $db_user, $db_passwd);
22

23 24 25
  _provision_mysql_import_dump(
    drush_get_option('sites_path') .'/'. $url .'/database.sql',
    $db_name, $db_user, $db_passwd, $db_host );
26 27 28
}


29
function drush_provision_mysql_provision_deploy_rollback($url = NULL) {
30
  _provision_mysql_destroy_site_db(drush_get_option('db_name'), drush_get_option('db_user'), drush_get_option('db_passwd'));
31 32 33 34
}

// Rollback doesn't apply here yet. Unless we trigger a deploy of the first dump
// made. Which could go on infinitely if something is really long.
35
function drush_provision_mysql_post_provision_deploy($url = NULL) {
36
  provision_path('unlink', drush_get_option('sites_path') .'/'. $url .'/database.sql', TRUE,
37
    dt("Removed dump file @path after restoring from it"),
anarcat's avatar
anarcat committed
38
    dt("Could not remove dump file @path"), 'DRUSH_PERM_ERROR');
39
}