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

Downgrading instead of Upgrading #41

Open
WebVPF opened this issue Aug 9, 2023 · 8 comments
Open

Downgrading instead of Upgrading #41

WebVPF opened this issue Aug 9, 2023 · 8 comments

Comments

@WebVPF
Copy link
Contributor

WebVPF commented Aug 9, 2023

I start the update

composer update

Result

2023-08-09_164852

Then

php artisan winter:up

Result

1

2

Then

composer update

Result

3

Then

php artisan winter:up

Result

4

So it repeats endlessly.
This came up a few months ago.

@LukeTowers
Copy link
Member

@WebVPF how are you defining the requirement for Winter.Blog in your composer.json?

@WebVPF
Copy link
Contributor Author

WebVPF commented Aug 9, 2023

@LukeTowers Winter.User and not Winter.Blog

{
    "name": "winter/wn-user-plugin",
    "type": "winter-plugin",
    "description": "User plugin for Winter CMS",
    "homepage": "https://github.com/wintercms/wn-user-plugin",
    "keywords": ["winter cms", "winter", "plugin", "user", "authentication"],
    "license": "MIT",
    "authors": [
        {
            "name": "Alexey Bobkov",
            "email": "aleksey.bobkov@gmail.com",
            "role": "Original Author"
        },
        {
            "name": "Samuel Georges",
            "email": "daftspunky@gmail.com",
            "role": "Original Author"
        },
        {
            "name": "Winter CMS Maintainers",
            "homepage": "https://wintercms.com",
            "role": "Maintainer"
        }
    ],
    "support": {
        "issues": "https://github.com/wintercms/wn-user-plugin/issues",
        "discord": "https://discord.gg/D5MFSPH6Ux",
        "source": "https://github.com/wintercms/wn-user-plugin"
    },
    "require": {
        "php": ">=7.2",
        "composer/installers": "~1.0"
    },
    "replace": {
        "rainlab/user-plugin": "~1.5"
    },
    "extra": {
        "installer-name": "user"
    }
}

I didn't touch this file.

@LukeTowers
Copy link
Member

I meant in your main composer.json file for your project, what does it say for the requirement on winter/wn-user-plugin?

@WebVPF
Copy link
Contributor Author

WebVPF commented Aug 9, 2023

{
    "name": "wintercms/winter",
    "description": "Free, open-source, self-hosted CMS platform based on the Laravel PHP Framework. Originally known as October CMS.",
    "homepage": "https://wintercms.com",
    "type": "project",
    "keywords": ["winter", "cms", "wintercms", "laravel", "cmf"],
    "license": "MIT",
    "authors": [
        {
            "name": "Alexey Bobkov",
            "email": "aleksey.bobkov@gmail.com",
            "role": "Original Author"
        },
        {
            "name": "Samuel Georges",
            "email": "daftspunky@gmail.com",
            "role": "Original Author"
        },
        {
            "name": "Luke Towers",
            "email": "wintercms@luketowers.ca",
            "role": "Lead Maintainer"
        }
    ],
    "support": {
        "issues": "https://github.com/wintercms/winter/issues",
        "docs": "https://wintercms.github.io/docs/",
        "discord": "https://discord.gg/D5MFSPH6Ux",
        "source": "https://github.com/wintercms/winter"
    },
    "require": {
        "php": "^8.0.2",
        "winter/storm": "~1.2.0",
        "winter/wn-system-module": "~1.2.0",
        "winter/wn-backend-module": "~1.2.0",
        "winter/wn-cms-module": "~1.2.0",
        "laravel/framework": "^9.1",
        "wikimedia/composer-merge-plugin": "~2.0.1",
        "webvpf/wn-darkbackend-plugin": "^1.1",
        "webvpf/wn-dashboardwidgets-plugin": "^1.1",
        "webvpf/wn-robots-plugin": "^1.0",
        "webvpf/wn-share-plugin": "^1.1",
        "webvpf/wn-simpledocs-plugin": "^1.0",
        "winter/wn-user-plugin": "^2.0",
        "winter/wn-notes-plugin": "^1.0",
        "skripteria/wn-site-search-plugin": "^2.0",
        "winter/wn-googleanalytics-plugin": "^3.0"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Flynsarmy/wn-sociallogin-plugin"
        }
    ],
    "require-dev": {
        "phpunit/phpunit": "^9.5.8",
        "mockery/mockery": "^1.4.4",
        "fakerphp/faker": "^1.9.2",
        "squizlabs/php_codesniffer": "^3.2",
        "php-parallel-lint/php-parallel-lint": "^1.0",
        "dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1",
        "flynsarmy/wn-sociallogin-plugin": "dev-master"
    },
    "scripts": {
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-update-cmd": [
            "@php artisan winter:version",
            "@php artisan package:discover"
        ],
        "test": [
            "phpunit --stop-on-failure"
        ],
        "lint": [
            "parallel-lint --exclude vendor --exclude storage --exclude modules/system/tests/fixtures/plugins/testvendor/goto/Plugin.php ."
        ],
        "sniff": [
            "phpcs --colors -nq --report=\"full\" --extensions=\"php\""
        ]
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "extra": {
        "merge-plugin": {
            "include": [
                "plugins/*/*/composer.json"
            ],
            "recurse": true,
            "replace": false,
            "merge-dev": false
        }
    },
    "config": {
        "allow-plugins": {
            "composer/installers": true,
            "wikimedia/composer-merge-plugin": true
        }
    }
}

@bennothommo
Copy link
Member

The only scenario where that would occur normally would be if another plugin had a dependency on User plugin being v2.0.0. If you run composer why winter/wn-user-pugin, it'll tell you which plugins require User, as well as the root package's (ie. your project's) requirements.

@WebVPF
Copy link
Contributor Author

WebVPF commented Oct 8, 2023

I could not install the plugin, it gave the following error:

Problem 1
    - wintercms/winter is present at version 1.0.0+no-version-set and cannot be modified by Composer
    - Only one of these can be installed: winter/wn-user-plugin[v2.2.0], wintercms/winter[1.0.0+no-version-set]. They both replace rainlab/user-plugin and thus cannot coexist.
    - winter/wn-user-plugin is locked to version v2.2.0 and an update of this package was not requested.

You can also try re-running composer require with an explicit version constraint, e.g. "composer requirewinter/wn-redirect-plugin:*" to figure out if any version is installable, or "composer require winter/wn-redirect-plugin:^2.1" if you know which you need.

It helped to remove the following line from the composer.lock file

in "name": "winter/wn-user-plugin"

"replace": {
    "rainlab/user-plugin": "~1.5"
},

@mjauvin
Copy link
Member

mjauvin commented Oct 9, 2023

@WebVPF in your root composer.json, you should use the following:

Add this at the end of the "require" section:

"wikimedia/composer-merge-plugin": "dev-master"

And add this new section at the end of the composer.json file:

    "extra": {
        "merge-plugin": {
            "include": [
                "plugins/*/*/composer.json"
            ],  
            "recurse": true,
            "replace": false,
            "merge-replace": false,
            "merge-dev": false
        }   
    }

@LukeTowers
Copy link
Member

@WebVPF you can also just change the include configuration of that section to only include the plugins that you actually want included by the merge plugin; i.e. your own custom plugins. There's a reason we switched away from including every plugin (via plugins/*/*/composer.json) in the main repo; it's not a good idea to require a plugin through the main file and then also load it in through the merge plugin.

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

No branches or pull requests

4 participants