* @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_patterns ) {
+function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $svnstat, $input, $exclude, $exclude_patterns ) {
$template = file_get_contents( $doxygenTemplate );
- // Generate path exclusions
- global $mwExcludePaths, $mwPath;
- $excludedPaths = $mwPath . join( " $mwPath", $mwExcludePaths );
- print "EXCLUDE: $excludedPaths\n\n";
-
// Replace template placeholders by correct values.
$replacements = array(
'{{OUTPUT_DIRECTORY}}' => $outputDirectory,
'{{CURRENT_VERSION}}' => $currentVersion,
'{{SVNSTAT}}' => $svnstat,
'{{INPUT}}' => $input,
- '{{EXCLUDE}}' => $excludedPaths,
+ '{{EXCLUDE}}' => $exclude,
'{{EXCLUDE_PATTERNS}}' => $exclude_patterns,
'{{HAVE_DOT}}' => `which dot` ? 'YES' : 'NO',
);
unset( $file );
-if ( is_array( $argv ) && isset( $argv[1] ) ) {
- switch( $argv[1] ) {
- case '--all': $input = 0; break;
- case '--includes': $input = 1; break;
- case '--languages': $input = 2; break;
- case '--maintenance': $input = 3; break;
- case '--skins': $input = 4; break;
- case '--file':
- $input = 5;
- if ( isset( $argv[2] ) ) {
- $file = $argv[2];
+if ( is_array( $argv ) ) {
+ for ($i = 0; $i < count($argv); $i++ ) {
+ switch( $argv[$i] ) {
+ case '--all': $input = 0; break;
+ case '--includes': $input = 1; break;
+ case '--languages': $input = 2; break;
+ case '--maintenance': $input = 3; break;
+ case '--skins': $input = 4; break;
+ case '--file':
+ $input = 5;
+ $i++;
+ if ( isset( $argv[$i] ) ) {
+ $file = $argv[$i];
+ }
+ break;
+ case '--no-extensions': $input = 6; break;
+ case '--output':
+ $i++;
+ if ( isset( $argv[$i] ) ) {
+ $doxyOutput = realpath( $argv[$i] );
+ }
+ break;
+ case '--help':
+ print <<<END
+Usage: php mwdocgen.php [<command>] [<options>]
+
+Commands:
+ --all Process entire codebase
+ --includes Process only files in includes/ dir
+ --languages Process only files in languages/ dir
+ --maintenance Process only files in maintenance/ dir
+ --skins Process only files in skins/ dir
+ --file <file> Process only the given file
+
+If no command is given, you will be prompted.
+
+Other options:
+ --output <dir> Set output directory (default $doxyOutput)
+ --help Show this help and exit.
+
+
+END;
+ exit(0);
+ break;
}
- break;
- case '--no-extensions': $input = 6; break;
}
}
$versionNumber = getSvnRevision( $input );
if ( $versionNumber === false ) { # Not using subversion ?
$svnstat = ''; # Not really useful if subversion not available
- $version = 'trunk'; # FIXME
+ # @todo FIXME
+ $version = 'trunk';
} else {
$version = "trunk (r$versionNumber)";
}
-$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $version, $svnstat, $input, $exclude_patterns );
+// Generate path exclusions
+$excludedPaths = $mwPath . join( " $mwPath", $mwExcludePaths );
+print "EXCLUDE: $excludedPaths\n\n";
+
+$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $version, $svnstat, $input, $excludedPaths, $exclude_patterns );
$command = $doxygenBin . ' ' . $generatedConf;
echo <<<TEXT