Seravo / wordpress

The WordPress project layout used by many of Seravo's customers, suitable also for local development with Vagrant and git deployment
https://seravo.com
GNU General Public License v3.0
104 stars 54 forks source link

Two packages cannot share the same directory! (location of @johnpbloch/wordpress changed March 18th, 2017) #55

Closed ottok closed 3 years ago

ottok commented 7 years ago

Users running composer update in existing (old) projects are seeing this error message: screenshot from 2017-03-23 13 46 03

This is because a rename done in https://github.com/johnpbloch/wordpress

The solution is to update composer.json to include johnpbloch/wordpress-core instead of johnpbloch/wordpress and then running composer update twice. The first run will delete WordPress core files and the second will re-install them. Your plugins, uploads etc remain unaffected.

The issue does not affect new installs done after commit 9326c6ce8852be33b78f65ccb4ab7e65a9512c0e

**Do not close this bug report, but keep it open as information for all users who might bump into this bug with their existing projects.***

k1sul1 commented 7 years ago

Just happened, and followed the instructions to update. Worked in local, but when I pushed into production it broke and failed in a horrible way:

$ git push production master                               
|----------------------------------------------------------------------------|
| Welcome to Seravo.com!                                                     |
| Unauthorized use is forbidden. All connections are monitored and recorded. |
|----------------------------------------------------------------------------|
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.11 KiB | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Seravo: composer.json was updated, installing...
remote: Loading composer repositories with package information
remote: Installing dependencies from lock file
remote: Package operations: 1 install, 19 updates, 2 removals
remote:   - Removing johnpbloch/wordpress (4.7.3)
remote:   - Removing johnpbloch/wordpress-core-installer (0.2.1)
remote:   - Updating koodimonni-plugin-language/woocommerce-en_gb (3.0.1 => 3.0.7): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-plugin-language/akismet-en_gb (3.3 => 3.3.2): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-language/en_gb (4.7.3 => 4.7.5): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-plugin-language/woocommerce-fi (3.0.1 => 3.0.7): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-language/fi (4.7.3 => 4.7.5): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-plugin-language/woocommerce-ru_ru (3.0.1 => 3.0.7): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-plugin-language/akismet-ru_ru (3.2 => 3.3.2): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-language/ru_ru (4.7.3 => 4.7.5): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-plugin-language/woocommerce-sv_se (3.0.1 => 3.0.7): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-plugin-language/akismet-sv_se (3.3 => 3.3.2): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating koodimonni-language/sv_se (4.7.3 => 4.7.5): Downloading (100%)
remote:     Moving dropin files...
remote:
remote:   - Updating seravo/wp-palvelu-plugin (1.4.1 => 1.5.4): Downloading (100%)
remote:   - Updating wpackagist-plugin/autodescription (2.9.1 => 2.9.2): Downloading (100%)
remote:   - Updating wpackagist-plugin/imsanity (2.3.8 => 2.3.9): Downloading (100%)
remote:   - Updating wpackagist-plugin/polylang (2.1.2 => 2.1.5): Downloading (100%)
remote:   - Updating wpackagist-plugin/post-expirator (2.1.4 => 2.2.1): Downloading (100%)
remote:   - Updating wpackagist-plugin/wp-libre-form (1.2.2 => 1.4): Downloading (100%)
remote:   - Updating wpackagist-theme/twentyseventeen (1.1 => 1.2): Downloading (100%)
remote:
remote:
remote:   [InvalidArgumentException]
remote:   Two packages cannot share the same directory!
remote:
remote:
remote: install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
remote:
remote:
remote:
remote: > seravo-wordpress@1.3.0 build /data/wordpress
remote: > composer install
remote:
remote: Loading composer repositories with package information
remote: Installing dependencies (including require-dev) from lock file
remote: Package operations: 1 install, 1 update, 0 removals
remote:   - Installing johnpbloch/wordpress-core (4.8-RC2): Downloading (100%)
remote:   - Removing k1sul1/sensible-content-output (dev-master 5982827)
remote:   - Installing k1sul1/sensible-content-output (dev-master 4edd196): Loading from cache
remote: Generating autoload files
remote: > WordPress\Installer::symlinkWPContent
remote:
remote: Seravo: Nginx configs were changed, reloading nginx...
remote: testing nginx configuration...
remote: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
remote: nginx: configuration file /etc/nginx/nginx.conf test is successful
remote: checking for php backends...
remote: PHP7 mode enabled
remote: Restarting nginx...
remote: nginx restarted!
To ssh://client.seravo.fi:XXXX/data/wordpress
   656303d..310699b  master -> master

Naturally I was greeted with a white screen of death at this point, so I ssh'd into production, and ran a few command to try and fix it without success:

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 1 install, 1 update, 0 removals
  - Installing johnpbloch/wordpress-core (4.8-RC2)Downloading (100%)  - Removing k1sul1/sensible-content-output (dev-master 5982827)
  - Installing k1sul1/sensible-content-output (dev-master 4edd196): Downloading (100%)
Generating autoload files
> WordPress\Installer::symlinkWPContent
client@client_48031b:/data/wordpress$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> WordPress\Installer::symlinkWPContent
client@client_48031b:/data/wordpress$ tail -f /data/log/php-error.log
[06-Jun-2017 11:54:02 Europe/Helsinki] PHP Warning:  require(/data/wordpress/htdocs/wordpress/wp-blog-header.php): failed to open stream: No such file or directory in /data/wordpress/htdocs/index.php on line 6

composer install in production didn't help, and composer update did nothing, production remained broken. At this point I thought that Git is going to save me, so I checked out the last good commit, and ran composer install again:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 2 installs, 19 updates, 1 removal
  - Removing johnpbloch/wordpress-core (4.8-RC2)
  - Installing johnpbloch/wordpress-core-installer (0.2.1): Downloading (100%)
  - Updating koodimonni-plugin-language/woocommerce-en_gb (3.0.7 => 3.0.1): Loading from cache
    Moving dropin files...

  - Updating koodimonni-plugin-language/akismet-en_gb (3.3.2 => 3.3): Downloading (100%)
    Moving dropin files...

  - Updating koodimonni-language/en_gb (4.7.5 => 4.7.3): Downloading (100%)
    Moving dropin files...

  - Updating koodimonni-plugin-language/woocommerce-fi (3.0.7 => 3.0.1): Loading from cache
    Moving dropin files...

  - Updating koodimonni-language/fi (4.7.5 => 4.7.3): Downloading (100%)
    Moving dropin files...

  - Updating koodimonni-plugin-language/woocommerce-ru_ru (3.0.7 => 3.0.1): Loading from cache
    Moving dropin files...

  - Updating koodimonni-plugin-language/akismet-ru_ru (3.3.2 => 3.2): Downloading (100%)
    Moving dropin files...

  - Updating koodimonni-language/ru_ru (4.7.5 => 4.7.3): Downloading (100%)
    Moving dropin files...

  - Updating koodimonni-plugin-language/woocommerce-sv_se (3.0.7 => 3.0.1): Loading from cache
    Moving dropin files...

  - Updating koodimonni-plugin-language/akismet-sv_se (3.3.2 => 3.3): Downloading (100%)
    Moving dropin files...

  - Updating koodimonni-language/sv_se (4.7.5 => 4.7.3): Downloading (100%)
    Moving dropin files...

  - Updating seravo/wp-palvelu-plugin (1.5.4 => 1.4.1): Downloading (100%)
  - Updating wpackagist-plugin/autodescription (2.9.2 => 2.9.1): Downloading (100%)
  - Updating wpackagist-plugin/imsanity (2.3.9 => 2.3.8): Downloading (100%)
  - Updating wpackagist-plugin/polylang (2.1.5 => 2.1.2): Downloading (100%)
  - Updating wpackagist-plugin/post-expirator (2.2.1 => 2.1.4): Downloading (100%)
  - Updating wpackagist-plugin/wp-libre-form (1.4 => 1.2.2): Downloading (100%)
  - Updating wpackagist-theme/twentyseventeen (1.2 => 1.1): Downloading (100%)
  - Installing johnpbloch/wordpress (4.7.3): Downloading (100%)       - Removing k1sul1/sensible-content-output (dev-master 4edd196)
  - Installing k1sul1/sensible-content-output (dev-master 5982827): Loading from cache
Generating autoload files
> WordPress\Installer::symlinkWPContent

This wasn't enough to fix production, so I gave up and restored from a backup.

I'm seriously reconsidering about using Git as a deployment tool, because Composer breaks things in very creative ways way too often.

ottok commented 7 years ago

Thanks for sharing the experience. These two lines seem a bit conflicting:

  - Removing johnpbloch/wordpress-core (4.8-RC2)
  - Installing johnpbloch/wordpress-core-installer (0.2.1): Downloading (100%)
...
Installing johnpbloch/wordpress (4.7.3):

The johnpbloch/wordpress does not exist anymore, so you cannot use it, and the new version of your composer should look like was done in: https://github.com/Seravo/wordpress/commit/9326c6ce8852be33b78f65ccb4ab7e65a9512c0e

..and then you need to run composer install twice to get is fixed.

ottok commented 3 years ago

People are unlikely to bump into this anymore, so no need to keep this open for informational purposes. The issue itself is fixed and most likely all project templates that had this have been updated by their respective developers.