-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prototype: Check module requirements before install/update #6816
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2b508d1
Prototype: Check module requirements before install/update
luke- 299dac5
Prevent serialization of requirements check
luke- 730cc96
Fixed ModuleId
luke- dc13aef
Use requirements.php file instead of config.php
luke- 0336a3d
Fix module deletion on update
marc-farre fb673ab
Add errors to the log
marc-farre 92a1ed1
Merge branch 'develop' into enh/check-module-requirements
yurabakhtin 12586b5
Test module with `requirements.php`
yurabakhtin File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
protected/humhub/tests/codeception/_data/ModuleConfig/moduleWithRequirements/Module.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
*/ | ||
|
||
namespace Some\Name\Space\moduleWithRequirements; | ||
|
||
class Module extends \humhub\components\Module | ||
{ | ||
public const ID = 'moduleWithRequirements'; | ||
public const NAMESPACE = __NAMESPACE__; | ||
} |
26 changes: 26 additions & 0 deletions
26
protected/humhub/tests/codeception/_data/ModuleConfig/moduleWithRequirements/config.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2023 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
*/ | ||
|
||
/** @noinspection MissedFieldInspection */ | ||
|
||
require_once __DIR__ . "/Module.php"; | ||
|
||
return [ | ||
'id' => 'moduleWithRequirements', | ||
'class' => \Some\Name\Space\moduleWithRequirements\Module::class, | ||
'namespace' => "Some\\Name\\Space\\moduleWithRequirements", | ||
'events' => [ | ||
[ | ||
'class' => \humhub\tests\codeception\unit\components\ModuleManagerTest::class, | ||
'event' => 'valid', | ||
'callback' => [ | ||
\humhub\tests\codeception\unit\components\ModuleManagerTest::class, | ||
'handleEvent', | ||
], | ||
], | ||
] | ||
]; |
12 changes: 12 additions & 0 deletions
12
protected/humhub/tests/codeception/_data/ModuleConfig/moduleWithRequirements/module.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"id": "moduleWithRequirements", | ||
"version": "1.0", | ||
"name": "My Example Module With Requirements", | ||
"description": "My testing module with Requirements", | ||
"humhub": { | ||
"minVersion": "1.16" | ||
}, | ||
"keywords": ["module", "requirements"], | ||
"homepage": "https://www.example.com", | ||
"licence": "AGPL-3.0-or-later" | ||
} |
7 changes: 7 additions & 0 deletions
7
...ected/humhub/tests/codeception/_data/ModuleConfig/moduleWithRequirements/requirements.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
if (Yii::$app->getModule('module1') === null) { | ||
return 'This module cannot work without enabled module "module1"'; | ||
} | ||
|
||
return null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running some tests for this addition I'm getting the following error;
To fix this and display better error handling here's a fix that will show exactly which
config.php
that causes any issues so that they can be fixed;If this method isn't wanted then I'd suggest only check
config.php
of enabled modules.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reproduce the error you must have a module that has a blank or missing
config.php
file.