From: Tim Starling Date: Sun, 13 Jun 2004 04:18:09 +0000 (+0000) Subject: better readconsole() function, moved from mcc.php and eval.php X-Git-Tag: 1.5.0alpha1~2868 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=0c3553b7d4dd12d80d11a10afa7ebaeb1b1da86f;p=lhc%2Fweb%2Fwiklou.git better readconsole() function, moved from mcc.php and eval.php --- diff --git a/install-utils.inc b/install-utils.inc index 73f4e38171..040c34dc81 100644 --- a/install-utils.inc +++ b/install-utils.inc @@ -55,14 +55,18 @@ function copydirectory( $source, $dest ) { } } -function readconsole() { - $fp = fopen( "php://stdin", "r" ); - $resp = trim( fgets( $fp, 1024 ) ); - fclose( $fp ); - return $resp; +function readconsole( $prompt = "" ) { + if ( function_exists( "readline" ) ) { + return readline( $prompt ); + } else { + print $prompt; + $fp = fopen( "php://stdin", "r" ); + $resp = trim( fgets( $fp, 1024 ) ); + fclose( $fp ); + return $resp; + } } - function replacevars( $ins ) { $varnames = array( "wgDBserver", "wgDBname", "wgDBintlname", "wgDBuser",