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.
11 * Then make a selection from the menu
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';
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 */
58 /** shell command that will be run */
65 function readaline( $prompt = '') {
67 $fp = fopen( "php://stdin", "r" );
68 $resp = trim( fgets( $fp, 1024 ) );
79 if( is_array( $argv ) && isset( $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;
87 if( isset( $argv[2] ) ) {
96 Several documentation possibilities:
97 0 : whole documentation (1 + 2 + 3)
101 4 : only a given file
104 while ( !is_numeric($input) )
106 $input = readaline( "\nEnter your choice [0]:" );
113 $command = 'phpdoc ';
116 $command .= " -f $mwBaseFiles -d $mwPathI,$mwPathM,$mwPathS ";
119 $command .= "-d $mwPathI ";
122 $command .= "-d $mwPathM ";
125 $command .= "-d $mwPathS ";
128 if( !isset( $file ) ) {
129 $file = readaline("\Enter file name $mwPath");
131 $command .= ' -f '.$mwPath.$file;
134 $command .= " -t $pdOutput ".$pdOthers;
137 ---------------------------------------------------
138 Launching the command:
140 ---------------------------------------------------
146 ---------------------------------------------------
147 Phpdoc execution finished.
148 Check above for possible errors.
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'