simple script to generate phpdocumentor documentation and troubleshoot its generation
[lhc/web/wiklou.git] / maintenance / mwdocgen.php
1 <?php
2 /**
3 * Script to easily generate the mediawiki documentation.
4 *
5 * By default it will generate the whole documentation but you will be able to
6 * generate just some parts.
7 *
8 * Usage:
9 * php mwdocgen.php
10 *
11 * Then make a selection from the menu
12 *
13 * @todo document
14 * @package MediaWiki
15 * @subpackage Maintenance
16 *
17 * @author Ashar Voultoiz <thoane@altern.org>
18 * @version first release
19 */
20
21 #
22 # Variables / Configuration
23 #
24
25 /** Phpdoc script with full path */
26 $pdExec = '/usr/bin/phpdoc';
27 /** where Phpdoc should output documentation */
28 $pdOutput = '/var/www/mwdoc/';
29
30 /** Some more Phpdoc settings */
31 //$pdOthers = ' -dn \'MediaWiki\' ';
32 $pdOthers .= ' --title \'Mediawiki generated documentation\' -o \'HTML:frames:DOM/earthli\' ';
33
34 /** Mediawiki location */
35 $mwPath = '/var/www/mediawiki/';
36
37 /** Mediawiki subpaths */
38 $mwPathI = $mwPath.'includes/';
39 $mwPathM = $mwPath.'maintenance/';
40 $mwPathS = $mwPath.'skins/';
41 $mwBaseFiles = $mwPath.'*php ';
42
43
44 /** Variable to get user input */
45 $input = '';
46 /** shell command that will be run */
47 $command = '';
48
49 #
50 # Functions
51 #
52
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;
59 }
60
61 #
62 # Main !
63 #
64
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;
73
74 while ( !is_numeric($input) )
75 {
76 $input = readaline( "\nEnter your choice [0]:" );
77 if($input == '') {
78 $input = 0;
79 }
80 }
81
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;
99 }
100
101 $command .= " -t $pdOutput ".$pdOthers;
102
103 print <<<END
104 ---------------------------------------------------
105 Launching the command:
106 $command
107 ---------------------------------------------------
108 END;
109
110 passthru( $command);
111
112 print <<<END
113 ---------------------------------------------------
114 Phpdoc execution finished.
115 Check above for possible errors.
116
117 END;
118
119
120 # phpdoc -d ./mediawiki/includes/ ./mediawiki/maintenance/ -f ./mediawiki/*php -t ./mwdoc/ -dn 'MediaWiki' --title 'Mediawiki generated documentation' -o 'HTML:frames:DOM/earthli'
121
122 # phpdoc -f ./mediawiki/includes/GlobalFunctions.php -t ./mwdoc/ -dn 'MediaWiki' --title 'Mediawiki generated documentation' -o 'HTML:frames:DOM/earthli'
123
124 ?>