Drupal 11.3.9
Drupal 10のLTSが2026年12月9日に終了しますので、Drupal Coreの最新版であり、LTSを含めると2028年後半までサポートされるDrupal 11.xにアップデートを行います。
Drupalを初めて触れたのが、2024年であり、DDEVを使用してMacBookProのローカル上でDrupalを動かしていたのですが、当時Drupal 11.xがリリースされていたので、MacBookProのローカルではDrupal 11.xを使用していました。
WordPressを動かしていたXserverのビジネススタンダードに、テストを兼ねてDrupalをインストールして稼働したのが当サイトになります。当時、私が契約しているプランのサーバーで使用出来るDBがMariaDB10.5.xであった為、Drupal 10.xをインストールしこれまで稼働していました。
Xserverのビジネススタンダードのサーバーの仕様がアップデートされ、私が契約しているサーバーから、サーバー移行で最新サーバーを利用できるので、今回移行を行い、サーバー環境がDrupal 11.xに対応していますので今回 Drupal 10.6.8 から Drupal11.3.9 にアップデートを行います。
メジャーアップデート
Drupal 10.6.8 から Drupal11.3.9 にアップデートするのは、Drupal Coreのメジャーアップデートになります。私自身がDrupal 10.xからDrupalを使用しており、使用サーバーの環境から、メジャーアップデートを行うのは初めてになります。
公開しているサイトのメジャーアップデートになりますので、不具合が起きないよう慎重にアップデートを進める必要があります。過去にMacBookProのローカル環境であるDDEVでDrupal 10.x > Drupal 11.xのアップデートは行っており勝手はわかるので慎重に進めていきます。
アップデート
実際にアップデートの作業を進めます。
Composerの--dry-runを使いシュミレーションで確認しながら作業を進めます。
$ composer update --dry-runで現状のアップデートの可否を確認します。
composer update --dry-runの結果
$ composer update --dry-run
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
42 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.現在の依存関係において、「現状の構成(Drupal 10.x系)」として最新の状態であることが確認できました。Nothing to modify ということは、現在の composer.json の指定範囲内では、すべてのパッチもライブラリも正しく当たっています。
メジャーアップデートなので、updateではなくrequireを使います。ここでも、--dry-runを使います。
composer require 'drupal/core-recommended:^11' 'drupal/core-composer-scaffold:^11' 'drupal/core-project-message:^11' 'drush/drush:^13' --update-with-all-dependencies --dry-run
で確認してみます。
- drupal/core-recommended: Drupalコア本体(互換性のあるライブラリセット)
- drupal/core-composer-scaffold: index.phpや.htaccessなどの定型ファイル
- drupal/core-project-message: インストール時のメッセージ
- 注:--with-all-dependenciesを付けることで、依存関係を含めて最新に更新し、エラー(パッケージ競合)を減らします。
シュミレーションの結果
$ composer require 'drupal/core-recommended:^11' 'drupal/core-composer-scaffold:^11' 'drupal/core-project-message:^11' 'drush/drush:^13' --update-with-all-dependencies --dry-run
./composer.json has been updated
Running composer update drupal/core-recommended drupal/core-composer-scaffold drupal/core-project-message drush/drush --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- drupal/core-recommended 11.0.0-beta1 requires drupal/core 11.0.0-beta1 -> found drupal/core[11.0.0-beta1] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.0.0-rc1 requires drupal/core 11.0.0-rc1 -> found drupal/core[11.0.0-rc1] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.0.0 requires drupal/core 11.0.0 -> found drupal/core[11.0.0] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.0.1 requires drupal/core 11.0.1 -> found drupal/core[11.0.1] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.0.2 requires drupal/core 11.0.2 -> found drupal/core[11.0.2] but these were not loaded, likely because it conflicts with another require.
中略
- drupal/core-recommended 11.3.3 requires drupal/core 11.3.3 -> found drupal/core[11.3.3] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.3.4 requires drupal/core 11.3.4 -> found drupal/core[11.3.4] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.3.5 requires drupal/core 11.3.5 -> found drupal/core[11.3.5] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.3.6 requires drupal/core 11.3.6 -> found drupal/core[11.3.6] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.3.7 requires drupal/core 11.3.7 -> found drupal/core[11.3.7] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.3.8 requires drupal/core 11.3.8 -> found drupal/core[11.3.8] but these were not loaded, likely because it conflicts with another require.
- drupal/core-recommended 11.3.9 requires drupal/core 11.3.9 -> found drupal/core[11.3.9] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires drupal/core-recommended ^11 -> satisfiable by drupal/core-recommended[11.0.0-beta1, ..., 11.3.9].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.found drupal/core[11.x.x] but these were not loaded, likely because it conflicts with another require.のメッセージが表示されます。
このProbremはアップデートしようとしたDrupal 11.3.9と、現在組み込まれている他のモジュールやライブラリのバージョン制約が衝突(コンフリクト)していることが原因で発生します。
原因を突き止めます。
まずは、check-platform-reqsで、システムの問題を確認します。
composer check-platform-reqsの結果
$ composer check-platform-reqs
Checking platform requirements for packages in the vendor dir
composer-plugin-api 2.6.0 success
composer-runtime-api 2.2.2 success
ext-ctype * success provided by symfony/polyfill-ctype
ext-date 8.3.30 success
ext-dom 20031129 success
ext-filter 8.3.30 success
ext-gd 8.3.30 success
ext-hash 8.3.30 success
ext-iconv * success provided by symfony/polyfill-iconv
ext-json 8.3.30 success
ext-mbstring * success provided by symfony/polyfill-mbstring
ext-pcre 8.3.30 success
ext-pdo 8.3.30 success
ext-session 8.3.30 success
ext-simplexml 8.3.30 success
ext-spl 8.3.30 success
ext-tokenizer 8.3.30 success
ext-xml 8.3.30 success
ext-xmlwriter 8.3.30 success
php 8.3.30 successPHP 8.3.30 を含むすべてのシステム要件が「success」になっています。「サーバー環境が原因でアップデートできない」という可能性は完全に消えました。純粋に Composer の依存関係だけの問題です。
prohibitsで原因となっているパッケージを特定します。
composer prohibitsの結果
$ composer prohibits drupal/core 11.3.9
drupal/core-recommended 10.6.8 requires drupal/core (10.6.8)
drupal/webform 6.2.10 requires drupal/core (^10.2)
drupal/core 11.3.9 requires symfony/console (^7.4)
drupal/recommended-project - does not require symfony/console (but v6.4.39 is installed)
drupal/core 11.3.9 requires symfony/dependency-injection (^7.4)
drupal/recommended-project - does not require symfony/dependency-injection (but v6.4.38 is installed)
drupal/core 11.3.9 requires symfony/event-dispatcher (^7.4)
drupal/recommended-project - does not require symfony/event-dispatcher (but v6.4.37 is installed)
drupal/core 11.3.9 requires symfony/filesystem (^7.4)
drupal/recommended-project - does not require symfony/filesystem (but v6.4.39 is installed)
drupal/core 11.3.9 requires symfony/finder (^7.4)
drupal/recommended-project - does not require symfony/finder (but v6.4.34 is installed)
drupal/core 11.3.9 requires symfony/http-foundation (^7.4)
drupal/recommended-project - does not require symfony/http-foundation (but v6.4.35 is installed)
drupal/core 11.3.9 requires symfony/http-kernel (^7.4)
drupal/recommended-project - does not require symfony/http-kernel (but v6.4.39 is installed)
drupal/core 11.3.9 requires symfony/mailer (^7.4)
drupal/recommended-project - does not require symfony/mailer (but v6.4.34 is installed)
drupal/core 11.3.9 requires symfony/mime (^7.4)
drupal/recommended-project - does not require symfony/mime (but v6.4.37 is installed)
drupal/core 11.3.9 requires symfony/routing (^7.4)
drupal/recommended-project - does not require symfony/routing (but v6.4.37 is installed)
drupal/core 11.3.9 requires symfony/serializer (^7.4)
drupal/recommended-project - does not require symfony/serializer (but v6.4.37 is installed)
drupal/core 11.3.9 requires symfony/validator (^7.4)
drupal/recommended-project - does not require symfony/validator (but v6.4.37 is installed)
drupal/core 11.3.9 requires symfony/process (^7.4.5)
drupal/recommended-project - does not require symfony/process (but v6.4.39 is installed)
drupal/core 11.3.9 requires symfony/yaml (^7.4)
drupal/recommended-project - does not require symfony/yaml (but v6.4.39 is installed)
drupal/core 11.3.9 requires drupal/core-composer-scaffold (self.version)
drupal/recommended-project - requires drupal/core-composer-scaffold (^10.3)
drupal/core 11.3.9 requires symfony/psr-http-message-bridge (^7.4)
drupal/recommended-project - does not require symfony/psr-http-message-bridge (but v6.4.32 is installed)
Not finding what you were looking for? Try calling `composer update "drupal/core:11.3.9" --dry-run` to get another view on the problem.- drupal/recommended-project - requires drupal/core-composer-scaffold (^10.3)
- drupal/webform 6.2.10 requires drupal/core (^10.2)
- drupal/recommended-project - does not require symfony/psr-http-message-bridge (but v6.4.32 is installed)
メッセージを確認したところ、scaffoldの更新、Symfonyを6 > 7に更新、webformを6.2 > 6.3に更新する必要があります。composer requireに条件を加えます。
以下のcomposer requireのdry-runで確認してみます。
composer require \
"drupal/core-recommended:^11" \
"drupal/core-composer-scaffold:^11" \
"drupal/core-project-message:^11" \
"drupal/webform:^6.3" \
"drush/drush:^13" \
--update-with-all-dependencies --dry-run- "drush/drush:^13" \ : drushを13系の最新にします。
- --update-with-all-dependencies : インストール済みの Symfony コンポーネント群(console, yaml, etc...)を 6系から 7系へアップデートすることを許可します
- "drupal/webform:^6.3" \ : webform6.3系にアップデートします。
メッセージの内容から更新する条件を追加します。
実際に確認してみます。
アップデートのシュミレーション
$ composer require \
> "drupal/core-recommended:^11" \
> "drupal/core-composer-scaffold:^11" \
> "drupal/core-project-message:^11" \
> "drupal/webform:^6.3" \
> "drush/drush:^13" \
> --update-with-all-dependencies --dry-run
./composer.json has been updated
Running composer update drupal/core-recommended drupal/core-composer-scaffold drupal/core-project-message drupal/webform drush/drush --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 28 updates, 1 removal
- Removing doctrine/deprecations (1.1.6)
- Upgrading chi-teck/drupal-code-generator (3.6.1 => 4.2.0)
- Upgrading doctrine/lexer (2.1.1 => 3.0.1)
- Upgrading drupal/core (10.6.8 => 11.3.9)
- Upgrading drupal/core-composer-scaffold (10.6.8 => 11.3.9)
- Upgrading drupal/core-project-message (10.6.8 => 11.3.9)
- Upgrading drupal/core-recommended (10.6.8 => 11.3.9)
- Upgrading drupal/webform (6.2.10 => 6.3.0-beta9)
- Locking php-tuf/composer-stager (v2.0.2)
- Locking revolt/event-loop (v1.0.8)
- Upgrading sebastian/diff (4.0.6 => 7.0.0)
- Upgrading symfony/console (v6.4.39 => v7.4.11)
- Upgrading symfony/dependency-injection (v6.4.38 => v7.4.10)
- Upgrading symfony/error-handler (v6.4.36 => v7.4.8)
- Upgrading symfony/event-dispatcher (v6.4.37 => v7.4.9)
- Upgrading symfony/filesystem (v6.4.39 => v7.4.11)
- Upgrading symfony/finder (v6.4.34 => v7.4.8)
- Upgrading symfony/http-foundation (v6.4.35 => v7.4.8)
- Upgrading symfony/http-kernel (v6.4.39 => v7.4.11)
- Upgrading symfony/mailer (v6.4.34 => v7.4.8)
- Upgrading symfony/mime (v6.4.37 => v7.4.9)
- Upgrading symfony/polyfill-php83 (v1.33.0 => v1.37.0)
- Locking symfony/polyfill-php84 (v1.33.0)
- Locking symfony/polyfill-php85 (v1.33.0)
- Upgrading symfony/process (v6.4.39 => v7.4.11)
- Upgrading symfony/psr-http-message-bridge (v6.4.32 => v7.4.8)
- Upgrading symfony/routing (v6.4.37 => v7.4.9)
- Upgrading symfony/serializer (v6.4.37 => v7.4.10)
- Upgrading symfony/string (v6.4.39 => v7.4.11)
- Upgrading symfony/validator (v6.4.37 => v7.4.10)
- Upgrading symfony/var-dumper (v6.4.36 => v7.4.8)
- Upgrading symfony/var-exporter (v6.4.37 => v7.4.9)
- Upgrading symfony/yaml (v6.4.39 => v7.4.11)
Installing dependencies from lock file (including require-dev)
Package operations: 4 installs, 28 updates, 1 removal
- Removing doctrine/deprecations (1.1.6)
- Upgrading drupal/core-composer-scaffold (10.6.8 => 11.3.9)
- Upgrading drupal/core-project-message (10.6.8 => 11.3.9)
- Upgrading symfony/string (v6.4.39 => v7.4.11)
- Upgrading symfony/console (v6.4.39 => v7.4.11)
- Upgrading symfony/yaml (v6.4.39 => v7.4.11)
- Upgrading symfony/polyfill-php83 (v1.33.0 => v1.37.0)
- Upgrading symfony/validator (v6.4.37 => v7.4.10)
- Installing symfony/polyfill-php84 (v1.33.0)
- Upgrading symfony/serializer (v6.4.37 => v7.4.10)
- Upgrading symfony/routing (v6.4.37 => v7.4.9)
- Upgrading symfony/http-foundation (v6.4.35 => v7.4.8)
- Upgrading symfony/psr-http-message-bridge (v6.4.32 => v7.4.8)
- Upgrading symfony/process (v6.4.39 => v7.4.11)
- Installing symfony/polyfill-php85 (v1.33.0)
- Upgrading symfony/mime (v6.4.37 => v7.4.9)
- Upgrading symfony/event-dispatcher (v6.4.37 => v7.4.9)
- Upgrading doctrine/lexer (2.1.1 => 3.0.1)
- Upgrading symfony/mailer (v6.4.34 => v7.4.8)
- Upgrading symfony/var-dumper (v6.4.36 => v7.4.8)
- Upgrading symfony/error-handler (v6.4.36 => v7.4.8)
- Upgrading symfony/http-kernel (v6.4.39 => v7.4.11)
- Upgrading symfony/finder (v6.4.34 => v7.4.8)
- Upgrading symfony/filesystem (v6.4.39 => v7.4.11)
- Upgrading symfony/var-exporter (v6.4.37 => v7.4.9)
- Upgrading symfony/dependency-injection (v6.4.38 => v7.4.10)
- Upgrading sebastian/diff (4.0.6 => 7.0.0)
- Installing revolt/event-loop (v1.0.8)
- Installing php-tuf/composer-stager (v2.0.2)
- Upgrading drupal/core (10.6.8 => 11.3.9)
- Upgrading drupal/webform (6.2.10 => 6.3.0-beta9)
- Upgrading drupal/core-recommended (10.6.8 => 11.3.9)
- Upgrading chi-teck/drupal-code-generator (3.6.1 => 4.2.0)
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
42 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.問題ありませんので --dry-runを外してDrupal 10.6.8からDrupal 11.3.9にアップデートをします。
上記の--dry-runを使ったシュミレーションと内容が同じなので以下のコードは省略します。
アップデート
$ composer require \
> "drupal/core-recommended:^11" \
> "drupal/core-composer-scaffold:^11" \
> "drupal/core-project-message:^11" \
> "drupal/webform:^6.3" \
> "drush/drush:^13" \
> --update-with-all-dependencies
-----上記のcomposer requireでアップデートします。-----
./composer.json has been updated
Running composer update drupal/core-recommended drupal/core-composer-scaffold drupal/core-project-message drupal/webform drush/drush --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 28 updates, 1 removal
- Removing doctrine/deprecations (1.1.6)
- Upgrading chi-teck/drupal-code-generator (3.6.1 => 4.2.0)
----------中略----------
- Upgrading drupal/core-composer-scaffold (10.6.8 => 11.3.9)
- Upgrading drupal/webform (6.2.10 => 6.3.0-beta9)
- Locking php-tuf/composer-stager (v2.0.2)
- Upgrading symfony/console (v6.4.39 => v7.4.11)
- Upgrading symfony/dependency-injection (v6.4.38 => v7.4.10)
----------中略----------
Installing dependencies from lock file (including require-dev)
Package operations: 4 installs, 28 updates, 1 removal
- Removing doctrine/deprecations (1.1.6)
- Upgrading drupal/core-composer-scaffold (10.6.8 => 11.3.9)
- Upgrading drupal/core-project-message (10.6.8 => 11.3.9)
- Upgrading symfony/string (v6.4.39 => v7.4.11)
- Upgrading symfony/console (v6.4.39 => v7.4.11)
- Upgrading symfony/yaml (v6.4.39 => v7.4.11)
----------中略----------
- Upgrading drupal/core (10.6.8 => 11.3.9)
- Upgrading drupal/webform (6.2.10 => 6.3.0-beta9)
- Upgrading drupal/core-recommended (10.6.8 => 11.3.9)
- Upgrading chi-teck/drupal-code-generator (3.6.1 => 4.2.0)
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
42 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
$ drush updatedb -----DBのアップデート-----
[success] No pending updates.
$ drush cr -----キャッシュのクリア-----
[success] Cache rebuild complete.無事インストールが完了しました。
エラーと警告
Drupal 10.6.8 >>> Drupal 11.3.9に無事アップデートされました。管理コンソールを確認すると、レポートに一件のエラーと、一件の警告が出ています。
エラー
Incompatible module
The following module is installed, but it is incompatible with Drupal 11.3.9:
X Module
Review the suggestions for resolving this incompatibility to repair your installation, and then re-run update.php.X ModuleがDrupal 11.3.9と互換性がないというエラーです。X Moduleは自作のモジュールですので
/modules/custom/x_module/x_module.info.ymlのcore_version_requirementを確認します。Drupal 10.xで作成したモジュールなので以下になっていました。
core_version_requirement: ^9 || ^10
-----Drupal 11.x使用するので以下に修正します。-----
core_version_requirement: ^10 || ^11
-----修正後キャッシュをクリアします。-----
$ drush crこれでエラーが消えました。
警告
Deprecated modules installed
Deprecated modules found: Ban.これは公式サイトを確認すると、Banモジュール(管理画面上は"禁止されたIPアドレス")がDrupal 12で廃止されるので、代替の手段を考えてくださいとの警告になります。
過去にテストで、不正Botと思われるIPを2つ程度登録していたのですが、ほとんど使っていないので、アンインストールしても問題ありません。
もし、不正Botなどが多数来たら、Xserverに標準で搭載されている、拒否IPに登録した方が、システム領域でIPブロックするので安定しています。
いますぐ、アンインストールの必要はありませんので、様子を見て、アンインストールしてしまいます。
アップデートの完了
Xserverの旧サーバーから新サーバーへの移転を行い、PHPバージョンとDrushのシンボリックリンクの破損を修復し、PHP8.3.30とMariaDB11.15.xの環境が整いました。
Drupal 10.6.8 から Drupal 11.3.9に移行するための確認で、--dry-runを使ったシュミレーションを行い、依存関係の問題をクリアして、無事アップデートが完了しました。
記事は2記事分と長くなりましたが、実作業は思ったよりスムースに進みました。
移転に絡み久々に、DrupalとCivicテーマで構築した当サイトに触れました。Civic Themeを久しぶりに触ると、管理コンソール上で運営の全てが完了するCivic Themeの魅力を再確認しました。
Civic Themeの特徴である優れたコンポーネンツ群を上手く使うことで、Webサイトが簡単に構築出来ます。初心を忘れずに、使いこなしていきたいと考える良い機会になりました。