Merge "FauxRequest: don’t override getValues()"
[lhc/web/wiklou.git] / maintenance / mwdocgen.php
index 791b360..6b22097 100644 (file)
@@ -42,6 +42,26 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class MWDocGen extends Maintenance {
+       /** @var string */
+       private $doxygen;
+       /** @var string */
+       private $mwVersion;
+       /** @var string */
+       private $output;
+       /** @var string */
+       private $input;
+       /** @var string */
+       private $inputFilter;
+       /** @var string */
+       private $template;
+       /** @var string[] */
+       private $excludes;
+       /** @var string[] */
+       private $excludePatterns;
+       /** @var bool */
+       private $doDot;
+       /** @var bool */
+       private $doMan;
 
        /**
         * Prepare Maintenance class
@@ -56,8 +76,6 @@ class MWDocGen extends Maintenance {
                $this->addOption( 'version',
                        'Pass a MediaWiki version',
                        false, true );
-               $this->addOption( 'generate-man',
-                       'Whether to generate man files' );
                $this->addOption( 'file',
                        "Only process given file or directory. Multiple values " .
                        "accepted with comma separation. Path relative to \$IP.",
@@ -65,8 +83,10 @@ class MWDocGen extends Maintenance {
                $this->addOption( 'output',
                        'Path to write doc to',
                        false, true );
-               $this->addOption( 'no-extensions',
-                       'Ignore extensions' );
+               $this->addOption( 'extensions',
+                       'Process the extensions/ directory as well (ignored if --file is used)' );
+               $this->addOption( 'skins',
+                       'Process the skins/ directory as well (ignored if --file is used)' );
        }
 
        public function getDbType() {
@@ -97,18 +117,26 @@ class MWDocGen extends Maintenance {
 
                $this->template = $IP . '/maintenance/Doxyfile';
                $this->excludes = [
-                       'vendor',
-                       'node_modules',
                        'images',
+                       'node_modules',
+                       'resources',
                        'static',
+                       'tests',
+                       'vendor',
                ];
                $this->excludePatterns = [];
-               if ( $this->hasOption( 'no-extensions' ) ) {
-                       $this->excludePatterns[] = 'extensions';
+               if ( $this->input === '' ) {
+                       // If no explicit --file filter is set, we're indexing all of $IP,
+                       // but any extension or skin submodules should be excluded by default.
+                       if ( !$this->hasOption( 'extensions' ) ) {
+                               $this->excludePatterns[] = 'extensions';
+                       }
+                       if ( !$this->hasOption( 'skins' ) ) {
+                               $this->excludePatterns[] = 'skins';
+                       }
                }
 
                $this->doDot = shell_exec( 'which dot' );
-               $this->doMan = $this->hasOption( 'generate-man' );
        }
 
        public function execute() {
@@ -133,7 +161,6 @@ class MWDocGen extends Maintenance {
                                '{{EXCLUDE}}' => $exclude,
                                '{{EXCLUDE_PATTERNS}}' => $excludePatterns,
                                '{{HAVE_DOT}}' => $this->doDot ? 'YES' : 'NO',
-                               '{{GENERATE_MAN}}' => $this->doMan ? 'YES' : 'NO',
                                '{{INPUT_FILTER}}' => $this->inputFilter,
                        ]
                );