From e96ed0d014ee99c29a84c8d7094868557e8ba6bd Mon Sep 17 00:00:00 2001 From: Lucas Bartholemy Date: Tue, 8 Nov 2022 22:18:42 +0100 Subject: [PATCH] Remove EE from Licence Manager (#5894) * Removed EE from Licence Manager * Update Changelog [skip-ci] --- CHANGELOG-DEV.md | 1 + .../ProfessionalEditionController.php | 20 ++++++++++++--- .../marketplace/components/LicenceManager.php | 7 ------ .../modules/marketplace/models/Licence.php | 1 - .../marketplace/widgets/AboutVersion.php | 2 -- .../widgets/views/about_version_ee.php | 25 ------------------- 6 files changed, 18 insertions(+), 38 deletions(-) delete mode 100644 protected/humhub/modules/marketplace/widgets/views/about_version_ee.php diff --git a/CHANGELOG-DEV.md b/CHANGELOG-DEV.md index 0c2ce84e66..c4a6ac01af 100644 --- a/CHANGELOG-DEV.md +++ b/CHANGELOG-DEV.md @@ -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() diff --git a/protected/humhub/modules/marketplace/commands/ProfessionalEditionController.php b/protected/humhub/modules/marketplace/commands/ProfessionalEditionController.php index 28932d5b48..17bc288304 100644 --- a/protected/humhub/modules/marketplace/commands/ProfessionalEditionController.php +++ b/protected/humhub/modules/marketplace/commands/ProfessionalEditionController.php @@ -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. */ diff --git a/protected/humhub/modules/marketplace/components/LicenceManager.php b/protected/humhub/modules/marketplace/components/LicenceManager.php index e86b64b456..c3ae1cbc4f 100644 --- a/protected/humhub/modules/marketplace/components/LicenceManager.php +++ b/protected/humhub/modules/marketplace/components/LicenceManager.php @@ -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; diff --git a/protected/humhub/modules/marketplace/models/Licence.php b/protected/humhub/modules/marketplace/models/Licence.php index fad306e267..170675b437 100644 --- a/protected/humhub/modules/marketplace/models/Licence.php +++ b/protected/humhub/modules/marketplace/models/Licence.php @@ -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 diff --git a/protected/humhub/modules/marketplace/widgets/AboutVersion.php b/protected/humhub/modules/marketplace/widgets/AboutVersion.php index 8f9f7fc710..b87237f4b0 100644 --- a/protected/humhub/modules/marketplace/widgets/AboutVersion.php +++ b/protected/humhub/modules/marketplace/widgets/AboutVersion.php @@ -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'); } diff --git a/protected/humhub/modules/marketplace/widgets/views/about_version_ee.php b/protected/humhub/modules/marketplace/widgets/views/about_version_ee.php deleted file mode 100644 index 560a34c077..0000000000 --- a/protected/humhub/modules/marketplace/widgets/views/about_version_ee.php +++ /dev/null @@ -1,25 +0,0 @@ - -
-
- -
- HumHub  Enterprise Edition
- version ?>
- -
-   - -
- -
-
-
-