本文整理汇总了PHP中Shell::out方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::out方法的具体用法?PHP Shell::out怎么用?PHP Shell::out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shell
的用法示例。
在下文中一共展示了Shell::out方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: truncateModels
/**
* Truncate the given models
*
* @param array $modelsToTruncate An array of models (names) to truncate
* @return void
* @todo Improve testability by extracting the model object retrieval part.
*/
public function truncateModels($modelsToTruncate)
{
foreach ($modelsToTruncate as $modelName) {
$this->_shell->out(__('Truncate model %s...', $modelName), 1, Shell::VERBOSE);
$model = ClassRegistry::init($modelName);
$datasource = $model->getDataSource();
$datasource->truncate($model->table);
}
}
示例2: _run
/**
* Runs task
*/
protected function _run()
{
$this->_Process = new TaskProcess($this->_task['command'] . $this->_argsToString($this->_task['arguments']), $this->_task['path']);
$this->_Process->setTimeout($this->_task['timeout']);
try {
$this->_Process->start(function ($type, $buffer) {
if ('err' === $type) {
$this->_Shell->err($buffer);
$this->_task['stderr'] .= $buffer;
} else {
$this->_Shell->out($buffer);
$this->_task['stdout'] .= $buffer;
}
$this->_TaskServer->updated($this->_task);
});
while ($this->_Process->isRunning()) {
$this->_task['process_id'] = (int) $this->_Process->getPid();
$this->_TaskServer->updateStatistics($this->_task);
$this->_Process->checkTimeout();
sleep(Configure::read('Task.checkInterval'));
if ($this->_TaskServer->mustStop($this->_task['id'])) {
$this->_Process->stop(Configure::read('Task.stopTimeout'));
$this->_task['code'] = 143;
$this->_task['code_string'] = TaskProcess::$exitCodes[143];
return $this->_stopped(true);
}
}
$this->_task['code'] = $this->_Process->getExitCode();
$this->_task['code_string'] = $this->_Process->getExitCodeText();
} catch (Exception $Exception) {
$this->_task['code'] = 134;
$this->_task['code_string'] = $Exception->getMessage();
}
$this->_stopped(false);
}
示例3: out
function out($data)
{
if (is_scalar($data)) {
parent::out($data);
} else {
parent::out(print_r($data, true));
}
}
示例4: out
/**
* Modifies the out method for prettier formatting
*
* @param string $sString String to output.
* @param boolean $bNewline If true, the outputs gets an added newline.
*/
function out($sString, $bNewline = true)
{
return parent::out(" " . $sString, $bNewline);
}
示例5: out
/**
* Overwrites parent method to introduce the "quiet" variant
*
* @access public
*/
function out($msg = '')
{
if (!$this->quiet) {
parent::out($msg);
}
}
示例6: out
/**
* Overrides standard shell output to allow /r without /n
*
* Outputs a single or multiple messages to stdout. If no parameters
* are passed outputs just a newline.
*
* @param mixed $message A string or a an array of strings to output
* @param integer $newlines Number of newlines to append
* @return integer Returns the number of bytes returned from writing to stdout.
* @access public
*/
public function out($message = NULL, $newLines = 0, $level = 1)
{
return parent::out($message, $newLines);
}
示例7: out
/**
* Modifies the out method for prettier formatting
*
* @param string $string String to output.
* @param boolean $newline If true, the outputs gets an added newline.
*/
function out($string = '', $newline = true)
{
return parent::out(' ' . $string, $newline);
}
示例8: out
/**
* Overrides standard shell output to allow /r without /n
*
* Outputs a single or multiple messages to stdout. If no parameters
* are passed outputs just a newline.
*
* @param mixed $message A string or a an array of strings to output
* @param integer $newlines Number of newlines to append
* @return integer Returns the number of bytes returned from writing to stdout.
* @access public
*/
public function out($message = null, $newLines = 0)
{
return parent::out($message, $newLines);
}
示例9: out
function out($str = '')
{
$str = date('Y-m-d H:i:s') . ' ' . $str;
return parent::out($str);
}
示例10: out
/**
* Prints a message
*
* @return void
*/
public function out($message = '')
{
parent::out($message);
}
示例11: out
function out($str = null, $newlines = 1, $level = Shell::NORMAL)
{
if ($newlines > 0) {
$str = date('Y-m-d H:i:s') . ' ' . $str;
}
return parent::out($str, $newlines, $level);
}