protected function fire()
{
try {
$this->validate();
} catch (Exception $e) {
$this->error($e->getMessage());
return;
}
$mysqlCommand = (string) $this->makeMysqlCommand(MysqlCommand::class, $this->localCredentials);
$remoteCommand = (string) $this->makeMysqlCommand(MysqlDumpCommand::class, $this->remoteCredentials);
if (!$this->option('no-gzip')) {
$remoteCommand .= ' | gzip';
$mysqlCommand = 'gunzip | ' . $mysqlCommand;
}
if ($this->sshCredentials) {
$remoteCommand = $this->makeSshCommand($remoteCommand);
}
$command = "{$remoteCommand} | {$mysqlCommand}";
$this->info('Fetching remote database...');
if ($this->debug) {
$this->output->writeln($command);
} else {
passthru($command);
}
}