Skip to content
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

[Feature request] Dependency handling #211

Open
StephanStanisic opened this issue Jul 28, 2020 · 1 comment
Open

[Feature request] Dependency handling #211

StephanStanisic opened this issue Jul 28, 2020 · 1 comment

Comments

@StephanStanisic
Copy link

Currently a lot of themes and plugins have dependencies that are not required to run WonderCMS core. For example, a lot of themes I've created use php's DOMDocument. This mostly isn't a problem, since most shared hosts have this installed by default. But when one of these themes is installed, the whole site breaks and someone would need to go and delete the plugin/theme via ftp.

I would suggest some way to define dependencies from a theme or plugin. Either through a extra file, just like description and version, or by registering them through a php function.

I would also suggest the possibility to require plugins. This could make bundling dependencies that get used by multiple plugins easier, and less heavy on the disk. (e.g. a plugin that includes a icon font, and a theme could require this to be installed)

Example of a requirements file:

php:DOMDocument
php:mbstring
plugin:robiso/summernote-editor

These will be read when installing, and the plugin will fail to install when these requirements are not met. With the plugin requirements we could maybe install the required plugin and try again.

Or via the plugin.php or functions.php in a theme:

$Wcms->addRequirement("php", "DOMDocument");
$Wcms->addRequirement("php", "mbstring");
$Wcms->addRequirement("plugin", "robiso/summernote-editor");

This would be the first few lines of code in the file, and the plugin will stop loading if the requirements are not met.

My preference would go to the first option, since that would give people the option to delete a required plugin after installing if they know what they are doing. (When not using the icon font for example)

I think that this is a feature that has to be implemented into core, since a lot of plugins would require something like this. I'll take a look at what I can do with the core as a proof of concept.

@robiso robiso changed the title [feature-request] Dependency handling. [Feature request] Dependency handling Aug 11, 2020
@robiso robiso self-assigned this Aug 11, 2020
@ghost
Copy link

ghost commented Mar 26, 2023

Perhaps this and other issues could be solved by using Composer?
composer.json

{
    "require": {
        "ext-dom": "*",
        "ext-curl": "*",
        "ext-mbstring": "*"
    }
}

But I have no idea how much work that would be....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants