From 6e5260d915e7482168b09d75de4b805d303d4772 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 25 May 2013 19:49:28 +0400 Subject: [PATCH] Implemented Console::getScreenSize for Windows --- framework/yii/helpers/base/Console.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/framework/yii/helpers/base/Console.php b/framework/yii/helpers/base/Console.php index d9068e4..c8b89c4 100644 --- a/framework/yii/helpers/base/Console.php +++ b/framework/yii/helpers/base/Console.php @@ -568,7 +568,7 @@ class Console */ public static function isRunningOnWindows() { - return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + return DIRECTORY_SEPARATOR == '\\'; } /** @@ -584,8 +584,11 @@ class Console } if (static::isRunningOnWindows()) { - // TODO implement for windows - return $size = false; + $output = array(); + exec('mode con', $output); + if(isset($output) && strpos($output[1], 'CON')!==false) { + return $size = array((int)preg_replace('~[^0-9]~', '', $output[3]), (int)preg_replace('~[^0-9]~', '', $output[4])); + } } else { // try stty if available