|
|
@@ -434,7 +434,7 @@ class Worker
|
|
|
*
|
|
|
* @var string
|
|
|
*/
|
|
|
- protected static $_OS = OS_TYPE_LINUX;
|
|
|
+ protected static $_OS = \OS_TYPE_LINUX;
|
|
|
|
|
|
/**
|
|
|
* Processes for windows.
|
|
|
@@ -553,7 +553,7 @@ class Worker
|
|
|
exit("Only run in command line mode \n");
|
|
|
}
|
|
|
if (\DIRECTORY_SEPARATOR === '\\') {
|
|
|
- self::$_OS = OS_TYPE_WINDOWS;
|
|
|
+ self::$_OS = \OS_TYPE_WINDOWS;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -639,7 +639,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function initWorkers()
|
|
|
{
|
|
|
- if (static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
return;
|
|
|
}
|
|
|
foreach (static::$_workers as $worker) {
|
|
|
@@ -744,7 +744,7 @@ class Worker
|
|
|
if (\in_array('-q', $argv)) {
|
|
|
return;
|
|
|
}
|
|
|
- if (static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
static::safeEcho("----------------------- WORKERMAN -----------------------------\r\n");
|
|
|
static::safeEcho('Workerman version:'. static::VERSION. ' PHP version:'. \PHP_VERSION. "\r\n");
|
|
|
static::safeEcho("------------------------ WORKERS -------------------------------\r\n");
|
|
|
@@ -841,7 +841,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function parseCommand()
|
|
|
{
|
|
|
- if (static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
return;
|
|
|
}
|
|
|
global $argv;
|
|
|
@@ -1079,7 +1079,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function installSignal()
|
|
|
{
|
|
|
- if (static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
return;
|
|
|
}
|
|
|
// stop
|
|
|
@@ -1105,7 +1105,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function reinstallSignal()
|
|
|
{
|
|
|
- if (static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
return;
|
|
|
}
|
|
|
// uninstall stop signal handler
|
|
|
@@ -1181,7 +1181,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function daemonize()
|
|
|
{
|
|
|
- if (!static::$daemonize || static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (!static::$daemonize || static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
return;
|
|
|
}
|
|
|
\umask(0);
|
|
|
@@ -1210,7 +1210,7 @@ class Worker
|
|
|
*/
|
|
|
public static function resetStd()
|
|
|
{
|
|
|
- if (!static::$daemonize || static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (!static::$daemonize || static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
return;
|
|
|
}
|
|
|
global $STDOUT, $STDERR;
|
|
|
@@ -1241,7 +1241,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function saveMasterPid()
|
|
|
{
|
|
|
- if (static::$_OS !== OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS !== \OS_TYPE_LINUX) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -1319,7 +1319,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function forkWorkers()
|
|
|
{
|
|
|
- if (static::$_OS === OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS === \OS_TYPE_LINUX) {
|
|
|
static::forkWorkersForLinux();
|
|
|
} else {
|
|
|
static::forkWorkersForWindows();
|
|
|
@@ -1598,7 +1598,7 @@ class Worker
|
|
|
*/
|
|
|
protected static function monitorWorkers()
|
|
|
{
|
|
|
- if (static::$_OS === OS_TYPE_LINUX) {
|
|
|
+ if (static::$_OS === \OS_TYPE_LINUX) {
|
|
|
static::monitorWorkersForLinux();
|
|
|
} else {
|
|
|
static::monitorWorkersForWindows();
|
|
|
@@ -2039,7 +2039,7 @@ class Worker
|
|
|
public static function checkErrors()
|
|
|
{
|
|
|
if (static::STATUS_SHUTDOWN !== static::$_status) {
|
|
|
- $error_msg = static::$_OS === OS_TYPE_LINUX ? 'Worker['. \posix_getpid() .'] process terminated' : 'Worker process terminated';
|
|
|
+ $error_msg = static::$_OS === \OS_TYPE_LINUX ? 'Worker['. \posix_getpid() .'] process terminated' : 'Worker process terminated';
|
|
|
$errors = error_get_last();
|
|
|
if ($errors && ($errors['type'] === \E_ERROR ||
|
|
|
$errors['type'] === \E_PARSE ||
|
|
|
@@ -2081,7 +2081,7 @@ class Worker
|
|
|
static::safeEcho($msg);
|
|
|
}
|
|
|
\file_put_contents((string)static::$logFile, \date('Y-m-d H:i:s') . ' ' . 'pid:'
|
|
|
- . (static::$_OS === OS_TYPE_LINUX ? \posix_getpid() : 1) . ' ' . $msg, \FILE_APPEND | \LOCK_EX);
|
|
|
+ . (static::$_OS === \OS_TYPE_LINUX ? \posix_getpid() : 1) . ' ' . $msg, \FILE_APPEND | \LOCK_EX);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -2132,7 +2132,7 @@ class Worker
|
|
|
static::$_outputDecorated = false;
|
|
|
} else {
|
|
|
static::$_outputDecorated =
|
|
|
- static::$_OS === OS_TYPE_LINUX &&
|
|
|
+ static::$_OS === \OS_TYPE_LINUX &&
|
|
|
\function_exists('posix_isatty') &&
|
|
|
\posix_isatty($stream);
|
|
|
}
|
|
|
@@ -2158,7 +2158,7 @@ class Worker
|
|
|
Autoloader::setRootPath($this->_autoloadRootPath);
|
|
|
|
|
|
// Turn reusePort on.
|
|
|
- if (static::$_OS === OS_TYPE_LINUX // if linux
|
|
|
+ if (static::$_OS === \OS_TYPE_LINUX // if linux
|
|
|
&& \version_compare(\PHP_VERSION,'7.0.0', 'ge') // if php >= 7.0.0
|
|
|
&& \strtolower(\php_uname('s')) !== 'darwin') { // if not Mac OS
|
|
|
|