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