
カラフルボックスというレンタルサーバで稼働しているDrupal 9 サイトをDrupal 10にマイグレーションする。
手順
Drupal 9を最新にする
モジュールも最新に
データベースのバックアップを取る
composer updateを実行する
基本的には以上で完了するが、エラーが多少発生したので記録として残しておきます。
$ composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- drupal/core[10.2.0, ..., 10.2.5] require php >=8.1.0 -> your php version (7.4.33) does not satisfy that requirement.
- Root composer.json requires drupal/core ^10.2 -> satisfiable by drupal/core[10.2.0, ..., 10.2.5].
このエラーはphpのバージョンが7.4.33とバージョンが低いので発生します。
(カラフルボックス(レンタルサーバ)でドメインディレクトリのPHPバージョンを8.1にしても発生する場合)
composer.jsonの "config": に下記を追記する。
"platform": {
"php": "8.2.16"
},
次にcomposer.jsonで下記の箇所を"^9.5",から"^10.1",に変更。
"drupal/core": "^10.1",
"drupal/core-composer-scaffold": "^10.1",
"drupal/core-project-message": "^10.1",
"drupal/core-recommended": "^10.1",
下記を実行するとDrupal 10.1.8が適用した。
$ composer update
更新が完了すると「Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= *.*.*”.」のようにメッセージが出て、サイトが表示しません。
これはカラフルボックスのcPanelからサイト上にphpバージョンを再設定するとサイトが表示するようになります。
次にデータベースを更新します。
$ drush updb
再度composer.jsonを修正、下記の箇所を"^10.1",から"^10.2",に変更。drushは"^12.1"にする。
"drupal/core": "^10.2",
"drupal/core-composer-scaffold": "^10.2",
"drupal/core-project-message": "^10.2",
"drupal/core-recommended": "^10.2",
"drush/drush": "^12.1"
下記を実行するとDrupal 10.2.5が適用した。
$ composer update
次にデータベースを更新します。
$ drush updb
データベースの更新がなくなったら完了です。