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 echo "Run me from the command line.";
30 /** Phpdoc script with full path */
31 #$pdExec = '/usr/bin/phpdoc';
34 /** Figure out the base directory. */
35 $here = dirname( dirname( __FILE__
) ) . DIRECTORY_SEPARATOR
;
37 /** where Phpdoc should output documentation */
38 #$pdOutput = '/var/www/mwdoc/';
39 $pdOutput = "{$here}docs" . DIRECTORY_SEPARATOR
. 'html';
41 /** Some more Phpdoc settings */
42 # This will be used as the default for all files that don't have a package,
43 # it's useful to set it to something like 'untagged' to hunt down and fix files
44 # that don't have a package name declared.
45 $pdOthers = " -dn MediaWiki";
46 $pdOthers .= ' --title "MediaWiki generated documentation"';
47 $pdOthers .= ' --output "HTML:Smarty:HandS"'; #,HTML:Smarty:HandS"'; ###### HTML:frames:DOM/earthli
48 $pdOthers .= ' --ignore AdminSettings.php,LocalSettings.php,tests/LocalTestSettings.php';
49 $pdOthers .= ' --parseprivate on';
50 $pdOthers .= ' --sourcecode on';
52 /** MediaWiki location */
53 #$mwPath = '/var/www/mediawiki/';
56 /** MediaWiki subpaths */
57 $mwPathI = $mwPath.'includes/';
58 $mwPathL = $mwPath.'languages/';
59 $mwPathM = $mwPath.'maintenance/';
60 $mwPathS = $mwPath.'skins/';
61 $mwBaseFiles = $mwPath.'*php ';
64 /** Variable to get user input */
66 /** shell command that will be run */
73 function readaline( $prompt = '') {
75 $fp = fopen( "php://stdin", "r" );
76 $resp = trim( fgets( $fp, 1024 ) );
87 if( is_array( $argv ) && isset( $argv[1] ) ) {
89 case '--all': $input = 0; break;
90 case '--includes': $input = 1; break;
91 case '--languages': $input = 2; break;
92 case '--maintenance': $input = 3; break;
93 case '--skins': $input = 4; break;
96 if( isset( $argv[2] ) ) {
103 if( $input === '' ) {
104 ?
>Several documentation possibilities
:
105 0 : whole
documentation (1 +
2 +
3)
110 5 : only a given file
<?php
111 while ( !is_numeric($input) )
113 $input = readaline( "\nEnter your choice [0]:" );
120 $command = 'phpdoc ';
123 $command .= " -f $mwBaseFiles -d $mwPathI,$mwPathL,$mwPathM,$mwPathS";
126 $command .= "-d $mwPathI";
129 $command .= "-d $mwPathL";
132 $command .= "-d $mwPathM";
135 $command .= "-d $mwPathS";
138 if( !isset( $file ) ) {
139 $file = readaline("Enter file name $mwPath");
141 $command .= ' -f '.$mwPath.$file;
144 $command .= " -t $pdOutput ".$pdOthers;
147 ---------------------------------------------------
148 Launching the command
:
150 <?php
echo $command ?
>
152 ---------------------------------------------------
158 ---------------------------------------------------
159 Phpdoc execution finished
.
160 Check above
for possible errors
.
163 # phpdoc -d ./mediawiki/includes/ ./mediawiki/maintenance/ -f ./mediawiki/*php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'
165 # phpdoc -f ./mediawiki/includes/GlobalFunctions.php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'