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 */
43 //$pdOthers = ' -dn \'MediaWiki\' ';
44 $pdOthers .= ' --title \'MediaWiki generated documentation\' -o \'HTML:frames:DOM/earthli\' --ignore AdminSettings.php,LocalSettings.php --parseprivate on ';
46 /** MediaWiki location */
47 #$mwPath = '/var/www/mediawiki/';
48 $mwPath = "{$here}{$sep}";
50 /** MediaWiki subpaths */
51 $mwPathI = $mwPath.'includes/';
52 $mwPathM = $mwPath.'maintenance/';
53 $mwPathS = $mwPath.'skins/';
54 $mwBaseFiles = $mwPath.'*php ';
57 /** Variable to get user input */
59 /** shell command that will be run */
66 function readaline( $prompt = '') {
68 $fp = fopen( "php://stdin", "r" );
69 $resp = trim( fgets( $fp, 1024 ) );
80 if( is_array( $argv ) && isset( $argv[1] ) ) {
82 case '--all': $input = 0; break;
83 case '--includes': $input = 1; break;
84 case '--maintenance': $input = 2; break;
85 case '--skins': $input = 3; break;
88 if( isset( $argv[2] ) ) {
97 Several documentation possibilities:
98 0 : whole documentation (1 + 2 + 3)
102 4 : only a given file
105 while ( !is_numeric($input) )
107 $input = readaline( "\nEnter your choice [0]:" );
114 $command = 'phpdoc ';
117 $command .= " -f $mwBaseFiles -d $mwPathI,$mwPathM,$mwPathS ";
120 $command .= "-d $mwPathI ";
123 $command .= "-d $mwPathM ";
126 $command .= "-d $mwPathS ";
129 if( !isset( $file ) ) {
130 $file = readaline("\Enter file name $mwPath");
132 $command .= ' -f '.$mwPath.$file;
135 $command .= " -t $pdOutput ".$pdOthers;
138 ---------------------------------------------------
139 Launching the command:
141 ---------------------------------------------------
147 ---------------------------------------------------
148 Phpdoc execution finished.
149 Check above for possible errors.
154 # phpdoc -d ./mediawiki/includes/ ./mediawiki/maintenance/ -f ./mediawiki/*php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'
156 # phpdoc -f ./mediawiki/includes/GlobalFunctions.php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'