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. This is harder than it should be. */
34 /** Since we're on the command line, don't trust the PWD! */
36 $self = $_SERVER['SCRIPT_FILENAME'];
37 $sep = DIRECTORY_SEPARATOR
;
38 foreach( get_included_files() as $f ) {
39 if( preg_match( "!^(.*)maintenance$sep$self\$!", $f, $matches ) ) {
43 if( is_null( $here ) ) {
44 die( "Couldn't determine current directory.\n" );
47 /** where Phpdoc should output documentation */
48 #$pdOutput = '/var/www/mwdoc/';
49 $pdOutput = "{$here}{$sep}docs{$sep}html";
51 /** Some more Phpdoc settings */
53 //$pdOthers = ' -dn \'MediaWiki\' ';
54 $pdOthers .= ' --title \'MediaWiki generated documentation\' -o \'HTML:frames:DOM/earthli\' ';
56 /** MediaWiki location */
57 #$mwPath = '/var/www/mediawiki/';
58 $mwPath = "{$here}{$sep}";
60 /** MediaWiki subpaths */
61 $mwPathI = $mwPath.'includes/';
62 $mwPathM = $mwPath.'maintenance/';
63 $mwPathS = $mwPath.'skins/';
64 $mwBaseFiles = $mwPath.'*php ';
67 /** Variable to get user input */
69 /** shell command that will be run */
76 function readaline( $prompt = '') {
78 $fp = fopen( "php://stdin", "r" );
79 $resp = trim( fgets( $fp, 1024 ) );
90 if( is_array( $argv ) && isset( $argv[1] ) ) {
92 case '--all': $input = 0; break;
93 case '--includes': $input = 1; break;
94 case '--maintenance': $input = 2; break;
95 case '--skins': $input = 3; break;
98 if( isset( $argv[2] ) ) {
105 if( $input === '' ) {
107 Several documentation possibilities:
108 0 : whole documentation (1 + 2 + 3)
112 4 : only a given file
115 while ( !is_numeric($input) )
117 $input = readaline( "\nEnter your choice [0]:" );
124 $command = 'phpdoc ';
127 $command .= " -f $mwBaseFiles -d $mwPathI,$mwPathM,$mwPathS ";
130 $command .= "-d $mwPathI ";
133 $command .= "-d $mwPathM ";
136 $command .= "-d $mwPathS ";
139 if( !isset( $file ) ) {
140 $file = readaline("\Enter file name $mwPath");
142 $command .= ' -f '.$mwPath.$file;
145 $command .= " -t $pdOutput ".$pdOthers;
148 ---------------------------------------------------
149 Launching the command:
151 ---------------------------------------------------
157 ---------------------------------------------------
158 Phpdoc execution finished.
159 Check above for possible errors.
164 # phpdoc -d ./mediawiki/includes/ ./mediawiki/maintenance/ -f ./mediawiki/*php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'
166 # phpdoc -f ./mediawiki/includes/GlobalFunctions.php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'