private function update1_8()
 {
     if (UserGroupsConfiguration::findRule('version') >= 1.8) {
         return;
     }
     mkdir(Yii::app()->basePath . '/views/ugmail');
     // add the activation mail view
     $path = Yii::app()->basePath . '/views/ugmail/activation.php';
     $content = file_get_contents(Yii::app()->basePath . '/modules/userGroups/templates/template_activation.php');
     if (@file_put_contents($path, $content) === false) {
         throw new CHttpException(500, Yii::t('userGroupsModule.install', 'Unable to write the file {path}.', array('path' => $path)));
         return false;
     }
     // add the invitation mail view
     $path = Yii::app()->basePath . '/views/ugmail/invitation.php';
     $content = file_get_contents(Yii::app()->basePath . '/modules/userGroups/templates/template_invitation.php');
     if (@file_put_contents($path, $content) === false) {
         throw new CHttpException(500, Yii::t('userGroupsModule.install', 'Unable to write the file {path}.', array('path' => $path)));
         return false;
     }
     // add the password reset mail view
     $path = Yii::app()->basePath . '/views/ugmail/passreset.php';
     $content = file_get_contents(Yii::app()->basePath . '/modules/userGroups/templates/template_passreset.php');
     if (@file_put_contents($path, $content) === false) {
         throw new CHttpException(500, Yii::t('userGroupsModule.install', 'Unable to write the file {path}.', array('path' => $path)));
         return false;
     }
     // add new cron configuration
     $configuration_model = new UserGroupsConfiguration('installation');
     $configuration_model->rule = 'server_executed_crons';
     $configuration_model->value = 'FALSE';
     $configuration_model->options = 'BOOL';
     $configuration_model->description = 'if true crons must be executed from the server using a crontab';
     if (!$configuration_model->save()) {
         throw new CHttpException(500, Yii::t('userGroupsModule.install', 'Setting not installed. Installation abort.'));
     }
     // change version number
     $version_number = UserGroupsConfiguration::model()->findByAttributes(array('rule' => 'version'));
     $version_number->scenario = 'installation';
     $version_number->value = '1.8';
     $version_number->save();
     return true;
 }
 /**
  * Returns the configuration based on the primary key given.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the configuration to be loaded
  */
 public function loadConfiguration($id)
 {
     $model = UserGroupsConfiguration::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('userGroupsModule.admin', 'The requested rule does not exist.'));
     }
     return $model;
 }