Merge "Add 3D filetype for STL files"
[lhc/web/wiklou.git] / maintenance / mwdocgen.php
index 00a15e5..d005629 100644 (file)
@@ -46,7 +46,7 @@ class MWDocGen extends Maintenance {
         */
        public function __construct() {
                parent::__construct();
-               $this->mDescription = 'Build doxygen documentation';
+               $this->addDescription( 'Build doxygen documentation' );
 
                $this->addOption( 'doxygen',
                        'Path to doxygen',
@@ -72,7 +72,7 @@ class MWDocGen extends Maintenance {
        }
 
        protected function init() {
-               global $IP;
+               global $wgPhpCli, $IP;
 
                $this->doxygen = $this->getOption( 'doxygen', 'doxygen' );
                $this->mwVersion = $this->getOption( 'version', 'master' );
@@ -86,15 +86,21 @@ class MWDocGen extends Maintenance {
 
                $this->output = $this->getOption( 'output', "$IP/docs" );
 
-               $this->inputFilter = wfShellWikiCmd( $IP . '/maintenance/mwdoc-filter.php' );
+               // Do not use wfShellWikiCmd, because mwdoc-filter.php is not
+               // a Maintenance script.
+               $this->inputFilter = wfEscapeShellArg( [
+                       $wgPhpCli,
+                       $IP . '/maintenance/mwdoc-filter.php'
+               ] );
+
                $this->template = $IP . '/maintenance/Doxyfile';
-               $this->excludes = array(
+               $this->excludes = [
                        'vendor',
                        'node_modules',
                        'images',
                        'static',
-               );
-               $this->excludePatterns = array();
+               ];
+               $this->excludePatterns = [];
                if ( $this->hasOption( 'no-extensions' ) ) {
                        $this->excludePatterns[] = 'extensions';
                }
@@ -117,7 +123,7 @@ class MWDocGen extends Maintenance {
                $excludePatterns = implode( ' ', $this->excludePatterns );
 
                $conf = strtr( file_get_contents( $this->template ),
-                       array(
+                       [
                                '{{OUTPUT_DIRECTORY}}' => $this->output,
                                '{{STRIP_FROM_PATH}}' => $IP,
                                '{{CURRENT_VERSION}}' => $this->mwVersion,
@@ -127,7 +133,7 @@ class MWDocGen extends Maintenance {
                                '{{HAVE_DOT}}' => $this->doDot ? 'YES' : 'NO',
                                '{{GENERATE_MAN}}' => $this->doMan ? 'YES' : 'NO',
                                '{{INPUT_FILTER}}' => $this->inputFilter,
-                       )
+                       ]
                );
 
                $tmpFile = tempnam( wfTempDir(), 'MWDocGen-' );