26require_once __DIR__ .
'/Maintenance.php';
55 parent::__construct();
62 'Pass a MediaWiki version',
65 "Only process given file or directory. Multiple values " .
66 "accepted with comma separation. Path relative to MW_INSTALL_PATH.",
69 'Path to write doc to',
72 'Process the extensions/ directory as well (ignored if --file is used)' );
74 'Process the skins/ directory as well (ignored if --file is used)' );
79 return Maintenance::DB_NONE;
82 protected function init() {
85 $this->doxygen = $this->
getOption(
'doxygen',
'doxygen' );
86 $this->mwVersion = $this->
getOption(
'version',
'master' );
92 $this->inputFilter = Shell::escape( [
94 MW_INSTALL_PATH .
'/maintenance/mwdoc-filter.php'
97 $this->
template = MW_INSTALL_PATH .
'/maintenance/Doxyfile';
104 if ( $file !==
null ) {
106 foreach ( explode(
',', $file ) as $input ) {
108 $this->input .=
" \"$input\"";
114 if ( !$this->
hasOption(
'extensions' ) ) {
115 $this->excludes[] =
'extensions';
118 $this->excludes[] =
'skins';
122 $this->doDot = (bool)shell_exec(
'which dot' );
128 # Build out directories we want to exclude
130 foreach ( $this->excludes as $item ) {
131 $exclude .=
" $item";
134 $conf = strtr( file_get_contents( $this->
template ),
136 '{{OUTPUT_DIRECTORY}}' => $this->
output,
137 '{{CURRENT_VERSION}}' => $this->mwVersion,
138 '{{INPUT}}' => $this->input,
139 '{{EXCLUDE}}' => $exclude,
140 '{{HAVE_DOT}}' => $this->doDot ?
'YES' :
'NO',
141 '{{INPUT_FILTER}}' => $this->inputFilter,
145 $tmpFile = tempnam(
wfTempDir(),
'MWDocGen-' );
146 if ( file_put_contents( $tmpFile, $conf ) ===
false ) {
147 $this->
fatalError(
"Could not write doxygen configuration to file $tmpFile\n" );
150 $command = $this->doxygen .
' ' . $tmpFile;
151 $this->
output(
"Executing command:\n$command\n" );
154 system( $command, $exitcode );
157---------------------------------------------------
158Doxygen execution finished.
159Check above
for possible errors.
161You might want to
delete the temporary file:
163---------------------------------------------------
168 if ( $exitcode !== 0 ) {
169 $this->
fatalError(
"Something went wrong (exit: $exitcode)\n", $exitcode );
176require_once RUN_MAINTENANCE_IF_MAIN;
wfTempDir()
Tries to get the system directory for temporary files.
Maintenance script that builds doxygen documentation.
__construct()
Prepare Maintenance class.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
execute()
Do the actual work.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
hasOption( $name)
Checks to see if a particular option was set.
getOption( $name, $default=null)
Get an option, or return the default.
addDescription( $text)
Set the description text.
$wgPhpCli
Config variable stub for the PhpCli setting, for use by phpdoc and IDEs.