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

WordPress files get removed with Composer v2 #29

Closed szepeviktor closed 3 years ago

szepeviktor commented 3 years ago
{
    "require": {
        "johnpbloch/wordpress": "^5.5"
    }
}

then issue composer update -vvv

Running 2.0.5 (2020-11-06 20:57:15) with PHP 7.4.12 on Linux / 4.9.0-13-amd64
Loading composer repositories with package information
Updating dependencies
Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
Writing /home/viktor/.composer/cache/repo/https---repo.packagist.org/packages.json into cache
Reading /home/viktor/.composer/cache/repo/https---repo.packagist.org/provider-johnpbloch~wordpress.json from cache
Downloading https://repo.packagist.org/p2/johnpbloch/wordpress.json if modified
[304] https://repo.packagist.org/p2/johnpbloch/wordpress.json
Reading /home/viktor/.composer/cache/repo/https---repo.packagist.org/provider-johnpbloch~wordpress-core-installer.json from cache
Downloading https://repo.packagist.org/p2/johnpbloch/wordpress-core-installer.json if modified
Reading /home/viktor/.composer/cache/repo/https---repo.packagist.org/provider-johnpbloch~wordpress-core.json from cache
Downloading https://repo.packagist.org/p2/johnpbloch/wordpress-core.json if modified
[304] https://repo.packagist.org/p2/johnpbloch/wordpress-core-installer.json
[304] https://repo.packagist.org/p2/johnpbloch/wordpress-core.json
Generating rules
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.001 seconds
Analyzed 102 packages to resolve dependencies
Analyzed 119 rules to resolve dependencies
Lock file operations: 3 installs, 0 updates, 0 removals
Installs: johnpbloch/wordpress-core-installer:2.0.0, johnpbloch/wordpress-core:5.5.3, johnpbloch/wordpress:5.5.3
  - Locking johnpbloch/wordpress (5.5.3)
  - Locking johnpbloch/wordpress-core (5.5.3)
  - Locking johnpbloch/wordpress-core-installer (2.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Reading ./composer.lock
Package operations: 3 installs, 0 updates, 0 removals
Installs: johnpbloch/wordpress-core-installer:2.0.0, johnpbloch/wordpress-core:5.5.3, johnpbloch/wordpress:5.5.3
Reading /home/viktor/.composer/cache/files/johnpbloch/wordpress-core-installer/84ce93917e6c7c835605347db4d7b24a35c31b36.zip from cache
  - Loading johnpbloch/wordpress-core-installer (2.0.0) from cache
Reading /home/viktor/.composer/cache/files/johnpbloch/wordpress-core/e85f10502a0a6f4864337a4474036d50e388215f.zip from cache
  - Loading johnpbloch/wordpress-core (5.5.3) from cache
Reading /home/viktor/.composer/cache/files/johnpbloch/wordpress/b8fa87abf133edd70fc2c40d173a209a2ca02d61.zip from cache
  - Loading johnpbloch/wordpress (5.5.3) from cache
  - Installing johnpbloch/wordpress-core-installer (2.0.0): Extracting archive
Executing async command (CWD): unzip -qq  '/home/viktor/src/aaa/vendor/composer/tmp-489c3d55a29081837b520ea3a4b8f684' -d '/home/viktor/src/aaa/vendor/composer/e7189ce9'
Executing command (CWD): rm -rf '/home/viktor/src/aaa/vendor/johnpbloch/wordpress-core-installer'
Executing command (CWD): rm -rf '/home/viktor/src/aaa/vendor/composer/e7189ce9'
Loading plugin johnpbloch\Composer\WordPressCorePlugin
  - Installing johnpbloch/wordpress-core (5.5.3): Extracting archive
Executing async command (CWD): unzip -qq  '/home/viktor/src/aaa/vendor/composer/tmp-27df48c3e76ad610b4feb1a57b7ff83c' -d '/home/viktor/src/aaa/vendor/composer/9ab5b618'
  - Installing johnpbloch/wordpress (5.5.3): Extracting archive
Executing async command (CWD): unzip -qq  '/home/viktor/src/aaa/vendor/composer/tmp-186e3fe3d05bdc276f37ac0b34690add' -d '/home/viktor/src/aaa/vendor/composer/6ddaa97c'
Executing command (CWD): rm -rf '/home/viktor/src/aaa/vendor/johnpbloch/wordpress'
Executing command (CWD): rm -rf '/home/viktor/src/aaa/vendor/composer/6ddaa97c'
Executing command (CWD): rm -rf 'wordpress'
Executing command (CWD): rm -rf '/home/viktor/src/aaa/vendor/composer/9ab5b618'
Executing command (CWD): rm -rf '/home/viktor/src/aaa/wordpress'
Executing command (CWD): rm -rf '/home/viktor/src/aaa/vendor/johnpbloch/wordpress-core'
Downloading https://packagist.org/downloads/
[201] https://packagist.org/downloads/
Generating autoload files

So WP files got removed.

Works with Composer v1.

@johnpbloch Please advise.

szepeviktor commented 3 years ago

👀 https://github.com/composer/installers/issues/467#issuecomment-724091848

Quote from the "Principles"

Do not install new major version releases of any software in production, let others test it first

tomjn commented 3 years ago

@szepeviktor I tried to reproduce the removal of the folder and could see no erroneous behaviour. Composer is meant to delete and replace package folders.

The only way I can see this being a problem is:

The solution to both of which is... don't. You need to use a subdirectory install if you're planning to use this for anything beyond the initial WP installation, and you should never make additions or modifications in the wordpress folder.

szepeviktor commented 3 years ago

@tomjn Thank you for your long comment! As linked above Composer 2.0.5 had a bug that caused all these. It was fixed in 2.0.6!