shyim / store-plugin-installer

Install store.shopware.com Plugins automatically in your Shopware Composer Setup
36 stars 7 forks source link

Plugins are not removed when removed from composer.json #18

Open hostyle opened 5 years ago

hostyle commented 5 years ago

Plugins that get installed using this method do not appear to be removed if their entry is removed from composer.json.

Before:

    "plugins": {
        "dev": {
            "SwagEnterpriseSearch": "2.2.1",
            "SwagDigitalPublishing": "3.3.0",
            "SwagEmotionAdvanced": "3.2.1"
        },

$ composer install

[Installer] Using $ACCOUNT_USER and $ACCOUNT_PASSWORD to login into the account
[Installer] Successfully loggedin in the account
[Installer] Account is partner account
[Installer] Found shop with domain "redact.ed" in account
[Installer] Using plugin "SwagEnterpriseSearch" with version 2.2.1 from cache
[Installer] Using plugin "SwagDigitalPublishing" with version 3.3.0 from cache
[Installer] Using plugin "SwagEmotionAdvanced" with version 3.2.1 from cache

$ ls custom/plugins

SwagDigitalPublishing   SwagEmotionAdvanced SwagEnterpriseSearch

After:

    "plugins": {
        "dev": {
            "SwagEnterpriseSearch": "2.2.1",
            "SwagEmotionAdvanced": "3.2.1"
        },

$ composer update

[Installer] Using $ACCOUNT_USER and $ACCOUNT_PASSWORD to login into the account
[Installer] Successfully loggedin in the account
[Installer] Account is partner account
[Installer] Found shop with domain "redact.ed" in account
[Installer] Using plugin "SwagEnterpriseSearch" with version 2.2.1 from cache
[Installer] Using plugin "SwagEmotionAdvanced" with version 3.2.1 from cache

$ ls custom/plugins

SwagDigitalPublishing   SwagEmotionAdvanced SwagEnterpriseSearch
Forestsoft-de commented 5 years ago

PluginInstaller cannot know what is removed if you doesnt define that. You cannot purge all plugins in the folder because not all plugins are installed over the plugin installer. You have to manually uninstall that in the backend or over console command.

hostyle commented 5 years ago

I recently came across a secondary related issue.

If you have version 1.0 of a plugin installed with store-plugin-installer, and version 1.1 with file/folder structure changes is released and you try to install that, it will install 1.1 on top of the existing 1.0 plugin meaning any files that were to be removed from 1.0 in the upgrade will remain alongside any new files from 1.1. This can cause issues in particular for any javascript files in eg. Resources/frontend/js/. If 1.1 had Resources/frontend/js/script-v1.0.js and 1.1 had Resources/frontend/js/script-v1.1.js - you now have both scripts and both will run, possibly duplicating functionality or clashing with each other.

Would it be possible to check if a plugin already exists on disk and remove it before re-adding it? Or to compare version before copying new files on top of older version?