コード例 #1
0
 /**
  * Execute the action.
  * @param array command line parameters specific for this command
  */
 public function run($args)
 {
     set_time_limit('7200');
     if (!isset($args[0]) || !isset($args[1]) || !isset($args[2]) || !isset($args[3]) || !isset($args[4]) || !isset($args[5])) {
         $this->usageError('The database user, database name, password, host, port and super user password must be specified.');
     }
     if (!isset($args[6]) || !isset($args[7])) {
         $this->usageError('the hostInfo and scriptUrl parameters must be specified.');
     }
     if (isset($args[8]) && $args[8] != 'demodata') {
         $this->usageError('Invalid parameter specified.  If specified the 9th parameter should be \'demodata\'');
     }
     if (isset($args[9]) && intval($args[9]) < 1) {
         $this->usageError('Invalid parameter specified.  If specified the 10th parameter should be integer and greater then 0');
     }
     if (Yii::app()->isApplicationInstalled()) {
         $this->usageError('The installation is marked as being already completed.  Cannot run the installer.');
     }
     // set hostInfo and scriptUrl for code that uses createUrl, createAbsoluteUrl, themeManager->baseUrl, etc...
     Yii::app()->request->hostInfo = $args[6];
     Yii::app()->request->scriptUrl = $args[7];
     echo "\n";
     InstallUtil::runFromInstallCommand($args, true);
 }