カテゴリー
Develop

Drupal 8.4.4アップデート

8.4.4が出ましたよってことで、ボタン一つでアップデートできるのかと思いきや手動更新(汗
Drupal core | Drupal.org

Drupalのサイトはあまり情報が無く、詳細はダウンロードしたパッケージのReadMe.txtを見ろという、かなりのツンデレ。
WordPressのボタンクリック更新に慣れた身にはかなり堪える。

今回はUpdateなので、ダウンロードしたパッケージ内の”/core/UPDATE.txt”の指示に従って作業を進める。

1. Log in as a user with the permission “Administer software updates”.

これは今回知ったのですが、userID=1のユーザは特別な管理者ユーザだとのことで、このユーザでないとupdateできないとのこと。色々検証でuserの追加削除を行って、管理者を別IDにしていたので危なかった・・・。確かにuseID=1のユーザは削除できなくなっているが、もう少し特殊なユーザアカウントだってことを表示しておいて頂きたい。

2. Go to Administration > Configuration > Development > Maintenance mode.
Enable the “Put site into maintenance mode” checkbox and save the configuration.

サイトを一時的にメンテナンスモードにしろと。日本語版だと「管理 > 環境設定 > 開発 > メンテナンスモード」

3. Remove the ‘core’ and ‘vendor’ directories. Also remove all of the files in the top-level directory, except any that you added manually.
If you made modifications to files like .htaccess, composer.json, or robots.txt you will need to re-apply them from your backup, after the new files are in place.
Sometimes an update includes changes to default.settings.php (this will be noted in the release notes). If that’s the case, follow these steps:

– Locate your settings.php file in the /sites/* directory. (Typically sites/default.)
– Make a backup copy of your settings.php file, with a different file name.
– Make a copy of the new default.settings.php file, and name the copy settings.php (overwriting your previous settings.php file).
– Copy the custom and site-specific entries from the backup you made into the new settings.php file. You will definitely need the lines giving the database information, and you will also ant to copy in any other customizations you have added.

You can find the release notes for your version at https://www.drupal.org/project/drupal. At bottom of the project page under “Downloads” use the link for your version of Drupal to view the release notes. If your version is not listed, use the ‘View all releases’ link. From this page you can scroll down or use the filter to find your version and its release notes.

“except any that you added manually”とか正直覚えていないので、とりあえず、”/core/”と”/vendor/”フォルダをリネームして、トップレベルディレクトリにあるファイルだけをバックアップとしてダウンロードしてから、トップレベルディレクトリにあるファイルをまるっと削除。
“settings.php”云々の部分は、リリースノートを見てもいまいちよくわからずで、最悪再インストールする覚悟で無視(まぁ”/sites/default/”以下の”settings.php”、”default.settings.php”、”default.services.yml”ぐらいはバックアップしておいても良いかも)

4. Download the latest Drupal 8.x.x release from https://www.drupal.org to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.
On a typical Unix/Linux command line, use the following commands to download and extract:

wget https://www.drupal.org/files/projects/drupal-x.y.z.tar.gz
tar -zxvf drupal-x.y.z.tar.gz

This creates a new directory drupal-x.y.z/ containing all Drupal files and directories. Copy the files into your Drupal installation directory:

cp -R drupal-x.y.z/* drupal-x.y.z/.htaccess /path/to/your/installation

If you do not have command line access to your server, download the archive from https://www.drupal.org using your web browser, extract it, and then use an FTP client to upload the files to your web root.

レンタルサーバなので、とりあえずFTPで対応する。
最新パッケージをダウンロード+展開して、その中の”modules”,”profiles”,”sites”,”themes”を削除。

5. Re-apply any modifications to files such as .htaccess, composer.json, or robots.txt.

(3)でバックアップした既存サイトのトップレベルディレクトリのファイルと比較して不足しているファイルを最新パッケージに追加。
“.htaccess”とかもDiffで比較。変更しているようであれば最新パッケージに上書き。
で、これをサーバ上に上書きアップロード。

6. Run update.php by visiting http://www.example.com/update.php (replace www.example.com with your domain name). This will update the core database tables.

先に書いたuserID=1のユーザでログインした状態で、http://[your drupal URL]/update.php にアクセス。
設定画面が表示される。今回はDBのアップデートのみだったので、いきなり「承認待ちのアップデートはありません。」表示になって戸惑った。

7. Go to Administration > Reports > Status report. Verify that everything is
working as expected.

[管理 / レポート / 利用可能なアップデート]で最新版になっていることを確認。

8. Ensure that $settings[‘update_free_access’] is FALSE in settings.php.

これはFalseから変更してないが、念のため確認。(sites/default/settings.php)

9. Go to Administration > Configuration > Development > Maintenance mode.
Disable the “Put site into maintenance mode” checkbox and save the configuration.

「管理 > 環境設定 > 開発 > メンテナンスモード」で、メンテナンスモード解除。

以上でアップデート終了。

んー、Wordpressに慣れているとなかなか冗長に感じる。
一応”drush“なるコマンドShellツールを使うともっと簡単なようだが、レンタルサーバだと敷居が高い。興味ある人は以下を参考に・・・

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です