From 0c3553b7d4dd12d80d11a10afa7ebaeb1b1da86f Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 13 Jun 2004 04:18:09 +0000 Subject: [PATCH] better readconsole() function, moved from mcc.php and eval.php --- install-utils.inc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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", -- 2.20.1