eZ Platform Legacy Bridge
https://github.com/ezsystems/LegacyBridge/
eZ Platform は前バージョンの eZ Publish 5.x と異なり、デフォルトでは Legacy スタックがインストールされず Symfony スタックのみとなりました。
しかし、今までの開発資産もあり、なかなか Symfony スタックへ完全に切り替えるのは難しいケースも少なくないと思います。
eZ Platform Legacy Bridge は eZ Platform で切り離された Legacy スタックカーネルに相当し、これを導入することで eZ Publish 5.x と同様に旧資産を利用することが可能となります。
eZ Platform
「eZ Platform 1.10.0 インストール手順」を参考に eZ Platform 本体をインストールします。
eZ Platform Legacy Bridge
Legacy エクステンション
eZ Find や eZ Tags など、いくつかの ezpublish-legacy エクステンションはデフォルトではインストールされません。composer.json
に手動で追加することはできます。
post-{install,update}-cmd scripts の追加
composer.json
を編集し、以下の内容を post-install-cmd
と post-update-cmd
の両方のブロックの最後に追加します。
"scripts": {
"build": [...],
"post-install-cmd": [
"@build",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installAssets",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installLegacyBundlesExtensions",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::generateAutoloads"
],
"post-update-cmd": [
"@build",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installAssets",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installLegacyBundlesExtensions",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::generateAutoloads"
],
"post-create-project-cmd": [...]
},
...
"extra": {
"ezpublish-legacy-dir": "ezpublish_legacy",
バンドルの有効化
public function registerBundles()
{
$bundles = array(
...
new eZ\Bundle\EzPublishLegacyBundle\EzPublishLegacyBundle( $this ),
);
ルーティングのインポート
# NOTE: Always keep at the end of the file so native symfony routes always have precendence, to avoid legacy
# REST pattern overriding possible eZ Platform REST routes.
_ezpublishLegacyRoutes:
resource: "@EzPublishLegacyBundle/Resources/config/routing.yml"
管理画面のレガシーモードの有効化
ez_publish_legacy:
system:
site_admin:
legacy_mode: true
RewriteRule の追加
<IfModule mod_rewrite.c>
RewriteEngine On
...
# If using cluster, uncomment the following two lines:
#Rewrite Rule ^/var/([^/]+/)?storage/images(-versioned)?/.* /index.php [L]
#RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* /index_cluster.php [L]
RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* - [L]
RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
RewriteRule ^/design/[^/]+/(stylesheets|images|javascript|fonts)/.* - [L]
RewriteRule ^/share/icons/.* - [L]
RewriteRule ^/extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
RewriteRule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/var/storage/packages/.* - [L]
RewriteRule .* /app.php
</IfModule>
httpd -t
systemctl restart httpd
PEAR パッケージのインストール
yum -y install php-pear && pear channel-discover components.ez.no && pear install ezc/Base ezc/ConsoleTools
ドキュメントに記載がありませんが Zeta Components の Base コンポーネントおよび ConsoleTools コンポーネントがないとオートロードの再生成でこけるので事前に PEAR でインストールしましょう。(Composer 経由でもインストールできるがパスが異なる)
バンドルのインストール
composer require --update-no-dev "ezsystems/legacy-bridge:^1.0.4"
Symfony app フォルダの設定
eZ Publish 5.x では Symfony app フォルダが ezpublish だったため、eZ Platform で変更になった app に変更する必要があります。
<?php
define( 'EZP_APP_FOLDER_NAME', 'app' );
パーミッション設定 1
chown -R apache. ezpublish_legacy/{design,extension,settings,var}
chcon -R -t httpd_sys_script_rw_t {app/{cache,logs},web}
find ezpublish_legacy/{design,extension,settings,var} -type d | xargs chmod -R 775
find ezpublish_legacy/{design,extension,settings,var} -type f | xargs chmod -R 664