diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-01-12 13:42:29 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-01-12 13:42:29 +0100 |
commit | ba0fc4fa20067528effd4802e53ceeb959640825 (patch) | |
tree | 4f62217349d3afa39dbba3f7e19dac0aecb344f6 /maintenance/Maintenance.php | |
parent | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (diff) |
Update to MediaWiki 1.18.1
Diffstat (limited to 'maintenance/Maintenance.php')
-rw-r--r-- | maintenance/Maintenance.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 9ea57f4e..3618515a 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -32,15 +32,6 @@ if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.2 wfPHPVersionError( 'cli' ); } -// Wrapper for posix_isatty() -if ( !function_exists( 'posix_isatty' ) ) { - # We default as considering stdin a tty (for nice readline methods) - # but treating stout as not a tty to avoid color codes - function posix_isatty( $fd ) { - return !$fd; - } -} - /** * Abstract maintenance class for quickly writing and churning out * maintenance scripts with minimal effort. All that _must_ be defined @@ -1204,6 +1195,22 @@ abstract class Maintenance { } /** + * Wrapper for posix_isatty() + * We default as considering stdin a tty (for nice readline methods) + * but treating stout as not a tty to avoid color codes + * + * @param $fd int File descriptor + * @return bool + */ + public static function posix_isatty( $fd ) { + if ( !MWInit::functionExists( 'posix_isatty' ) ) { + return !$fd; + } else { + return posix_isatty( $fd ); + } +} + + /** * Prompt the console for input * @param $prompt String what to begin the line with, like '> ' * @return String response @@ -1211,7 +1218,7 @@ abstract class Maintenance { public static function readconsole( $prompt = '> ' ) { static $isatty = null; if ( is_null( $isatty ) ) { - $isatty = posix_isatty( 0 /*STDIN*/ ); + $isatty = self::posix_isatty( 0 /*STDIN*/ ); } if ( $isatty && function_exists( 'readline' ) ) { |