Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
03f9ac86
Commit
03f9ac86
authored
May 06, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3367 from MethyleneGaming/master
HHVM compatibility Fixes for Yii 2 Console Application
parents
6d2a371f
6099e851
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
Controller.php
framework/console/Controller.php
+3
-3
ErrorHandler.php
framework/console/ErrorHandler.php
+1
-1
BaseConsole.php
framework/helpers/BaseConsole.php
+3
-3
No files found.
framework/console/Controller.php
View file @
03f9ac86
...
@@ -49,7 +49,7 @@ class Controller extends \yii\base\Controller
...
@@ -49,7 +49,7 @@ class Controller extends \yii\base\Controller
* @param resource $stream the stream to check.
* @param resource $stream the stream to check.
* @return boolean Whether to enable ANSI style in output.
* @return boolean Whether to enable ANSI style in output.
*/
*/
public
function
isColorEnabled
(
$stream
=
STDOUT
)
public
function
isColorEnabled
(
$stream
=
\
STDOUT
)
{
{
return
$this
->
color
===
null
?
Console
::
streamSupportsAnsiColors
(
$stream
)
:
$this
->
color
;
return
$this
->
color
===
null
?
Console
::
streamSupportsAnsiColors
(
$stream
)
:
$this
->
color
;
}
}
...
@@ -192,13 +192,13 @@ class Controller extends \yii\base\Controller
...
@@ -192,13 +192,13 @@ class Controller extends \yii\base\Controller
*/
*/
public
function
stderr
(
$string
)
public
function
stderr
(
$string
)
{
{
if
(
$this
->
isColorEnabled
(
STDERR
))
{
if
(
$this
->
isColorEnabled
(
\
STDERR
))
{
$args
=
func_get_args
();
$args
=
func_get_args
();
array_shift
(
$args
);
array_shift
(
$args
);
$string
=
Console
::
ansiFormat
(
$string
,
$args
);
$string
=
Console
::
ansiFormat
(
$string
,
$args
);
}
}
return
fwrite
(
STDERR
,
$string
);
return
fwrite
(
\
STDERR
,
$string
);
}
}
/**
/**
...
...
framework/console/ErrorHandler.php
View file @
03f9ac86
...
@@ -64,7 +64,7 @@ class ErrorHandler extends \yii\base\ErrorHandler
...
@@ -64,7 +64,7 @@ class ErrorHandler extends \yii\base\ErrorHandler
*/
*/
protected
function
formatMessage
(
$message
,
$format
=
[
Console
::
FG_RED
,
Console
::
BOLD
])
protected
function
formatMessage
(
$message
,
$format
=
[
Console
::
FG_RED
,
Console
::
BOLD
])
{
{
$stream
=
(
PHP_SAPI
===
'cli'
)
?
STDERR
:
STDOUT
;
$stream
=
(
PHP_SAPI
===
'cli'
)
?
\STDERR
:
\
STDOUT
;
// try controller first to allow check for --color switch
// try controller first to allow check for --color switch
if
(
Yii
::
$app
->
controller
instanceof
\yii\console\Controller
&&
Yii
::
$app
->
controller
->
isColorEnabled
(
$stream
)
if
(
Yii
::
$app
->
controller
instanceof
\yii\console\Controller
&&
Yii
::
$app
->
controller
->
isColorEnabled
(
$stream
)
||
Yii
::
$app
instanceof
\yii\console\Application
&&
Console
::
streamSupportsAnsiColors
(
$stream
))
{
||
Yii
::
$app
instanceof
\yii\console\Application
&&
Console
::
streamSupportsAnsiColors
(
$stream
))
{
...
...
framework/helpers/BaseConsole.php
View file @
03f9ac86
...
@@ -628,7 +628,7 @@ class BaseConsole
...
@@ -628,7 +628,7 @@ class BaseConsole
*/
*/
public
static
function
stdin
(
$raw
=
false
)
public
static
function
stdin
(
$raw
=
false
)
{
{
return
$raw
?
fgets
(
STDIN
)
:
rtrim
(
fgets
(
STDIN
),
PHP_EOL
);
return
$raw
?
fgets
(
\STDIN
)
:
rtrim
(
fgets
(
\
STDIN
),
PHP_EOL
);
}
}
/**
/**
...
@@ -639,7 +639,7 @@ class BaseConsole
...
@@ -639,7 +639,7 @@ class BaseConsole
*/
*/
public
static
function
stdout
(
$string
)
public
static
function
stdout
(
$string
)
{
{
return
fwrite
(
STDOUT
,
$string
);
return
fwrite
(
\
STDOUT
,
$string
);
}
}
/**
/**
...
@@ -650,7 +650,7 @@ class BaseConsole
...
@@ -650,7 +650,7 @@ class BaseConsole
*/
*/
public
static
function
stderr
(
$string
)
public
static
function
stderr
(
$string
)
{
{
return
fwrite
(
STDERR
,
$string
);
return
fwrite
(
\
STDERR
,
$string
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment