aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/mwdocgen.php
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2024-03-25 16:35:49 -0700
committerKrinkle <krinkle@fastmail.com>2024-03-26 23:30:10 +0000
commitd864855d5d5519dc064c895bcc7455699020d5bc (patch)
treeeb3ac18a51b3fb0c239d50aa22408db1e0290f2d /maintenance/mwdocgen.php
parentdd992c1a7d1c9666a16791070045b4e0dd8345b9 (diff)
downloadmediawikicore-d864855d5d5519dc064c895bcc7455699020d5bc.tar.gz
mediawikicore-d864855d5d5519dc064c895bcc7455699020d5bc.zip
docs: Remove use of $IP from mwdocgen.php
* Prefer the MW_INSTALL_PATH constant where possible. * For input and output, there is no need to specify full paths, only to strip the prefix again afterwards. See also Doxyfile in any repo that is not mediawiki/core where we already set the path relative to the project directory, e.g. "src/" as input and "docs" as output. <https://codesearch.wmcloud.org/search/?q=INPUT%7COUTPUT&files=Doxyfile> Test Plan: * `php maintenance/mwdocgen.php --file docs,includes/libs/objectcache/` Change-Id: I4119161accdc665d0e4d0d4e49d0c42c68f8e2a2
Diffstat (limited to 'maintenance/mwdocgen.php')
-rw-r--r--maintenance/mwdocgen.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php
index cda3d8690715..55ab2b9e9642 100644
--- a/maintenance/mwdocgen.php
+++ b/maintenance/mwdocgen.php
@@ -74,7 +74,7 @@ class MWDocGen extends Maintenance {
false, true );
$this->addOption( 'file',
"Only process given file or directory. Multiple values " .
- "accepted with comma separation. Path relative to \$IP.",
+ "accepted with comma separation. Path relative to MW_INSTALL_PATH.",
false, true );
$this->addOption( 'output',
'Path to write doc to',
@@ -90,7 +90,7 @@ class MWDocGen extends Maintenance {
}
protected function init() {
- global $wgPhpCli, $IP;
+ global $wgPhpCli;
$this->doxygen = $this->getOption( 'doxygen', 'doxygen' );
$this->mwVersion = $this->getOption( 'version', 'master' );
@@ -99,26 +99,26 @@ class MWDocGen extends Maintenance {
$inputs = explode( ',', $this->getOption( 'file', '' ) );
foreach ( $inputs as $input ) {
# Doxygen inputs are space separated and double quoted
- $this->input .= " \"$IP/$input\"";
+ $this->input .= " \"$input\"";
}
- $this->output = $this->getOption( 'output', "$IP/docs" );
+ $this->output = $this->getOption( 'output', 'docs' );
// Do not use wfShellWikiCmd, because mwdoc-filter.php is not
// a Maintenance script.
$this->inputFilter = Shell::escape( [
$wgPhpCli,
- $IP . '/maintenance/mwdoc-filter.php'
+ MW_INSTALL_PATH . '/maintenance/mwdoc-filter.php'
] );
- $this->template = $IP . '/maintenance/Doxyfile';
+ $this->template = MW_INSTALL_PATH . '/maintenance/Doxyfile';
$this->excludes = [
'cache',
'images',
];
if ( $this->input === '' ) {
// If no explicit --file filter is set, we're indexing all of MediaWiki core
- // in $IP, but not extension and skin submodules (T317451).
+ // in MW_INSTALL_PATH, but not extension and skin submodules (T317451).
if ( !$this->hasOption( 'extensions' ) ) {
$this->excludes[] = 'extensions';
}
@@ -131,20 +131,17 @@ class MWDocGen extends Maintenance {
}
public function execute() {
- global $IP;
-
$this->init();
# Build out directories we want to exclude
$exclude = '';
foreach ( $this->excludes as $item ) {
- $exclude .= " $IP/$item";
+ $exclude .= " $item";
}
$conf = strtr( file_get_contents( $this->template ),
[
'{{OUTPUT_DIRECTORY}}' => $this->output,
- '{{STRIP_FROM_PATH}}' => $IP,
'{{CURRENT_VERSION}}' => $this->mwVersion,
'{{INPUT}}' => $this->input,
'{{EXCLUDE}}' => $exclude,