PHP Class app\components\Command

Datei anzeigen Open project: meolu/walle-web Class Usage Examples

Protected Properties

Property Type Description
$LOGDIR
$command
$config walle\config\Config Config
$log
$logFile mixed Handler to the current Log File.
$status integer 命令运行返回值:0失败,1成功

Public Methods

Method Description
__construct ( $config ) 加载配置
getExeCommand ( ) : string 获取执行command
getExeLog ( ) : string 获取执行log
getExeStatus ( ) : string 获取执行log
getMs ( ) : integer 获取耗时毫秒数
log ( $message )
runLocalCommand ( $command ) : boolean | integer 执行本地宿主机命令
runRemoteCommand ( string $command, integer $delay ) : boolean 执行远程目标机器命令
setConfig ( $config ) 加载配置

Protected Methods

Method Description
getConfig ( ) : walle\config\Config 获取配置
getHostName ( $host ) : mixed 获取目标机器的ip或别名
getHostPort ( $host, integer $default = 22 ) : integer 获取目标机器的ssh端口

Method Details

__construct() public method

加载配置
public __construct ( $config )
$config

getConfig() protected method

获取配置
protected getConfig ( ) : walle\config\Config
return walle\config\Config

getExeCommand() public method

获取执行command
Author: wushuiyong
public getExeCommand ( ) : string
return string

getExeLog() public method

获取执行log
Author: wushuiyong
public getExeLog ( ) : string
return string

getExeStatus() public method

获取执行log
Author: wushuiyong
public getExeStatus ( ) : string
return string

getHostName() protected method

获取目标机器的ip或别名
protected getHostName ( $host ) : mixed
$host
return mixed

getHostPort() protected method

获取目标机器的ssh端口
protected getHostPort ( $host, integer $default = 22 ) : integer
$host
$default integer
return integer

getMs() public static method

获取耗时毫秒数
public static getMs ( ) : integer
return integer

log() public static method

public static log ( $message )

runLocalCommand() final public method

执行本地宿主机命令
final public runLocalCommand ( $command ) : boolean | integer
$command
return boolean | integer true 成功,false 失败

runRemoteCommand() final public method

执行远程目标机器命令
final public runRemoteCommand ( string $command, integer $delay ) : boolean
$command string
$delay integer 每台机器延迟执行post_release任务间隔, 不推荐使用, 仅当业务无法平滑重启时使用
return boolean

setConfig() public method

加载配置
public setConfig ( $config )
$config

Property Details

$LOGDIR protected_oe static_oe property

protected static $LOGDIR

$command protected_oe property

protected $command

$config protected_oe property

Config
protected Config,walle\config $config
return walle\config\Config

$log protected_oe property

protected $log

$logFile protected_oe static_oe property

Handler to the current Log File.
protected static mixed $logFile
return mixed

$status protected_oe property

命令运行返回值:0失败,1成功
protected int $status
return integer