private function createConfigYamlFile($data, $auth = true)
{
$fs = new Filesystem();
$config_file = $this->config_path . '/config.yml';
if ($fs->exists($config_file)) {
$config = Yaml::parse(file_get_contents($config_file));
$fs->remove($config_file);
}
if ($auth) {
$auth_magic = Str::random(32);
} else {
if (isset($config['auth_magic'])) {
$auth_magic = $config['auth_magic'];
} else {
$auth_magic = Str::random(32);
}
}
$allowHost = Str::convertLineFeed($data['admin_allow_hosts']);
if (empty($allowHost)) {
$adminAllowHosts = array();
} else {
$adminAllowHosts = explode("\n", $allowHost);
}
$target = array('${AUTH_MAGIC}', '${SHOP_NAME}', '${ECCUBE_INSTALL}', '${FORCE_SSL}');
$replace = array($auth_magic, $data['shop_name'], '0', $data['admin_force_ssl']);
$fs = new Filesystem();
$content = str_replace($target, $replace, file_get_contents($this->dist_path . '/config.yml.dist'));
$fs->dumpFile($config_file, $content);
$config = Yaml::parse(file_get_contents($config_file));
$config['admin_allow_host'] = $adminAllowHosts;
$yml = Yaml::dump($config);
file_put_contents($config_file, $yml);
return $this;
}