本文整理汇总了PHP中CConsoleCommand::beforeAction方法的典型用法代码示例。如果您正苦于以下问题:PHP CConsoleCommand::beforeAction方法的具体用法?PHP CConsoleCommand::beforeAction怎么用?PHP CConsoleCommand::beforeAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConsoleCommand
的用法示例。
在下文中一共展示了CConsoleCommand::beforeAction方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction($action, $params)
{
if ($this->domain == '') {
echo 'You need to specify the domain as Xpress support multi-sites and multi-database.', "\n", 'i.e: --domain=www.domain.com', "\n";
return false;
}
return parent::beforeAction($action, $params);
}
示例2: beforeAction
protected function beforeAction($action, $params)
{
$this->lockFile = $this->getLockPath() . DIRECTORY_SEPARATOR . $this->getLockFilename($action);
if ($this->isLocked()) {
\Yii::log("Action was canceled because it's locked now", \CLogger::LEVEL_WARNING, self::CATEGORY);
return false;
}
\Yii::log("Lock before action", \CLogger::LEVEL_TRACE, self::CATEGORY);
return parent::beforeAction($action, $params);
}
示例3: beforeAction
public function beforeAction($action, $params)
{
$path = Yii::getPathOfAlias($this->migrationPath);
if ($path === false || !is_dir($path)) {
echo 'Error: The migration directory does not exist: ' . $this->migrationPath . "\n";
exit(1);
}
$this->migrationPath = $path;
return parent::beforeAction($action, $params);
}
示例4: beforeAction
/**
* Determine if the command should use colors, if you overwrite this method
* remember to return the parent value.
* @param string $action the action name
* @param array $params the parameters to be passed to the action method.
* @return bool whether the action should be executed.
*/
protected function beforeAction($action, $params)
{
$this->shouldUseColors = true;
if (function_exists('posix_isatty')) {
$this->shouldUseColors = posix_isatty(STDOUT);
}
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$this->shouldUseColors = false;
}
return parent::beforeAction($action, $params);
}
示例5: beforeAction
public function beforeAction($action, $params)
{
$path = Yii::getPathOfAlias($this->migrationPath);
if ($path === false || !is_dir($path)) {
echo 'Error: The migration directory does not exist: ' . $this->migrationPath . "\n";
exit(1);
}
$this->migrationPath = $path;
$yiiVersion = Yii::getVersion();
echo "\nYii Migration Tool v1.0 (based on Yii v{$yiiVersion})\n\n";
return parent::beforeAction($action, $params);
}
示例6: beforeAction
public function beforeAction($action, $params)
{
$yiiVersion = Yii::getVersion();
echo "\nData Patch Migration Tool v1.0 (based on Yii v{$yiiVersion} Migration Tool)\n\n";
echo 'Data Patch Migration Table : ' . self::migrationTable . "\n\n";
echo 'Data Patch Path : ' . $this->dataPatchPath . "\n\n";
$path = $this->dataPatchPath;
if ($path === false || !is_dir($path)) {
echo 'Error: The migration directory does not exist: ' . $this->dataPatchPath . "\n";
exit(1);
}
return parent::beforeAction($action, $params);
}
示例7: beforeAction
/**
* (non-PHPdoc)
* @see CConsoleCommand::beforeAction()
*/
protected function beforeAction($action, $params)
{
$commandName = $this->getName();
$lockFileName = "{$commandName}_{$action}_.lock";
$dirPath = Yii::app()->runtimePath . '/locks/';
if (!file_exists($dirPath)) {
mkdir($dirPath);
}
$lockFilePath = $dirPath . $lockFileName;
if (file_exists($lockFilePath)) {
die("锁文件\"{$lockFilePath}\"存在,不能运行\n");
return !parent::beforeAction($action, $params);
}
touch($lockFilePath);
return parent::beforeAction($action, $params);
}
示例8: beforeAction
public function beforeAction($action, $params)
{
$this->attachBehaviors(array('UpdaterBehavior' => array('class' => 'application.components.UpdaterBehavior', 'isConsole' => true, 'scenario' => 'update')));
$this->requireDependencies();
return parent::beforeAction($action, $params);
}
示例9: beforeAction
/**
* @inheritdoc
*/
public function beforeAction($action, $params)
{
$this->_service = Yii::app()->cron;
return parent::beforeAction($action, $params);
}
示例10: beforeAction
public function beforeAction($action, $params)
{
Console::writeLine('Command started');
return parent::beforeAction($action, $params);
}
示例11: beforeAction
protected function beforeAction($action, $params)
{
CLIHelper::outputLn(CLIHelper::writeSuccessLn('Let\'s do this...'));
return parent::beforeAction($action, $params);
}