wecodemore / wpstarter

Easily bootstrap whole site Composer packages for WordPress.
https://wecodemore.github.io/wpstarter/
MIT License
246 stars 35 forks source link

[v3] move-content fails #89

Closed soderlind closed 5 years ago

soderlind commented 5 years ago

Describe the bug "move-content" : true deletes wp/wp-content but doesn't move the files. It also prevents WP Starter from creating the new wp-content/plugins and wp-content/themes folders:

├── public
│   ├── wp
│   │   ├── wp-admin
│   │   └── wp-includes
│   └── wp-content
└── vendor

To Reproduce Run composer install o the following files:

wpstarter.json:

{
    "move-content": true
}

composer.json:

{
    "name": "dss-web/nettsteder",
    "type": "project",
    "description": "nettsteder.regjeringen.no",
    "license": "proprietary",
    "require": {
        "composer/installers": "^1.6",
        "wecodemore/wpstarter": "^3",
        "johnpbloch/wordpress": "^5@stable"
    },
    "minimum-stability": "dev",
    "extra": {
        "installer-paths": {
            "public/wp-content/plugins/{$name}": [
                "type:wordpress-plugin"
            ],
            "public/wp-content/mu-plugins/{$name}": [
                "type:wordpress-muplugin"
            ],
            "public/wp-content/themes/{$name}": [
                "type:wordpress-theme"
            ],
            "public/wp-content/{$name}": [
                "type:wordpress-dropin"
            ]
        },
        "wordpress-content-dir": "public/wp-content",
        "wordpress-install-dir": "public/wp"
    },
    "scripts": {
        "post-install-cmd": [
            "tree -d -L 3"
        ],
        "post-update-cmd": [
            "tree -d -L 3"
        ]
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://wpackagist.org"
        }
    ]
}

Expected behavior

├── public
│   ├── wp
│   │   ├── wp-admin
│   │   └── wp-includes
│   └── wp-content
│       ├── plugins
│       └── themes
└── vendor
gmazzap commented 5 years ago

Hi @soderlind

Thanks for reporting.

Will try to reproduce ans fix as soon as I can.

gmazzap commented 5 years ago

Hi @soderlind

I tried to reproduce this, but without success.

I did found an issue with move content, though.

I found that move-content step would do nothing if register-theme-folder is also true (because it is not posssible to both move default WP content and also registers themes inside it as additional theme folder).

The issue is that register-theme-folder is documented to be a default of false (see https://github.com/wecodemore/wpstarter/blob/dev/docs/09-Settings-Cheat-Sheet.md), but it is actually true by default, which means that even if you set move-content settings to true, it will not move content unless you also set register-theme-folder to true.

I will fix this by sticking with false as default for register-theme-folder. This might be a backward compatibility break, but considering that v3 is still in beta and that it was documented like so, I fill that this is the right thing to do.

However, I could not reproduce what you say:

It also prevents WP Starter from creating the new wp-content/plugins and wp-content/themes folders

Can you please try to set your wpstarter.json to:

    "move-content": true,
    "register-theme-folder": false

And see if that works? If not, there might some other issue...

soderlind commented 5 years ago

@gmazzap, I can confirm setting "register-theme-folder": false fixes this issue.

gmazzap commented 5 years ago

Thanks a lot @soderlind then I'm closing this, the default has been updated on the dev branch.