+}
+
+/**
+ * Generate a configuration file given user parameters and return the temporary filename.
+ * @param $doxygenTemplate String: full path for the template.
+ * @param $outputDirectory String: directory where the stuff will be output.
+ * @param $stripFromPath String: path that should be stripped out (usually mediawiki base path).
+ * @param $currentVersion String: Version number of the software
+ * @param $svnstat String: path to the svnstat file
+ * @param $input String: Path to analyze.
+ * @param $exclude String: Additionals path regex to exclude
+ * @param $exclude_patterns String: Additionals path regex to exclude
+ * (LocalSettings.php, AdminSettings.php, .svn and .git directories are always excluded)
+ */
+function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $svnstat, $input, $exclude, $exclude_patterns ) {
+
+ $template = file_get_contents( $doxygenTemplate );
+
+ // Replace template placeholders by correct values.
+ $replacements = array(
+ '{{OUTPUT_DIRECTORY}}' => $outputDirectory,
+ '{{STRIP_FROM_PATH}}' => $stripFromPath,
+ '{{CURRENT_VERSION}}' => $currentVersion,
+ '{{SVNSTAT}}' => $svnstat,
+ '{{INPUT}}' => $input,
+ '{{EXCLUDE}}' => $exclude,
+ '{{EXCLUDE_PATTERNS}}' => $exclude_patterns,
+ '{{HAVE_DOT}}' => `which dot` ? 'YES' : 'NO',
+ );
+ $tmpCfg = str_replace( array_keys( $replacements ), array_values( $replacements ), $template );
+ $tmpFileName = tempnam( wfTempDir(), 'mwdocgen-' );
+ file_put_contents( $tmpFileName , $tmpCfg ) or die( "Could not write doxygen configuration to file $tmpFileName\n" );
+
+ return $tmpFileName;
+}