deploy.provision.inc 1.35 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) {
8
9
10
11
12
  $db_type = drush_set_option('db_type', drush_get_option('db_type'), 'site');
  $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');
13

14
  _provision_mysql_new_site_db($db_name, $db_user, $db_passwd);
15

16
17
18
  _provision_mysql_import_dump(
    drush_get_option('sites_path') .'/'. $url .'/database.sql',
    $db_name, $db_user, $db_passwd, $db_host );
19
20
21
}


22
function drush_provision_mysql_provision_deploy_rollback($url = NULL) {
23
  _provision_mysql_destroy_site_db(drush_get_option('db_name'), drush_get_option('db_user'), drush_get_option('db_passwd'));
24
25
26
27
}

// 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.
28
function drush_provision_mysql_post_provision_deploy($url = NULL) {
29
  provision_path('unlink', drush_get_option('sites_path') .'/'. $url .'/database.sql', TRUE,
30
    dt("Removed dump file @path after restoring from it"),
31
    dt("Could not remove dump file @path"), DRUSH_PERM_ERROR);
32
}