remove db_name configuration
Dieser Commit ist enthalten in:
Ursprung
d98a79efce
Commit
05b7443a3a
@ -7,8 +7,7 @@ set('db_conf_path', function () {
|
||||
});
|
||||
|
||||
set('database_configured', function() {
|
||||
return has('db_name') && strlen(get('db_name')) &&
|
||||
has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]");
|
||||
return has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]");
|
||||
});
|
||||
|
||||
set('mysql_configured', function() {
|
||||
@ -20,4 +19,3 @@ set('mysqldump_configured', function() {
|
||||
return has('bin/mysql') && strlen(get('bin/mysql')) &&
|
||||
get('database_configured');
|
||||
});
|
||||
|
||||
|
@ -22,9 +22,10 @@ task('setup:createDbConfig', function () {
|
||||
if (test("[ -f {{db_conf_path}} ]")) {
|
||||
$db_host = ask('database host', 'localhost');
|
||||
$db_port = ask('database port', '3306');
|
||||
$db_name = ask('database name');
|
||||
$db_user = ask('database user');
|
||||
$db_pass = askHiddenResponse('database password');
|
||||
run('printf "[mysql]\nuser='.$db_user.'\npassword=\"'.$db_pass.'\"\nhost='.$db_host.'\nport='.$db_port.'\n\n[mysqldump]\nuser='.$db_user.'\npassword=\"'.$db_pass.'\"\nhost='.$db_host.'\nport='.$db_port.'" > {{db_conf_path}}');
|
||||
run('printf "[mysql]\nuser='.$db_user.'\npassword=\"'.$db_pass.'\"\ndatabase=\"'.$db_name.'\"\nhost='.$db_host.'\nport='.$db_port.'\n\n[mysqldump]\nuser='.$db_user.'\npassword=\"'.$db_pass.'\"\ndatabase=\"'.$db_name.'\"\nhost='.$db_host.'\nport='.$db_port.'" > {{db_conf_path}}');
|
||||
info('config successful created');
|
||||
} else {
|
||||
throw new \RuntimeException('can not create {{db_conf_path}}, task stopped');
|
||||
@ -32,4 +33,4 @@ task('setup:createDbConfig', function () {
|
||||
} catch(\RuntimeException $e) {
|
||||
warning($e->getMessage());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -9,13 +9,14 @@ task('shop:runMigration', [
|
||||
'shop:setShopsOnline'
|
||||
]);
|
||||
|
||||
|
||||
require_once 'inc/database.php';
|
||||
|
||||
desc('set shops offline');
|
||||
task('shop:setShopsOffline', function() {
|
||||
if (get('mysql_configured')) {
|
||||
$query = "UPDATE oxshops SET oxactive = '0', OXREGISTERSUBJECT = CONCAT('..', OXREGISTERSUBJECT) WHERE oxactive = '1';";
|
||||
run('{{bin/mysql}} --defaults-extra-file={{db_conf_path}} {{db_name}} -e "'.$query.'"');
|
||||
run('{{bin/mysql}} --defaults-extra-file={{db_conf_path}} -e "'.$query.'"');
|
||||
} else {
|
||||
warning('missing config, task skipped');
|
||||
}
|
||||
@ -38,7 +39,7 @@ desc('set shops online');
|
||||
task('shop:setShopsOnline', function() {
|
||||
if (get('mysql_configured')) {
|
||||
$query = "UPDATE oxshops SET oxactive = '1', OXREGISTERSUBJECT = SUBSTR(OXREGISTERSUBJECT, 3) WHERE oxactive = '0' AND OXREGISTERSUBJECT LIKE '..%';";
|
||||
run('{{bin/mysql}} --defaults-extra-file={{db_conf_path}} {{db_name}} -e "'.$query.'"');
|
||||
run('{{bin/mysql}} --defaults-extra-file={{db_conf_path}} -e "'.$query.'"');
|
||||
} else {
|
||||
warning('missing config, task skipped');
|
||||
}
|
||||
@ -66,10 +67,11 @@ task('shop:cloneDatabase', function () {
|
||||
$source_name = ask('source database name');
|
||||
$source_user = ask('source database user');
|
||||
$source_pass = askHiddenResponse('source database password');
|
||||
if (askConfirmation('Do you really want to clone from "'.$source_name.'" to "{{db_name}}"? The target database "{{db_name}}" will be overwritten!')) {
|
||||
$target_name = parse_ini_file(get('db_conf_path'))['database'];
|
||||
if (askConfirmation('Do you really want to clone from "'.$source_name.'" to "'.$target_name.'"? The target database "'.$target_name.'" will be overwritten!')) {
|
||||
info('cloning database');
|
||||
$auth = "-h".$source_host." -P".$source_port." -u".$source_user." -p'".$source_pass."'";
|
||||
run("{{bin/mysqldump}} ".$auth." --opt --no-create-db -f ".$source_name." $({{bin/mysql}} ".$auth." -ANe\"SET group_concat_max_len = 10485760; SELECT GROUP_CONCAT(table_name SEPARATOR ' ') FROM information_schema.tables WHERE table_schema='".$source_name."' AND engine IS NOT NULL;\") | {{bin/mysql}} --defaults-extra-file={{db_conf_path}} -f {{db_name}}");
|
||||
run("{{bin/mysqldump}} ".$auth." --opt --no-create-db -f ".$source_name." $({{bin/mysql}} ".$auth." -ANe\"SET group_concat_max_len = 10485760; SELECT GROUP_CONCAT(table_name SEPARATOR ' ') FROM information_schema.tables WHERE table_schema='".$source_name."' AND engine IS NOT NULL;\") | {{bin/mysql}} --defaults-extra-file={{db_conf_path}} -f");
|
||||
info('creating views');
|
||||
run('{{release_or_current_path}}/vendor/bin/oe-eshop-db_views_regenerate');
|
||||
info('successfully finished');
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren