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

Commit

Permalink
Fix database installation on OS X
Browse files Browse the repository at this point in the history
`zcat` on OS X insists on adding a `.Z` suffix, which of course doesn't
work. `gzcat` doesn't do this, but isn't available on all Linux systems.
So just check for which one to use.
  • Loading branch information
jwatzman committed Aug 31, 2015
1 parent bae147d commit 94ec45c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion base/DatabaseInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,19 @@ public function installDatabase(): bool {
$sed = 'sed s/MyISAM/InnoDB/g |';
}

$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.
Expand Down

0 comments on commit 94ec45c

Please sign in to comment.