johnpbloch / wordpress-core-installer

A composer installer for WordPress core so I can stop saying core is a wordpress-plugin type package.
https://packagist.org/packages/johnpbloch/wordpress-core-installer
GNU General Public License v2.0
207 stars 48 forks source link

folder issue if wp-content created by wpackagist in the same time #31

Open florent-cdl opened 3 years ago

florent-cdl commented 3 years ago

Hi, My composer.json have "johnpbloch/wordpress-core-installer": "^2.0" but also a yoast "yoast/wordpress-seo": "^12.5" installer

So as installation of wordpress take time, yoast create a wp-content folder before wordpress-core-installer finished. So a wp-content folder already exists whan the wordpress install wants to create one. I think johnpbloch install don't make the right choice when a folder already exists because it ended with wp-content/wp-content/theme If I remove the plugins, installatyion is correct and I get wp-content/theme Thank you Florent

tomjn commented 3 years ago

Are you trying to create a WP install with a nested WP Content folder? You can’t do that with composer.

Instead use a subfolder install where the WP-content folder sits alongside the wordpress folder, not inside it.

florent-cdl commented 3 years ago

Hi Tom Strange because if I don't include the plugins in composer.json the wp-content is created inside my wordpress folder

tomjn commented 3 years ago

It’s not strange at all. Composer does not support nested package folders, and it installs and updates packages by deleting their folders and putting a newer version in their place.

As the WP zip contains a WP-content folder this is why you get one. The behaviour you’re seeing is not defective behaviour of this plugin, it’s standard behaviour of composer and most other package managers.

What you want is simply not possible. You should abandon the effort and switch to a subfolder WP install instead, the same way you might if you were to install WP via a git submodule

On Thu, 2 Sep 2021 at 12:23, florent-cdl @.***> wrote:

Hi Tom Strange because if I don't include the plugins in composer.json the wp-content is created inside my wordpress folder

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/johnpbloch/wordpress-core-installer/issues/31#issuecomment-911558801, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOLZ5DBWH7EVBNQBU5G6LT75NDFANCNFSM5DITS7BA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

johnpbloch commented 3 years ago

An alternative to switching your folder layout is to stop using composer to manage your WordPress version. WP-CLI is fairly robust and can be used to enforce the WordPress version, and that can even be done using a composer script that runs on install/update.