in lib/php/libsdk/SDK/Build/PGO/Server/PostgreSQL.php [27:52]
protected function setupDist()
{
$user = $this->conf->getSectionItem($this->name, "user");
if (!$user) {
$user = trim(shell_exec("pwgen -1 -s 8"));
$this->conf->setSectionItem($this->getName(), "user", $user);
}
$pass = $this->conf->getSectionItem($this->name, "pass");
if (!$pass) {
$pass = trim(shell_exec("pwgen -1 -s 8"));
$this->conf->setSectionItem($this->getName(), "pass", $pass);
}
if (!is_dir($this->data_dir)) {
$pwfile = tempnam(sys_get_temp_dir(), "tmp");
if (strlen($pass) !== file_put_contents($pwfile, $pass)) {
throw new Exception("Couldn't write '$pwfile'.");
}
$cmd = $this->base . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "initdb.exe --auth=trust --nosync --username=$user --pwfile=$pwfile --encoding=UTF8 " . $this->data_dir;
//$cmd = $this->base . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "initdb.exe --auth=trust --nosync --username=$user --encoding=UTF8 " . $this->data_dir;
/*echo "$cmd\n";
echo file_get_contents($pwfile) . "\n";*/
exec($cmd);
unlink($pwfile);
}
}