# Variables / Configuration
#
-if ( php_sapi_name() != 'cli' ) {
+if ( PHP_SAPI != 'cli' ) {
echo 'Run "' . __FILE__ . '" from the command line.';
die( -1 );
}
/** where Phpdoc should output documentation */
$doxyOutput = $mwPath . 'docs' . DIRECTORY_SEPARATOR ;
+$doxyVersion = 'master';
+
/** MediaWiki subpaths */
$mwPathI = $mwPath . 'includes/';
$mwPathL = $mwPath . 'languages/';
* @param $doxyGenerateMan Boolean
* @return string
*/
-function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $input, $exclude, $excludePatterns, $doxyGenerateMan ) {
- global $doxygenInputFilter;
+function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $input, $exclude, $excludePatterns, $doxyGenerateMan, $doxygenInputFilter ) {
$template = file_get_contents( $doxygenTemplate );
// Replace template placeholders by correct values.
);
$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;
}
$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.
$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 );
+$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 );