protected function getConfigFilePath()
{
if (!isset($_SERVER['HOME'])) {
+ Log::err('Cannot determine home directory');
return false;
}
$str .= $hostProp . '=' . $hostVal . "\n";
}
}
- file_put_contents($this->getConfigFilePath(), $str);
+ $cfgFilePath = $this->getConfigFilePath();
+ $cfgDir = dirname($cfgFilePath);
+ if (!is_dir($cfgDir)) {
+ mkdir($cfgDir, 0700);
+ }
+ file_put_contents($cfgFilePath, $str);
+ //contains sensitive data; nobody else may read that
+ chmod($cfgFilePath, 0600);
}
public function getDefaultHost()