0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Drupal8から9にマイグレーションした作業メモ

Posted at

PHPカンファレンス2021を見ながら、自分のDrupal8のサイトを9に移行作業したので記録簿として残す。

自分の生活リズムで進捗がないので、動画観ながら平行して移行することとした。

Drupal8から何回かマイグレーションしては行っていた。
composer2回実行して5分立たずにDrupla9化は完了したので、個人サイトも直ぐに終わるもんだと予想していたのだが・・・。

マイグレーション準備

コアもモジュールもテーマも最新に。
Docker環境にサイトデータを持って来て、取り急ぎマイグレーションしたら画面真っ白で状況が改善しないので調べていくことにした。

Upgrade Statusでの結果。
myg2021-10-05-22.20.38.png
黄色で表示されたモジュール等を整理していく。

syntaxhighlighterモジュールがDrupal9には未対応。
そしてテーマをカスタムしたSASS Bootstrap Starter Kitが該当した。

syntaxhighlighterモジュールはCKEditor CodeSnippetに変更。

MOCHIYAさんのブログを参考に。
[Drupal8 WYSIWYGエディターでソースコード(code)を入力するための機能追加方法]
(https://www.mochiya.ad.jp/blog/drupal_knowledge/detail/91)

最新だと動かないと嫌なので一つ前のでバージョンcodesnippet_4.15.1を/librariesにCodeSnippetを設置しました。

またDrupal8のSASS Bootstrap Starter Kitは下記のように表示され、適用できない。

Hoge 8.x-1.6
SASS Bootstrap Barrio SubTheme.
This theme is not compatible with Drupal 9.2.6. Check that the .info.yml file contains a compatible 'core' or 'core_version_requirement' value.

ご指摘通りにテーマの.info.ymlに互換性あるように追記する。

themes.info.yml
core_version_requirement: ^8 || ^9

残りの有効になっていないモジュールやテーマをディレクトリから削除すると100%になったので準備完了。
myg2021-10-05-22.31.13.png

移行する前にこちらのコマンドを実行。

composer require 'drupal/core-recommended:^9' 'drupal/core-composer-scaffold:^9' 'drupal/core-project-message:^9' --update-with-dependencies --no-update

composer.jsonを確認すると下記のように変更される。

composer.json
        "drupal/core-composer-scaffold": "^8.9",
        "drupal/core-project-message": "^8.9",
        "drupal/core-recommended": "^8.9"
                             ↓
        "drupal/core-composer-scaffold": "^9",
        "drupal/core-project-message": "^9",
        "drupal/core-recommended": "^9",

下記コマンドでマイグレーションを実行。何もなかったらDBを更新します。

# composer update
# drush updatedb

Drupal9への移行は完了した。

カスタムしたメニューが表示されないのが確認できたら、マイグレーションは失敗でやり直した方がいいだろう。

移行を終えて

実はdrupal/legacy-projectで動いていたのをdrupal/recommended-projectで動かしたかったが、隙間時間で問題解決するまで時間が掛かりdrupal/legacy-projectのまま。
時間を見つけてdrupal/recommended-projectに切り替えたい。

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?