Remove hard-coded paths from documentation generation script, and don't allow running...
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 4 Sep 2004 01:58:17 +0000 (01:58 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 4 Sep 2004 01:58:17 +0000 (01:58 +0000)
Added --all option to skip the prompt so this can be run as part of an automated release build process.
Place the generated files into docs/html.

docs/html/README [new file with mode: 0644]
maintenance/mwdocgen.php

diff --git a/docs/html/README b/docs/html/README
new file mode 100644 (file)
index 0000000..d25b803
--- /dev/null
@@ -0,0 +1,4 @@
+This directory is for the auto-generated phpdoc documentation.
+Run 'php mwdocgen.php' in the maintenance subdirectory to build the docs.
+
+Get phpDocumentor from http://phpdoc.org/
index 4edbeee..e4089fe 100755 (executable)
 # Variables / Configuration
 #
 
+if( php_sapi_name() != 'cli' ) {
+       die( "Run me from the command line." );
+}
+
 /** Phpdoc script with full path */
-$pdExec        = '/usr/bin/phpdoc';
+#$pdExec       = '/usr/bin/phpdoc';
+$pdExec = 'phpdoc';
+
+/** Figure out the base directory. This is harder than it should be. */
+/** Since we're on the command line, don't trust the PWD! */
+$here = null;
+$self = $_SERVER['SCRIPT_FILENAME'];
+$sep = DIRECTORY_SEPARATOR;
+foreach( get_included_files() as $f ) {
+       if( preg_match( "!^(.*)maintenance$sep$self\$!", $f, $matches ) ) {
+               $here = $matches[1];
+       }
+}
+if( is_null( $here ) ) {
+       die( "Couldn't determine current directory.\n" );
+}
+
 /** where Phpdoc should output documentation */
-$pdOutput = '/var/www/mwdoc/';
+#$pdOutput = '/var/www/mwdoc/';
+$pdOutput = "{$here}{$sep}docs{$sep}html";
 
 /** Some more Phpdoc settings */
+$pdOthers = '';
 //$pdOthers = ' -dn \'MediaWiki\' ';
 $pdOthers .= ' --title \'MediaWiki generated documentation\' -o \'HTML:frames:DOM/earthli\' ';
 
-/** MediaWiki location */
-$mwPath = '/var/www/mediawiki/';
+/** Mediawiki location */
+#$mwPath = '/var/www/mediawiki/';
+$mwPath = "{$here}{$sep}";
 
 /** MediaWiki subpaths */
 $mwPathI = $mwPath.'includes/';
@@ -62,7 +85,11 @@ function readaline( $prompt = '') {
 # Main !
 #
 
-print <<<END
+if( is_array( $argv ) && isset( $argv[1] ) && $argv[1] == '--all' ) {
+       # Quick option
+       $input = 0;
+} else {
+       print <<<END
 Several documentation possibilities:
  0 : whole documentation (1 + 2 + 3)
  1 : only includes
@@ -70,12 +97,13 @@ Several documentation possibilities:
  3 : only skins
  4 : only a given file
 END;
-
-while ( !is_numeric($input) )
-{
-       $input = readaline( "\nEnter your choice [0]:" );
-       if($input == '') {
-               $input = 0;
+       
+       while ( !is_numeric($input) )
+       {
+               $input = readaline( "\nEnter your choice [0]:" );
+               if($input == '') {
+                       $input = 0;
+               }
        }
 }