$c->reset_value ($section, $var, $default) ;
}
+/**
+ * Interpolate configuration variables between braces
+ * Typically used in httpd conf, e.g. {core/log_path}
+ */
+function forge_expand_config_braces($line) {
+ return preg_replace_callback(
+ ',{([a-z_]*)/([a-z_]*)},',
+ function ($matches) {
+ return forge_get_config($matches[2], $matches[1]);
+ },
+ $line);
+}
+
// Local Variables:
// mode: php
// c-file-style: "bsd"
$str = str_replace('{unix_group_name}', $arr['unix_group_name'], $str);
$str = str_replace('{docdir}', $arr['docdir'], $str);
$str = str_replace('{cgidir}', $arr['cgidir'], $str);
- $str = str_replace('{core/log_path}', $logPath, $str);
- $str = str_replace('{core/groupdir_prefix}', $groupdirPrefix, $str);
+ $str = forge_expand_config_braces($str);
file_put_contents($outVhostsFile, $str, FILE_APPEND);
$count++;
}
// Replace the variable with the configuration value
foreach($lines as $line) {
- $line = preg_replace_callback(
- ',{([a-z_]*)/([a-z_]*)},',
- function ($matches) {
- return forge_get_config($matches[2], $matches[1]);
- },
- $line);
- fwrite($out, $line);
+ $line = forge_expand_config_braces($line);
+ fwrite($out, $line);
}
fclose($out);