Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #51 from jwatzman/master
Browse files Browse the repository at this point in the history
Fix database installation on OS X
  • Loading branch information
fredemmott committed Aug 31, 2015
2 parents 04c1637 + 94ec45c commit f92b77a
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions base/DatabaseInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,35 @@ public function installDatabase(): bool {
$sed = 'sed s/MyISAM/InnoDB/g |';
}

shell_exec(
$cat = 'cat';
if ($this->options->dumpIsCompressed) {
$cat = trim(shell_exec('which gzcat'));
if ($cat === null) {
$cat = 'zcat';
}
}

$output = null;
$ret = null;
exec(
Utils::EscapeCommand(
Vector {$this->options->dumpIsCompressed ? 'zcat' : 'cat', $dump},
Vector {$cat, $dump},
).
'|'.
$sed.
Utils::EscapeCommand(
Vector {'mysql', '-h', '127.0.0.1', $db, '-u', $db, '-p'.$db},
),
$output,
$ret,
);

if ($ret !== 0) {
throw new Exception(
'Database installation failed: '.implode("\n", $output)
);
}

return true;
}

Expand Down

0 comments on commit f92b77a

Please sign in to comment.