94 protected function init() {
97 $this->doxygen = $this->getOption(
'doxygen',
'doxygen' );
98 $this->mwVersion = $this->getOption(
'version',
'master' );
100 $this->output = $this->getOption(
'output',
'docs' );
104 $this->inputFilter = Shell::escape( [
106 MW_INSTALL_PATH .
'/maintenance/mwdoc-filter.php'
109 $this->
template = MW_INSTALL_PATH .
'/maintenance/Doxyfile';
115 $file = $this->getOption(
'file' );
116 if ( $file !==
null ) {
118 foreach ( explode(
',', $file ) as $input ) {
120 $this->input .=
" \"$input\"";
126 if ( !$this->hasOption(
'extensions' ) ) {
127 $this->excludes[] =
'extensions';
129 if ( !$this->hasOption(
'skins' ) ) {
130 $this->excludes[] =
'skins';
134 $this->doDot = (bool)shell_exec(
'which dot' );
140 # Build out directories we want to exclude
142 foreach ( $this->excludes as $item ) {
143 $exclude .=
" $item";
146 $conf = strtr( file_get_contents( $this->
template ),
148 '{{OUTPUT_DIRECTORY}}' => $this->output,
149 '{{CURRENT_VERSION}}' => $this->mwVersion,
150 '{{INPUT}}' => $this->input,
151 '{{EXCLUDE}}' => $exclude,
152 '{{HAVE_DOT}}' => $this->doDot ?
'YES' :
'NO',
153 '{{INPUT_FILTER}}' => $this->inputFilter,
157 $tmpFile = tempnam(
wfTempDir(),
'MWDocGen-' );
158 if ( file_put_contents( $tmpFile, $conf ) ===
false ) {
159 $this->fatalError(
"Could not write doxygen configuration to file $tmpFile\n" );
162 $command = $this->doxygen .
' ' . $tmpFile;
163 $this->output(
"Executing command:\n$command\n" );
166 system( $command, $exitcode );
168 $this->output( <<<TEXT
169---------------------------------------------------
170Doxygen execution finished.
171Check above
for possible errors.
173You might want to
delete the temporary file:
175---------------------------------------------------
180 if ( $exitcode !== 0 ) {
181 $this->fatalError(
"Something went wrong (exit: $exitcode)\n", $exitcode );