kill the 'hover' toggle
[mediawiki.git] / maintenance / mwdocgen.php
blobba95e9f5fd34cda10742ec78cd285b493b9e0493
1 <?php
2 /**
3 * Script to easily generate the mediawiki documentation.
5 * By default it will generate the whole documentation but you will be able to
6 * generate just some parts.
8 * Usage:
9 * php mwdocgen.php
11 * Then make a selection from the menu
13 * @todo document
14 * @package MediaWiki
15 * @subpackage Maintenance
17 * @author Ashar Voultoiz <thoane@altern.org>
18 * @version first release
22 # Variables / Configuration
25 if( php_sapi_name() != 'cli' ) {
26 die( "Run me from the command line." );
29 /** Phpdoc script with full path */
30 #$pdExec = '/usr/bin/phpdoc';
31 $pdExec = 'phpdoc';
33 /** Figure out the base directory. */
34 $sep = DIRECTORY_SEPARATOR;
35 $here = dirname( dirname( __FILE__ ) ) . $sep;
37 /** where Phpdoc should output documentation */
38 #$pdOutput = '/var/www/mwdoc/';
39 $pdOutput = "{$here}{$sep}docs{$sep}html";
41 /** Some more Phpdoc settings */
42 $pdOthers = ' -dn \'MediaWiki\' ';
43 $pdOthers .= ' --title \'MediaWiki generated documentation\' -o \'HTML:frames:DOM/earthli\' --ignore AdminSettings.php,LocalSettings.php,tests/LocalTestSettings.php --parseprivate on ';
45 /** MediaWiki location */
46 #$mwPath = '/var/www/mediawiki/';
47 $mwPath = "{$here}{$sep}";
49 /** MediaWiki subpaths */
50 $mwPathI = $mwPath.'includes/';
51 $mwPathM = $mwPath.'maintenance/';
52 $mwPathS = $mwPath.'skins/';
53 $mwBaseFiles = $mwPath.'*php ';
56 /** Variable to get user input */
57 $input = '';
58 /** shell command that will be run */
59 $command = '';
62 # Functions
65 function readaline( $prompt = '') {
66 print $prompt;
67 $fp = fopen( "php://stdin", "r" );
68 $resp = trim( fgets( $fp, 1024 ) );
69 fclose( $fp );
70 return $resp;
74 # Main !
77 unset( $file );
79 if( is_array( $argv ) && isset( $argv[1] ) ) {
80 switch( $argv[1] ) {
81 case '--all': $input = 0; break;
82 case '--includes': $input = 1; break;
83 case '--maintenance': $input = 2; break;
84 case '--skins': $input = 3; break;
85 case '--file':
86 $input = 4;
87 if( isset( $argv[2] ) ) {
88 $file = $argv[2];
90 break;
94 if( $input === '' ) {
95 print <<<END
96 Several documentation possibilities:
97 0 : whole documentation (1 + 2 + 3)
98 1 : only includes
99 2 : only maintenance
100 3 : only skins
101 4 : only a given file
102 END;
104 while ( !is_numeric($input) )
106 $input = readaline( "\nEnter your choice [0]:" );
107 if($input == '') {
108 $input = 0;
113 $command = 'phpdoc ';
114 switch ($input) {
115 case 0:
116 $command .= " -f $mwBaseFiles -d $mwPathI,$mwPathM,$mwPathS ";
117 break;
118 case 1:
119 $command .= "-d $mwPathI ";
120 break;
121 case 2:
122 $command .= "-d $mwPathM ";
123 break;
124 case 3:
125 $command .= "-d $mwPathS ";
126 break;
127 case 4:
128 if( !isset( $file ) ) {
129 $file = readaline("\Enter file name $mwPath");
131 $command .= ' -f '.$mwPath.$file;
134 $command .= " -t $pdOutput ".$pdOthers;
136 print <<<END
137 ---------------------------------------------------
138 Launching the command:
139 $command
140 ---------------------------------------------------
141 END;
143 passthru( $command);
145 print <<<END
146 ---------------------------------------------------
147 Phpdoc execution finished.
148 Check above for possible errors.
150 END;
153 # phpdoc -d ./mediawiki/includes/ ./mediawiki/maintenance/ -f ./mediawiki/*php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'
155 # phpdoc -f ./mediawiki/includes/GlobalFunctions.php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'