wpコマンドを使ったやり方なので、どちらかというとKUSANAGI環境というよりは、WP-CLIの話。
WP-CLIを導入していれば、wpコマンドでWordPressコア・プラグイン・テーマ・言語ファイルをアップデート出来る。
例えば、コアのアップデートなら、WordPress設置ディレクトリで、
wp core update
を実行する事で、WordPressのコアファイルがアップデートされる。
で、複数サイト存在する場合、これを一つ一つ実行していくのは面倒なので…。
KUSANAGIの場合、デフォルトで 「/home/kusanagi/プロファイル名/DocumentRoot」 にWordPressが配置されるので、以下のようなシェルスクリプトで全サイト分まとめて「コア・プラグイン・テーマ・言語ファイル」をアップデートする事にしてみた。
#!/bin/sh for i in hoge1 hoge2 hoge3 hoge4 do cd /home/kusanagi/$i/DocumentRoot wp core update && wp plugin update --all && wp theme update --all && wp core language update echo -e "$i OK \n" done
一行目の in の後に存在するプロファイルをスペース区切りで並べてやる。
実行すると…。
Success: WordPress is up to date. Success: Plugin already updated. Success: Theme already updated. Success: Translations are up to date. hoge1 OK Success: WordPress is up to date. Success: Plugin already updated. Success: Theme already updated. Success: Translations are up to date. hoge2 OK Success: WordPress is up to date. Success: Plugin already updated. Success: Theme already updated. Success: Translations are up to date. hoge3 OK Success: WordPress is up to date. Success: Plugin already updated. Success: Theme already updated. Success: Translations are up to date. hoge4 OK
といった感じに全部まとめてアップデートを試みるので割と便利かもしれない。
コメント