40require_once __DIR__ .
'/Maintenance.php';
69 parent::__construct();
76 'Pass a MediaWiki version',
79 "Only process given file or directory. Multiple values " .
80 "accepted with comma separation. Path relative to MW_INSTALL_PATH.",
83 'Path to write doc to',
86 'Process the extensions/ directory as well (ignored if --file is used)' );
88 'Process the skins/ directory as well (ignored if --file is used)' );
93 return Maintenance::DB_NONE;
96 protected function init() {
99 $this->doxygen = $this->
getOption(
'doxygen',
'doxygen' );
100 $this->mwVersion = $this->
getOption(
'version',
'master' );
106 $this->inputFilter = Shell::escape( [
108 MW_INSTALL_PATH .
'/maintenance/mwdoc-filter.php'
111 $this->
template = MW_INSTALL_PATH .
'/maintenance/Doxyfile';
118 if ( $file !==
null ) {
120 foreach ( explode(
',', $file ) as $input ) {
122 $this->input .=
" \"$input\"";
128 if ( !$this->
hasOption(
'extensions' ) ) {
129 $this->excludes[] =
'extensions';
132 $this->excludes[] =
'skins';
136 $this->doDot = (bool)shell_exec(
'which dot' );
142 # Build out directories we want to exclude
144 foreach ( $this->excludes as $item ) {
145 $exclude .=
" $item";
148 $conf = strtr( file_get_contents( $this->
template ),
150 '{{OUTPUT_DIRECTORY}}' => $this->
output,
151 '{{CURRENT_VERSION}}' => $this->mwVersion,
152 '{{INPUT}}' => $this->input,
153 '{{EXCLUDE}}' => $exclude,
154 '{{HAVE_DOT}}' => $this->doDot ?
'YES' :
'NO',
155 '{{INPUT_FILTER}}' => $this->inputFilter,
159 $tmpFile = tempnam(
wfTempDir(),
'MWDocGen-' );
160 if ( file_put_contents( $tmpFile, $conf ) ===
false ) {
161 $this->
fatalError(
"Could not write doxygen configuration to file $tmpFile\n" );
164 $command = $this->doxygen .
' ' . $tmpFile;
165 $this->
output(
"Executing command:\n$command\n" );
168 system( $command, $exitcode );
171---------------------------------------------------
172Doxygen execution finished.
173Check above
for possible errors.
175You might want to
delete the temporary file:
177---------------------------------------------------
182 if ( $exitcode !== 0 ) {
183 $this->
fatalError(
"Something went wrong (exit: $exitcode)\n", $exitcode );
190require_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.