LoginSignup
5
2

More than 3 years have passed since last update.

EC-CUBE4.0.1から4.0.3にアップデートするのに失敗した話

Last updated at Posted at 2019-09-17

EC-CUBE4.0.1から4.0.3にアップデートするのに失敗した話

2019年9月9日にEC-CUBE4.0.3がリリースされた。
4.0.3は軽減税率対応なので、今作っているECサイトのバージョンアップを行った。
アップデートするには2つ方法がある。
・Linuxのコマンドラインでアップデートする方法
・ブラウザでECCUBEの管理画面からアップデートプラグインをインストールして実効する方法

結論を先に書くと、私はどっちの方法もうまく行かなかった。結局EC-CUBE4.0.3を新規にインストールして店舗設定・商品設定を最初から実効し直した。これはその失敗の記録である。

コマンドラインでのアップデートを試みた → 失敗

http://doc4.ec-cube.net/quickstart_update
↑このドキュメントを参考にコマンドラインで一つづつアップデートしたが、最終的には失敗。

このドキュメントの分かりにくかった所。
>3. 共通ファイル差し替え
>app/config/eccube app/DoctrineMigrations bin src html vendorディレクトリを最新のファイルですべて上書きしてください。
「最新のファイルですべて上書き」で最新とは何か戸惑ってしまった。

注意:ところどころcomposerコマンドをsudoで実効してます。composerをroot権限で実効することはお勧めできません。m(_ _)m コマンドライン例には書いてませんが sudo chown www-data -R foo を実効して最終的には www-dataをファイルの所有者に切り替えてます。

失敗した手順

* /var/apps/eccube-4.0.3にeccube-4.0.3.zipを解凍
テンポラリディレクトリにeccube-4.0.3.zipをダウンロード

🚑 cd /tmp
🚑 wget http://downloads.ec-cube.net/src/eccube-4.0.3.zip
🚑 unzip eccube-4.0.3.zip

* /var/apps/eccube-4.0.3に配置

🚑 cd /var/apps
🚑 sudo mv /tmp/eccube-4.0.3 /var/apps/eccube-4.0.3
  1. サイトのバックアップ

(/var/apps/eccubeにインストールしてある。)

🚑 cd /var/apps
🚑 sudo cp -pR eccube eccube.bkup
  1. メンテナンスモードを有効にする(バージョン4.0.1以降)
🚑 /var/apps/eccube
🚑 sudo touch .maintenance
  1. 共通ファイル差し替え
🚑 cd /var/apps/eccube/app/config
🚑 sudo cp -pRf /var/apps/eccube-4.0.3/app/config/eccube .
🚑 cd /var/apps/eccube/app
🚑 sudo cp -pR DoctrineMigrations DELETE_ME_LATER_DoctrineMigrations.4.0.1
🚑 sudo cp -pRf /var/apps/eccube-4.0.3/app/DoctrineMigrations .
🚑 cd /var/apps/eccube
🚑 sudo cp -pR bin DELETE_ME_LATER_bin.4.0.1
🚑 sudo cp -pRf /var/apps/eccube-4.0.3/bin .
🚑 sudo cp -pR src DELETE_ME_LATER_src.4.0.1
🚑 sudo cp -pR html DELETE_ME_LATER_html.4.0.1
🚑 sudo cp -pR vendor DELETE_ME_LATER_vendor.4.0.1
🚑 sudo cp -pRf /var/apps/eccube-4.0.3/src .
🚑 sudo cp -pRf /var/apps/eccube-4.0.3/html .
🚑 sudo cp -pRf /var/apps/eccube-4.0.3/vendor .
  1. 個別ファイル差し替え
🚑 sudo cp -pf /var/apps/eccube-4.0.3/composer.json /var/apps/eccube/.
🚑 sudo cp -pf /var/apps/eccube-4.0.3/composer.lock /var/apps/eccube/.
🚑 sudo cp -pf /var/apps/eccube-4.0.3/.htaccess /var/apps/eccube/.
🚑 sudo cp -pf /var/apps/eccube-4.0.3/index.php /var/apps/eccube/.

この↓コマンドを実効したところワーニング発生

🚑 sudo bin/console cache:clear --no-warmup

In ReflectionClassResource.php line 133:

Warning: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future ve

rsion of PHP)

↑たぶんソニーペイメントのプラグインが原因。2019/09/17現在のソニーペイメントプラグインはPHP7.2で削除される関数を使っている。

🚑 sudo apt-get update
🚑 sudo apt-get install mcrypt php7.1-mcrypt
🚑 sudo apt-get upgrade
🚑 sudo vi .env
🚑 sudo bin/console eccube:composer:require-already-installed
  1. composer.json/composer.lockの更新
🚑 sudo vi .env
🚑 sudo bin/console eccube:composer:require-already-installed
  1. スキーマ更新/マイグレーション
🚑 bin/console doctrine:schema:update --force --dump-sql

In ReflectionClassResource.php line 139:

  Warning: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future ve  
  rsion of PHP)                                                                                                                    


🚑 sudo bin/console doctrine:schema:update --force --dump-sql

In ReflectionClassResource.php line 139:

  Warning: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future ve  
  rsion of PHP)                                                                                                                    


🚑 bin/console doctrine:migrations:migrate
  1. プロキシの再生成
🚑  rm -f app/proxy/entity/*.php
🚑  composer dump-autoload
Generated optimized autoload files containing 7340 classes
🚑  bin/console eccube:generate:proxies

In ReflectionClassResource.php line 139:

  Warning: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future ve  
  rsion of PHP)                                                                                                                    


🚑 
🚑 bin/console cache:warmup --env=prod
  1. フロントテンプレートファイルの更新
sudo cp -pf /var/apps/eccube-4.0.3/src/Eccube/Resource/template/default/Mypage/history.twig \
/var/apps/eccube/src/Eccube/Resource/template/default/Mypage/history.twig

sudo cp -pf /var/apps/eccube-4.0.3/src/Eccube/Resource/template/default/Mail/order.twig \
/var/apps/eccube/src/Eccube/Resource/template/default/Mail/order.twig

sudo cp -pf /var/apps/eccube-4.0.3/src/Eccube/Resource/template/default/Mail/order.html.twig \
/var/apps/eccube/src/Eccube/Resource/template/default/Mail/order.html.twig
  1. メンテナンスモードを無効にする(バージョン4.0.1以降)
🚑 /var/apps/eccube
🚑 sudo rm .maintenance

ブラウザでサイトを開くとエラーになった。
しかし、肝心のエラー情報を取ってない。
管理画面でサーバーエラーが発生していた。
↓Apacheアクセスログに残ってたエラー箇所。(./var/log/dev/site.logは消してしまった。)
192.999.999.199 - staff [13/Sep/2019:19:29:32 +0900] "GET /admin/ HTTP/1.1" 500 26766 "https://www.eccubeexample.jp/admin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:56.0) Gecko/20100101 Firefox/56.0 Waterfox/56.2.14"
192.999.999.199 - staff [13/Sep/2019:19:29:35 +0900] "GET /admin/ HTTP/1.1" 500 26922 "https://www.eccubeexample.jp/admin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:56.0) Gecko/20100101 Firefox/56.0 Waterfox/56.2.14"

コマンドラインでのアップデートは操作が多くてどこで間違えたか調べるの疲れてしまったのでプラグインでのアップデートに切り替えた。

うーん、ソニーペイメントのプラグインが影響していたのだろうか?


アップデートプラグイン Ver4.0.2 → 4.0.3 でのアップデート → 失敗

コマンドラインからのアップデートがうまく行かなかったのでショップをバックアップでECCUBE4.0.1で動作していた状態戻して、4.0.3へのアップデートを試みた。

スクリーンショット 2019-09-17 14.09.19.png

4.0.1から4.0.2にアップデート

「アップデートプラグイン Ver4.0.2 → 4.0.3」を使うためには4.0.2にする必用がある。
https://dev.to/nabbisen/ec-cube-4-0-1-4-0-2-openbsd-2a9g
↑この記事を参考にアップデートを行った。

🚑 cd /tmp
🚑 wget http://downloads.ec-cube.net/src/eccube-4.0.2.zip
🚑 unzip eccube-4.0.2.zip
🚑 cd /var/apps
🚑 sudo mv /tmp/eccube-4.0.2 /var/apps/eccube-4.0.2
🚑 cd /var/apps
🚑 sudo cp -pr eccube-4.0.2/app/config/eccube      eccube/app/config
🚑 sudo cp -pr eccube-4.0.2/app/DoctrineMigrations eccube/app
🚑 sudo cp -pr eccube-4.0.2/bin                    eccube/
🚑 sudo cp -pr eccube-4.0.2/src                    eccube/
🚑 sudo cp -pr eccube-4.0.2/html                   eccube/
🚑 sudo cp -pr eccube-4.0.2/vendor                 eccube/

🚑 sudo cp -p eccube-4.0.2/composer.json             eccube/
🚑 sudo cp -p eccube-4.0.2/composer.lock             eccube/

🚑 cd eccube/
🚑 sudo php bin/console cache:clear --no-warmup

🚑 cd /var/apps/eccube
🚑 sudo chown ubuntu -R eccube
🚑 cd eccube/
🚑 php bin/console eccube:composer:require-already-installed

🚑 sudo cp -p eccube-4.0.2/src/Eccube/Resource/template/default/Mypage/history.twig eccube/src/Eccube/Resource/template/default/Mypage/history.twig
🚑 sudo cp -p eccube-4.0.2/src/Eccube/Resource/template/default/Mail/order.twig eccube/src/Eccube/Resource/template/default/Mail/order.twig
🚑 sudo cp -p eccube-4.0.2/src/Eccube/Resource/template/default/Mail/order.html.twig eccube/src/Eccube/Resource/template/default/Mail/order.html.twig

バージョンが4.0.2になっていることを確認

🚑 vi ./src/Eccube/Common/Constant.php
class Constant
{
    /**
     * EC-CUBE VERSION.
     */
    const VERSION = '4.0.2';

    /**
     * Enable value.
     */
    const ENABLED = 1;

    /**
"./src/Eccube/Common/Constant.php" 37L, 576C                                                                         1,1           Top

ECCUBEの管理画面で「アップデートプラグイン Ver4.0.2 → 4.0.3」をインストール

プラグインを実行するにはxdebugを無効化して、memory_limitを512M、max_execution_timeを180にしないといけない。この手順をYouTubeに動画でアップした。↓
https://www.youtube.com/watch?v=5v0K32M6uMw

php.iniの設定を変更して、apache2を再起動してからショップの管理画面でアップデートプラグインをインストール。

スクリーンショット 2019-09-16 11.02.24.png

スクリーンショット 2019-09-16 11.02.15.png

プラグインを実効するとClassNotFoundExceptionが発生
スクリーンショット 2019-09-16 11.02.09.png

composeru updateしてみる

🚑 cd /var/apps/eccube
🚑 composer update
Executing script cache:clear --no-warmup [KO]
 [KO]
Script cache:clear --no-warmup returned with error code 1
!!
!!  In ReflectionClassResource.php line 139:
!!
!!    Warning: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RI
!!    JNDAEL_128' (this will throw an Error in a future version of PHP)
!!
!!
!!
Script @auto-scripts was called via post-update-cmd

今度は動くようになった。
スクリーンショット 2019-09-16 11.15.53.png

バージョンを確認。

namespace Eccube\Common;

class Constant
{
    /**
     * EC-CUBE VERSION.
     */
    const VERSION = '4.0.3';

    /**
     * Enable value.
     */
    const ENABLED = 1;

    /**
"src/Eccube/Common/Constant.php" 37L, 578C                                                                           1,1           Top

スクショ取り忘れたけど、アップデートプラグインのデータベースマイグレーションも実行した。

ショップと管理画面の殆どの画面は動作したが、カートに商品を入れるとエラーが出る。結構クタクタでろくに記録取ってなかった。
エラー画面のスクショも取ってないので
Symfonyエラーが出たのは覚えている。

↓./var/log/dev/site.log の該当箇所っぽい所。

___ *** CRITICAL ERROR *** ==> REQUEST _____________________________________________________________
Exception thrown when handling an exception (Twig\Error\SyntaxError: Unexpected "apply" tag
  (expecting closing tag for the "if" tag defined near line 21). at
  /var/apps/eccube/vendor/symfony/twig-bundle/Resources/views/Exception/traces_text.html.twig
  line 22)
--> exception:
      class: Twig\Error\SyntaxError
      message: 'Unexpected "apply" tag (expecting closing tag for the "if" tag defined near line 21).'
      code: 0
      file: /var/apps/eccube/vendor/symfony/twig-bundle/Resources/views/Exception/traces_text.html.twig
      line: 22

決済系でエラーになっているのでやっぱりうーん、ソニーペイメントのプラグインが原因かなぁ。

結局 EC-CUBE4.0.3を新規にインストール

決済以外は動いた。
決済プラグインはこれからインストールする。
そもそソニーペイメントのプラグイン4.0.3に対応しているのだろうか。

5
2
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
5
2