Remove EE from Licence Manager (#5894)

* Removed EE from Licence Manager

* Update Changelog [skip-ci]
This commit is contained in:
Lucas Bartholemy 2022-11-08 22:18:42 +01:00 committed by GitHub
parent a692e460d7
commit e96ed0d014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 38 deletions

View File

@ -11,5 +11,6 @@ HumHub Changelog
- Enh #5872: Invalidate active sessions after password changing
- Enh #5820: Selftest for base URL
- Enh #5891: Improve select2 width on people filters
- Enh #5894: Remove EE from Licence Manager
- Fix #5903: ContentContainerModule::getEnabledContentContainers() returns an empty array
- Enh #5908: New filter ActiveQueryUser->available()

View File

@ -8,6 +8,7 @@
namespace humhub\modules\marketplace\commands;
use humhub\components\SettingsManager;
use humhub\modules\marketplace\components\LicenceManager;
use humhub\modules\marketplace\models\Licence;
use Yii;
@ -38,13 +39,16 @@ class ProfessionalEditionController extends Controller
*/
public function actionInfo()
{
$l = LicenceManager::get(false);
$l = LicenceManager::get();
if ($l->type === Licence::LICENCE_TYPE_PRO) {
LicenceManager::fetch();
$this->stdout(Yii::t('MarketplaceModule.base', "\nPROFESSIONAL EDITION\n"), Console::FG_GREY, Console::BOLD);
/** @var SettingsManager $settings */
$settings = Yii::$app->getModule('marketplace')->settings;
$this->stdout(Yii::t('MarketplaceModule.base', "PROFESSIONAL EDITION")."\n\n", Console::FG_GREY, Console::BOLD);
$this->stdout('Licenced to: ' . $l->licencedTo . "\n");
$this->stdout('Maximum users: ' . $l->maxUsers . "\n");
$this->stdout('Last update: ' . Yii::$app->formatter->asDatetime($settings->get(LicenceManager::SETTING_KEY_PE_LAST_FETCH)) . "\n");
} else {
$this->stdout(Yii::t('MarketplaceModule.base', "\nNo active Professional Edition license found!\n"), Console::FG_RED, Console::BOLD);
}
@ -75,6 +79,16 @@ class ProfessionalEditionController extends Controller
$this->stdout("\n\n");
}
/**
* Updates the license status via the license server
*/
public function actionUpdate()
{
LicenceManager::get(false);
LicenceManager::fetch();
return $this->actionInfo();
}
/**
* Removes the Professional Edition registration.
*/

View File

@ -17,7 +17,6 @@ use humhub\modules\user\models\User;
use Yii;
use yii\base\Component;
use yii\base\InvalidConfigException;
use yii\db\StaleObjectException;
use yii\base\Event;
@ -106,12 +105,6 @@ class LicenceManager extends Component
if (isset(Yii::$app->params['hosting'])) {
// In our demo hosting, we allow pro licences without registration
$licence->type = Licence::LICENCE_TYPE_PRO;
} elseif (Yii::$app->hasModule('enterprise')) {
/** @var \humhub\modules\enterprise\Module $enterprise */
$enterprise = Yii::$app->getModule('enterprise');
if ($enterprise->settings->get('licence') !== null && $enterprise->settings->get('licence_valid') == 1) {
$licence->type = Licence::LICENCE_TYPE_EE;
}
}
return $licence;

View File

@ -18,7 +18,6 @@ class Licence extends Model
*/
const LICENCE_TYPE_CE = 'community';
const LICENCE_TYPE_PRO = 'pro';
const LICENCE_TYPE_EE = 'enterprise';
/**
* @var string the licence type

View File

@ -31,8 +31,6 @@ class AboutVersion extends Widget
} else {
return $this->render('about_version_pro', ['licence' => $licence]);
}
} elseif ($licence->type === Licence::LICENCE_TYPE_EE) {
return $this->render('about_version_ee');
} else {
return $this->render('about_version');
}

View File

@ -1,25 +0,0 @@
<?php
use humhub\modules\marketplace\models\Licence;
use yii\helpers\Url;
/* @var $this \humhub\modules\ui\view\components\View */
/* @var $licence Licence */
?>
<div style="padding:20px" class="jumbotron">
<div class="pull-left" style="padding-right:24px">
<img src="<?= Yii::getAlias('@web-static/img/humhub_pro.jpg'); ?>" style="height:124px;">
</div>
<span style="font-size:36px">HumHub&nbsp;&nbsp;</span><span style="font-size:24px">Enterprise Edition</span><br/>
<span style="font-size:18px"><?= Yii::t('MarketplaceModule.base', 'Version:'); ?> <?= Yii::$app->version ?></span><br/>
<div class="pull-right">
<a href="<?= Url::to(['/marketplace/licence']); ?>" class="btn btn-success"><i class="fa fa-rocket">&nbsp;</i>
<?= Yii::t('MarketplaceModule.base', 'Upgrade to Professional Edition'); ?></a>
</div>
<br />
<br />
<br />
</div>