$doxygenInputFilter = "php {$mwPath}maintenance/mwdoc-filter.php";
/** where Phpdoc should output documentation */
-$doxyOutput = $mwPath . 'docs' . DIRECTORY_SEPARATOR ;
+$doxyOutput = $mwPath . 'docs' . DIRECTORY_SEPARATOR;
+
+$doxyVersion = 'master';
/** MediaWiki subpaths */
$mwPathI = $mwPath . 'includes/';
#
define( 'MEDIAWIKI', true );
-require_once( "$mwPath/includes/GlobalFunctions.php" );
+require_once "$mwPath/includes/GlobalFunctions.php";
/**
* Read a line from the shell
// Replace template placeholders by correct values.
$replacements = array(
'{{OUTPUT_DIRECTORY}}' => $outputDirectory,
- '{{STRIP_FROM_PATH}}' => $stripFromPath,
- '{{CURRENT_VERSION}}' => $currentVersion,
- '{{INPUT}}' => $input,
- '{{EXCLUDE}}' => $exclude,
+ '{{STRIP_FROM_PATH}}' => $stripFromPath,
+ '{{CURRENT_VERSION}}' => $currentVersion,
+ '{{INPUT}}' => $input,
+ '{{EXCLUDE}}' => $exclude,
'{{EXCLUDE_PATTERNS}}' => $excludePatterns,
- '{{HAVE_DOT}}' => `which dot` ? 'YES' : 'NO',
- '{{GENERATE_MAN}}' => $doxyGenerateMan ? 'YES' : 'NO',
- '{{INPUT_FILTER}}' => $doxygenInputFilter,
+ '{{HAVE_DOT}}' => `which dot` ? 'YES' : 'NO',
+ '{{GENERATE_MAN}}' => $doxyGenerateMan ? 'YES' : 'NO',
+ '{{INPUT_FILTER}}' => $doxygenInputFilter,
);
$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" );
+ file_put_contents( $tmpFileName, $tmpCfg ) or die( "Could not write doxygen configuration to file $tmpFileName\n" );
return $tmpFileName;
}
unset( $file );
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;
+ 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++;
$file = $argv[$i];
}
break;
- case '--no-extensions': $input = 6; break;
+ case '--no-extensions':
+ $input = 6;
+ break;
case '--output':
$i++;
if ( isset( $argv[$i] ) ) {
$doxyOutput = realpath( $argv[$i] );
}
break;
+ case '--version':
+ $i++;
+ if ( isset( $argv[$i] ) ) {
+ $doxyVersion = $argv[$i];
+ }
+ break;
case '--generate-man':
$doxyGenerateMan = true;
break;
If no command is given, you will be prompted.
Other options:
- --output <dir> Set output directory (default $doxyOutput)
+ --output <dir> Set output directory (default: $doxyOutput)
--generate-man Generates man page documentation
+ --version Project version to display in the outut (default: $doxyVersion)
--help Show this help and exit.
END;
- exit(0);
+ exit( 0 );
break;
}
}
5 : only a given file
6 : all but the extensions directory
OPTIONS;
- while ( !is_numeric( $input ) )
- {
+ while ( !is_numeric( $input ) ) {
$input = readaline( "\nEnter your choice [0]:" );
if ( $input == '' ) {
$input = 0;
}
switch ( $input ) {
-case 0: $input = $mwPath; break;
-case 1: $input = $mwPathI; break;
-case 2: $input = $mwPathL; break;
-case 3: $input = $mwPathM; break;
-case 4: $input = $mwPathS; break;
+case 0:
+ $input = $mwPath;
+ break;
+case 1:
+ $input = $mwPathI;
+ break;
+case 2:
+ $input = $mwPathL;
+ break;
+case 3:
+ $input = $mwPathM;
+ break;
+case 4:
+ $input = $mwPathS;
+ break;
case 5:
if ( !isset( $file ) ) {
$file = readaline( "Enter file name $mwPath" );
$excludePatterns = 'extensions';
}
-// @todo FIXME to work on git
-$version = 'master';
-
// Generate path exclusions
$excludedPaths = $mwPath . join( " $mwPath", $mwExcludePaths );
print "EXCLUDE: $excludedPaths\n\n";
-$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $version, $input, $excludedPaths, $excludePatterns, $doxyGenerateMan, $doxygenInputFilter );
+$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $doxyVersion, $input, $excludedPaths, $excludePatterns, $doxyGenerateMan, $doxygenInputFilter );
$command = $doxygenBin . ' ' . $generatedConf;
echo <<<TEXT
TEXT;
-passthru( $command );
+$exitcode = 1;
+passthru( $command, $exitcode );
echo <<<TEXT
---------------------------------------------------
You might want to delete the temporary file $generatedConf
TEXT;
+
+exit( $exitcode );