예제 #1
0
 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);
 }
 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);
 }
 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
0
 /**
  * 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
0
 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
0
 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);
 }
 /**
  * (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
0
 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
0
 /**
  * @inheritdoc
  */
 public function beforeAction($action, $params)
 {
     $this->_service = Yii::app()->cron;
     return parent::beforeAction($action, $params);
 }
 public function beforeAction($action, $params)
 {
     Console::writeLine('Command started');
     return parent::beforeAction($action, $params);
 }
예제 #11
0
 protected function beforeAction($action, $params)
 {
     CLIHelper::outputLn(CLIHelper::writeSuccessLn('Let\'s do this...'));
     return parent::beforeAction($action, $params);
 }