38 require_once __DIR__ .
'/Maintenance.php';
68 parent::__construct();
75 'Pass a MediaWiki version',
78 "Only process given file or directory. Multiple values " .
79 "accepted with comma separation. Path relative to \$IP.",
82 'Path to write doc to',
85 'Process the extensions/ directory as well (ignored if --file is used)' );
87 'Process the skins/ directory as well (ignored if --file is used)' );
94 protected function init() {
97 $this->doxygen = $this->
getOption(
'doxygen',
'doxygen' );
98 $this->mwVersion = $this->
getOption(
'version',
'master' );
101 $inputs = explode(
',', $this->
getOption(
'file',
'' ) );
102 foreach ( $inputs as
$input ) {
103 # Doxygen inputs are space separated and double quoted
104 $this->input .=
" \"$IP/$input\"";
111 $this->inputFilter = Shell::escape( [
113 $IP .
'/maintenance/mwdoc-filter.php'
116 $this->
template = $IP .
'/maintenance/Doxyfile';
125 $this->excludePatterns = [];
126 if ( $this->input ===
'' ) {
129 if ( !$this->
hasOption(
'extensions' ) ) {
130 $this->excludePatterns[] =
'extensions';
133 $this->excludePatterns[] =
'skins';
137 $this->doDot = (bool)shell_exec(
'which dot' );
145 # Build out directories we want to exclude
147 foreach ( $this->excludes as $item ) {
148 $exclude .=
" $IP/$item";
153 $conf = strtr( file_get_contents( $this->
template ),
155 '{{OUTPUT_DIRECTORY}}' => $this->
output,
156 '{{STRIP_FROM_PATH}}' => $IP,
157 '{{CURRENT_VERSION}}' => $this->mwVersion,
158 '{{INPUT}}' => $this->input,
159 '{{EXCLUDE}}' => $exclude,
161 '{{HAVE_DOT}}' => $this->doDot ?
'YES' :
'NO',
162 '{{INPUT_FILTER}}' => $this->inputFilter,
166 $tmpFile = tempnam(
wfTempDir(),
'MWDocGen-' );
167 if ( file_put_contents( $tmpFile, $conf ) ===
false ) {
168 $this->
fatalError(
"Could not write doxygen configuration to file $tmpFile\n" );
171 $command = $this->doxygen .
' ' . $tmpFile;
172 $this->
output(
"Executing command:\n$command\n" );
178 ---------------------------------------------------
179 Doxygen execution finished.
180 Check above
for possible errors.
182 You might want to
delete the temporary file:
184 ---------------------------------------------------
189 if ( $exitcode !== 0 ) {
190 $this->
fatalError(
"Something went wrong (exit: $exitcode)\n", $exitcode );
196 require_once RUN_MAINTENANCE_IF_MAIN;
wfTempDir()
Tries to get the system directory for temporary files.
if(!defined( 'MEDIAWIKI')) if(ini_get( 'mbstring.func_overload')) if(!defined( 'MW_ENTRY_POINT')) global $IP
Environment checks.
Maintenance script that builds doxygen documentation.
string[] $excludePatterns
__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...
const DB_NONE
Constants for DB access type.
output( $out, $channel=null)
Throw some output to the user.
hasOption( $name)
Checks to see if a particular option was set.
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
getOption( $name, $default=null)
Get an option, or return the default.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
$wgPhpCli
Config variable stub for the PhpCli setting, for use by phpdoc and IDEs.