summaryrefslogtreecommitdiff
path: root/maintenance/mwdocgen.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/mwdocgen.php')
-rw-r--r--maintenance/mwdocgen.php69
1 files changed, 55 insertions, 14 deletions
diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php
index ed511f74..0c3b262e 100644
--- a/maintenance/mwdocgen.php
+++ b/maintenance/mwdocgen.php
@@ -33,7 +33,7 @@
* @todo document
* @ingroup Maintenance
*
- * @author Ashar Voultoiz <hashar at free dot fr>
+ * @author Antoine Musso <hashar at free dot fr>
* @author Brion Vibber
* @author Alexandre Emsenhuber
* @version first release
@@ -89,6 +89,7 @@ require_once( "$mwPath/includes/GlobalFunctions.php" );
/**
* Read a line from the shell
* @param $prompt String
+ * @return string
*/
function readaline( $prompt = '' ) {
print $prompt;
@@ -151,9 +152,12 @@ function getSvnRevision( $dir ) {
* @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)
+ * @return string
*/
function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $svnstat, $input, $exclude, $exclude_patterns ) {
+ global $wgDoxyGenerateMan;
+
$template = file_get_contents( $doxygenTemplate );
// Replace template placeholders by correct values.
@@ -166,6 +170,7 @@ function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath,
'{{EXCLUDE}}' => $exclude,
'{{EXCLUDE_PATTERNS}}' => $exclude_patterns,
'{{HAVE_DOT}}' => `which dot` ? 'YES' : 'NO',
+ '{{GENERATE_MAN}}' => $wgDoxyGenerateMan ? 'YES' : 'NO',
);
$tmpCfg = str_replace( array_keys( $replacements ), array_values( $replacements ), $template );
$tmpFileName = tempnam( wfTempDir(), 'mwdocgen-' );
@@ -180,20 +185,56 @@ function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath,
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 '--generate-man':
+ $wgDoxyGenerateMan = true;
+ 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
+ --no-extensions Process everything but extensions directorys
+
+If no command is given, you will be prompted.
+
+Other options:
+ --output <dir> Set output directory (default $doxyOutput)
+ --generate-man Generates man page documentation
+ --help Show this help and exit.
+
+
+END;
+ exit(0);
+ break;
}
- break;
- case '--no-extensions': $input = 6; break;
}
}