Skip to content

Commit d9223fa

Browse files
authored
Merge pull request #30 from dmstr/feature/cmd-refactoring
improved command generation
2 parents 9591845 + 2058b3a commit d9223fa

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

console/controllers/MysqlController.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,14 @@ public function actionDump()
347347
// dump tables with data
348348
$command = CliHelper::getMysqlCommand('mysqldump', $db);
349349
$command->addArg('--no-tablespaces');
350+
$command->addArg('--opt');
350351

351-
$noDataTables = explode(',', $this->noDataTables);
352-
foreach ($noDataTables as $table) {
353-
$command->addArg('--ignore-table', $opts['db'] . '.' . $table);
352+
if ($this->noDataTables) {
353+
$noDataTables = explode(',', $this->noDataTables);
354+
355+
foreach ($noDataTables as $table) {
356+
$command->addArg('--ignore-table', $opts['db'] . '.' . $table);
357+
}
354358
}
355359
$command->addArg($opts['db']);
356360
$command->addArg(' > ', '', false);
@@ -365,11 +369,12 @@ public function actionDump()
365369
}
366370

367371

368-
if ($noDataTables) {
372+
if ($this->noDataTables) {
369373
// dump tables without data
370374
$commandNoData = CliHelper::getMysqlCommand('mysqldump', $db);
371375
$commandNoData->addArg('--no-tablespaces');
372376
$commandNoData->addArg('--no-data');
377+
$commandNoData->addArg('--opt');
373378
$commandNoData->addArg($opts['db']);
374379

375380
foreach ($noDataTables as $table) {

0 commit comments

Comments
 (0)