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)' );
92 return Maintenance::DB_NONE;
95 protected function init() {
98 $this->doxygen = $this->
getOption(
'doxygen',
'doxygen' );
99 $this->mwVersion = $this->
getOption(
'version',
'master' );
105 $this->inputFilter = Shell::escape( [
107 MW_INSTALL_PATH .
'/maintenance/mwdoc-filter.php'
110 $this->
template = MW_INSTALL_PATH .
'/maintenance/Doxyfile';
117 if ( $file !==
null ) {
119 foreach ( explode(
',', $file ) as $input ) {
121 $this->input .=
" \"$input\"";
127 if ( !$this->
hasOption(
'extensions' ) ) {
128 $this->excludes[] =
'extensions';
131 $this->excludes[] =
'skins';
135 $this->doDot = (bool)shell_exec(
'which dot' );
141 # Build out directories we want to exclude
143 foreach ( $this->excludes as $item ) {
144 $exclude .=
" $item";
147 $conf = strtr( file_get_contents( $this->
template ),
149 '{{OUTPUT_DIRECTORY}}' => $this->
output,
150 '{{CURRENT_VERSION}}' => $this->mwVersion,
151 '{{INPUT}}' => $this->input,
152 '{{EXCLUDE}}' => $exclude,
153 '{{HAVE_DOT}}' => $this->doDot ?
'YES' :
'NO',
154 '{{INPUT_FILTER}}' => $this->inputFilter,
158 $tmpFile = tempnam(
wfTempDir(),
'MWDocGen-' );
159 if ( file_put_contents( $tmpFile, $conf ) ===
false ) {
160 $this->
fatalError(
"Could not write doxygen configuration to file $tmpFile\n" );
163 $command = $this->doxygen .
' ' . $tmpFile;
164 $this->
output(
"Executing command:\n$command\n" );
167 system( $command, $exitcode );
170---------------------------------------------------
171Doxygen execution finished.
172Check above
for possible errors.
174You might want to
delete the temporary file:
176---------------------------------------------------
181 if ( $exitcode !== 0 ) {
182 $this->
fatalError(
"Something went wrong (exit: $exitcode)\n", $exitcode );
189require_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.