-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Hello,
I'm encountering different behaviors with composer install and composer update regarding wordpress themes and plugins.
I want to import custom themes and plugins into wordpress, so I added them through the composer path directive.
I'm not fully sure if this is a composer issue, an issue with your great project, or just me not doing things properly.
Here's the folder structure:
.
└── custom
├── plugins
│ └── my_custom_plugin
└── themes
└── my_custom_theme
Both my custom theme and plugin use a composer.json that has the following structure:
{
"name": "me/my_custom_plugin",
"description": "Custom Plugin",
"version": "1.0",
"type": "wordpress-plugin",
"require": {
"composer/installers": "~1.0"
}
}
However the files are only copied into wordpress/wp-content/themes (or /plugins) when I run composer update or composer install with no composer.lock file present.
This behavior can be reproduced locally.
Here's what I noticed:
- When I delete the
composer.lockfile +wordpressfolder +vendorfolder and runcomposer install, it works as expected, my plugin and theme are installed. - If I now keep the
composer.lockfile that I’ve got in step 1., deletewordpressfolder andvendorfolder and runcomposer installagain, my plugins and themes are NOT installed (despite the logs saying otherwise).
If I do a diff of thecomposer.lockfiles of the lock files generated in step 1 and in step 2 there is absolutely no difference between them (besides the hash).
What brings me to the conclusion that somehow the
"extra": {
"installer-paths": {
**commands seem to be ignored.
Is this a known issue? Or expected behavior?**
Here's my main composer.json file
{
"name": "johnpbloch/wordpress",
"description": "WordPress is open source software you can use to create a beautiful website, blog, or app.",
"keywords": [
"wordpress",
"blog",
"cms"
],
"type": "package",
"homepage": "http://wordpress.org/",
"license": "GPL-2.0+",
"authors": [
{
"name": "WordPress Community",
"homepage": "http://wordpress.org/about/"
}
],
"support": {
"issues": "http://core.trac.wordpress.org/",
"forum": "http://wordpress.org/support/",
"wiki": "http://codex.wordpress.org/",
"irc": "irc://irc.freenode.net/wordpress",
"source": "http://core.trac.wordpress.org/browser"
},
"require": {
"php": ">=5.6.20",
"johnpbloch/wordpress-core-installer": "^1.0 || ^2.0",
"johnpbloch/wordpress-core": "5.4.2",
"wpackagist-plugin/bootstrap-shortcodes": "^3.4",
"wpackagist-plugin/akismet": "^4.1",
"me/my_custom_plugin": "^1.0",
"me/my_custom_theme": "^1.0"
},
"repositories":[
{
"type":"composer",
"url":"https://wpackagist.org"
},
{
"type": "path",
"url": "custom/themes/*",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "custom/plugins/*",
"options": {
"symlink": false
}
}
],
"scripts": {
"copywpconfig": [
"cp wp-config.php wordpress/"
],
"post-install-cmd": "@copywpconfig"
},
"extra": {
"installer-paths": {
"wordpress/wp-content/plugins/{$name}": [
"type:wordpress-plugin"
],
"wordpress/wp-content/themes/{$name}": [
"type:wordpress-theme"
],
"wordpress/wp-content/mu-plugins/{$name}": [
"type:wordpress-muplugin"
]
}
}
}
Here's an example (with a present lock file):
➜ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 25 installs, 0 updates, 0 removals
- Installing composer/installers (v1.9.0): Loading from cache
- Installing johnpbloch/wordpress-core-installer (2.0.0): Loading from cache
- Installing me/my_custom_plugin (1.0): Mirroring from custom/plugins/my_custom_plugin
- Installing me/my_custom_theme (1.0): Mirroring from custom/themes/my_custom_theme
...
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
> cp wp-config.php wordpress/
But when I check if the theme is present:
ls -la wordpress/wp-content/themes
.rw-r--r-- 28 trolologuy 11 Jun 0:05 index.php
drwxr-xr-x - trolologuy 11 Jun 0:05 twentynineteen
drwxr-xr-x - trolologuy 11 Jun 0:05 twentyseventeen
drwxr-xr-x - trolologuy 11 Jun 0:05 twentytwenty