protected function execute(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
if (!$form->getFieldValue(self::LICENSE_AGREE_NAME)) {
$form->setFieldError(self::LICENSE_AGREE_NAME, $this->_('You have to agree license.'));
$form->setErrorMessage($this->_('You have to agree license.'));
return $form;
}
try {
$setting = new Gpf_File_Settings();
$settingsArray = $setting->getAll();
if (is_array($settingsArray) && empty($settingsArray)) {
$this->addDBDefaultSettings($setting);
}
$setting->saveAll();
@chmod($setting->getSettingFileName(), 0777);
} catch (Exception $e) {
$form->setErrorMessage($this->_('Could not create settings file. Reason: %s', $e->getMessage()));
return $form;
}
try {
$info = $this->licenseManager->getLicense(trim($form->getFieldValue(self::LICENSE_ID_NAME)));
if (!$info->isApplicationCodeValid()) {
$form->setErrorMessage($this->_('Invalid license.'));
return $form;
}
} catch (Exception $e) {
$form->setErrorMessage($this->_('Could not validate license. Reason: %s', $e->getMessage()));
return $form;
}
$this->setNextStep($form);
return $form;
}