Esempio n. 1
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     //引数のセット
     if (isset($this->params[self::KEY_APACHE_OWNER])) {
         $owner = Hash::get($this->params, self::KEY_APACHE_OWNER);
         $writables = array(APP . 'Config', APP . 'tmp', ROOT . DS . 'composer.json', ROOT . DS . 'bower.json');
         foreach ($writables as $file) {
             $messages = array();
             $ret = null;
             $cmd = sprintf('`which chown` %s -R %s 2>&1', $owner, $file);
             exec($cmd, $messages, $ret);
         }
     }
     if (array_key_exists(self::KEY_RELEASE, $this->params)) {
         $path = ROOT . DS . 'app' . DS . 'Plugin' . DS;
         $plugins = array_unique(array_merge(App::objects('plugins'), array_map('basename', glob($path . '*', GLOB_ONLYDIR))));
         $folder = new Folder();
         foreach ($plugins as $plugin) {
             $folder->delete($path . $plugin . DS . '.git');
         }
         $folder->delete(ROOT . DS . '.git');
         $folder->delete(ROOT . DS . '.chef');
     }
     Configure::write('NetCommons.installed', true);
     $this->InstallUtil->saveAppConf();
 }
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     //引数のセット
     $data = array();
     // * login
     if (array_key_exists(self::KEY_USERNAME, $this->params)) {
         $data['User'][self::KEY_USERNAME] = Hash::get($this->params, self::KEY_USERNAME);
     } else {
         $data['User'][self::KEY_USERNAME] = $this->in(__d('install', 'NetCommons Login id?'));
     }
     // * password
     if (array_key_exists(self::KEY_PASSWORD, $this->params)) {
         $data['User'][self::KEY_PASSWORD] = Hash::get($this->params, self::KEY_PASSWORD);
     } else {
         $data['User'][self::KEY_PASSWORD] = $this->in(__d('install', 'NetCommons Login password?'));
     }
     $data['User'][self::KEY_PASSWORD . '_again'] = $data['User'][self::KEY_PASSWORD];
     // * handlename
     $data['User'][self::KEY_HANDLENAME] = __d('install', 'System administrator');
     //アカウント作成
     if (!$this->InstallUtil->saveAdminUser($data)) {
         return $this->error(__d('install', 'The user could not be saved. Please try again.'));
     }
 }
Esempio n. 3
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     if (!$this->InstallUtil->installBowerPackages(false)) {
         return $this->error(__d('install', 'Failed to install bower packages.'));
     }
 }
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     //引数のセット
     if (isset($this->params[self::KEY_CONNECTION])) {
         $connection = Hash::get($this->params, self::KEY_CONNECTION);
     } else {
         $connection = 'master';
     }
     $plugins = array_unique(array_merge(App::objects('plugins'), array_map('basename', glob(ROOT . DS . 'app' . DS . 'Plugin' . DS . '*', GLOB_ONLYDIR))));
     if (!$this->InstallUtil->installMigrations($connection, $plugins)) {
         return $this->error(__d('install', 'Failed to install migrations.'));
     }
 }
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     //引数のセット
     if (isset($this->params[self::KEY_APACHE_OWNER])) {
         $owner = Hash::get($this->params, self::KEY_APACHE_OWNER);
         $writables = array(APP . 'Config', APP . 'tmp', ROOT . DS . 'composer.json', ROOT . DS . 'bower.json');
         foreach ($writables as $file) {
             $messages = array();
             $ret = null;
             $cmd = sprintf('`which chown` %s -R %s 2>&1', $owner, $file);
             exec($cmd, $messages, $ret);
         }
     }
 }
Esempio n. 6
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     //引数のセット
     $this->__prepare();
     //データベースの設定
     if ($this->InstallUtil->validatesDBConf($this->data)) {
         $this->InstallUtil->saveDBConf($this->data);
     } else {
         $message = var_export($this->InstallUtil->validationErrors, true);
         return $this->error('validation error', $message);
     }
     //データベース作成
     if (!$this->InstallUtil->createDB($this->data)) {
         return $this->error(__d('install', 'Failed to create database.'));
     }
 }
Esempio n. 7
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     //引数のセット
     if (isset($this->params[self::KEY_BASE_URL])) {
         $fullBaseUrl = $this->params[self::KEY_BASE_URL];
     } else {
         $fullBaseUrl = $this->in(__d('install', 'Please entry base url.'));
     }
     if (!$fullBaseUrl) {
         $message = __d('install', 'Failed to base url.');
         return $this->error($message);
     }
     Configure::write('App.fullBaseUrl', $fullBaseUrl);
     if (array_key_exists(self::KEY_ENABLE_LANGUAGES, $this->params)) {
         $languageEnabled = Hash::get($this->params, self::KEY_ENABLE_LANGUAGES, 'en,ja');
     } else {
         $languageEnabled = $this->in(__d('install', 'Enable languages?'), ['en,ja', 'en', 'ja'], 'en,ja');
     }
     if (array_key_exists(self::KEY_LANGUAGE, $this->params)) {
         $currentLanguage = Hash::get($this->params, self::KEY_LANGUAGE, 'ja');
     } else {
         $currentLanguage = $this->in(__d('install', 'Current language?'), ['en', 'ja'], 'ja');
     }
     //application.ymlの初期化処理
     $data['language'] = strtolower($currentLanguage);
     $data['languageEnabled'] = explode(',', strtolower($languageEnabled));
     if (!$this->InstallUtil->installApplicationYaml($data)) {
         $message = __d('install', 'Failed to write %s. Please check permission.', [APP . 'Config' . DS . 'application.yml']);
         return $this->error($message);
     }
     //database.phpの初期化処理
     $configs = $this->InstallUtil->chooseDBByEnvironment();
     if (!$this->InstallUtil->saveDBConf($configs)) {
         $message = __d('install', 'Failed to write %s. Please check permission.', array(APP . 'Config' . DS . 'database.php'));
         return $this->error($message);
     }
 }
Esempio n. 8
0
 /**
  * Execution method always used for tasks
  *
  * @return void
  */
 public function execute()
 {
     parent::execute();
     $status = 0;
     if (version_compare($this->phpVersion, '5.4.0') >= 0) {
         $message = __d('install', '%s(%s) version success.', 'PHP', $this->phpVersion);
         $this->out('<success>Success:</success> ' . $message);
     } else {
         $message = __d('install', '%s(%s) version error. Please more than "%s" version.', 'PHP', $this->phpVersion, 'PHP 5.4');
         $this->err('<error>Error:</error> ' . $message);
         $status = parent::CODE_ERROR;
     }
     $version = phpversion('pdo_mysql');
     if (!$version) {
         $message = __d('install', 'Not found the %s. Please install the %s.', 'pdo_mysql', 'pdo_mysql');
         $this->err('<error>Error:</error> ' . $message);
         $status = parent::CODE_ERROR;
     } else {
         $message = __d('install', '%s(%s) version success.', 'pdo_mysql', $version);
         $this->out('<success>Success:</success> ' . $message);
     }
     $this->_stop($status);
 }