Beta4
[lhc/web/wiklou.git] / install-utils.inc
index 73f4e38..040c34d 100644 (file)
@@ -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",