r64938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64937‎ | r64938 | r64939 >
Date:15:44, 11 April 2010
Author:platonides
Status:ok
Tags:
Comment:
Define our own posix_isatty if posix extension is not installed.
Removes the extension dependency on non-windows for parserTests.
Currently used on install-utils.inc readconsole(), eval.php and parserTests.inc

Maintenance scripts receive it via commandLine.inc -> Maintenance.php .. doMaintenance.php -> install-utils.inc
Modified paths:
  • /trunk/phase3/maintenance/eval.php (modified) (history)
  • /trunk/phase3/maintenance/install-utils.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/install-utils.inc
@@ -95,10 +95,18 @@
9696 }
9797 }
9898
 99+if ( !function_exists( 'posix_isatty' ) ) {
 100+ # We default as considering stdin a tty (for nice readline methods)
 101+ # but treating stout as not a tty to avoid color codes
 102+ function posix_isatty( $fd ) {
 103+ return !$fd;
 104+ }
 105+}
 106+
99107 function readconsole( $prompt = '' ) {
100108 static $isatty = null;
101109 if ( is_null( $isatty ) ) {
102 - if ( !function_exists( 'posix_isatty' ) || posix_isatty( 0 /*STDIN*/ ) ) {
 110+ if ( posix_isatty( 0 /*STDIN*/ ) ) {
103111 $isatty = true;
104112 } else {
105113 $isatty = false;
Index: trunk/phase3/maintenance/eval.php
@@ -40,7 +40,7 @@
4141 }
4242
4343 if ( function_exists( 'readline_add_history' )
44 - && function_exists( 'posix_isatty' ) && posix_isatty( 0 /*STDIN*/ ) )
 44+ && posix_isatty( 0 /*STDIN*/ ) )
4545 {
4646 $useReadline = true;
4747 } else {

Status & tagging log