simple script to generate phpdocumentor documentation and troubleshoot its generation
[mediawiki.git] / maintenance / mwdocgen.php
blob8d0c8e3846d83c95ff88d84f70ce955adab94b1d
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 /** Phpdoc script with full path */
26 $pdExec = '/usr/bin/phpdoc';
27 /** where Phpdoc should output documentation */
28 $pdOutput = '/var/www/mwdoc/';
30 /** Some more Phpdoc settings */
31 //$pdOthers = ' -dn \'MediaWiki\' ';
32 $pdOthers .= ' --title \'Mediawiki generated documentation\' -o \'HTML:frames:DOM/earthli\' ';
34 /** Mediawiki location */
35 $mwPath = '/var/www/mediawiki/';
37 /** Mediawiki subpaths */
38 $mwPathI = $mwPath.'includes/';
39 $mwPathM = $mwPath.'maintenance/';
40 $mwPathS = $mwPath.'skins/';
41 $mwBaseFiles = $mwPath.'*php ';
44 /** Variable to get user input */
45 $input = '';
46 /** shell command that will be run */
47 $command = '';
50 # Functions
53 function readaline( $prompt = '') {
54 print $prompt;
55 $fp = fopen( "php://stdin", "r" );
56 $resp = trim( fgets( $fp, 1024 ) );
57 fclose( $fp );
58 return $resp;
62 # Main !
65 print <<<END
66 Several documentation possibilities:
67 0 : whole documentation (1 + 2 + 3)
68 1 : only includes
69 2 : only maintenance
70 3 : only skins
71 4 : only a given file
72 END;
74 while ( !is_numeric($input) )
76 $input = readaline( "\nEnter your choice [0]:" );
77 if($input == '') {
78 $input = 0;
82 $command = 'phpdoc ';
83 switch ($input) {
84 case 0:
85 $command .= " -f $mwBaseFiles -d $mwPathI,$mwPathM,$mwPathS ";
86 break;
87 case 1:
88 $command .= "-d $mwPathI ";
89 break;
90 case 2:
91 $command .= "-d $mwPathM ";
92 break;
93 case 3:
94 $command .= "-d $mwPathS ";
95 break;
96 case 4:
97 $file = readaline("\Enter file name $mwPath");
98 $command .= ' -f '.$mwPath.$file;
101 $command .= " -t $pdOutput ".$pdOthers;
103 print <<<END
104 ---------------------------------------------------
105 Launching the command:
106 $command
107 ---------------------------------------------------
108 END;
110 passthru( $command);
112 print <<<END
113 ---------------------------------------------------
114 Phpdoc execution finished.
115 Check above for possible errors.
117 END;
120 # phpdoc -d ./mediawiki/includes/ ./mediawiki/maintenance/ -f ./mediawiki/*php -t ./mwdoc/ -dn 'MediaWiki' --title 'Mediawiki generated documentation' -o 'HTML:frames:DOM/earthli'
122 # phpdoc -f ./mediawiki/includes/GlobalFunctions.php -t ./mwdoc/ -dn 'MediaWiki' --title 'Mediawiki generated documentation' -o 'HTML:frames:DOM/earthli'