Skip to content

Commit

Permalink
[FEATURE] Add command "init" to configure platform install for legacy…
Browse files Browse the repository at this point in the history
… bridge usage (#147)
  • Loading branch information
andrerom committed Feb 26, 2019
1 parent 30c97a0 commit 3e3fc7c
Show file tree
Hide file tree
Showing 6 changed files with 441 additions and 70 deletions.
165 changes: 165 additions & 0 deletions INSTALL-MANUALLY.md
@@ -0,0 +1,165 @@
# Installing the eZ Platform legacy bridge

Instructions below will take you true installing legacy bridge and implicit legacy on top of a eZ Platform 1.13.x - 2.x
install.

_TIP:_
> Before starting make sure to check-in (e.g. to Git) your eZ Platform project working space so you'll be able to see & verify changes applied to your setup separate from initial clean project install.
### Add the composer `legacy post-*-scripts`

Edit `composer.json`, and add those lines to both `post-update-cmd` and `post-install-cmd` blocks at the end, but before
`eZ\Bundle\EzPublishCoreBundle\Composer\ScriptHandler::dumpAssets`:
```
"scripts": {
"legacy-scripts": [
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installAssets",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installLegacyBundlesExtensions",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::generateAutoloads",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::symlinkLegacyFiles"
],
"post-install-cmd": [
...,
"@legacy-scripts"
],
"post-update-cmd": [
...,
"@legacy-scripts"
],
}
```

Example: In the case of stock eZ Platform 1.13 that would specifically be:
```
"scripts": {
"legacy-scripts": [
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installAssets",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installLegacyBundlesExtensions",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::generateAutoloads",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::symlinkLegacyFiles"
],
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"eZ\\Bundle\\EzPublishCoreBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"@legacy-scripts",
"eZ\\Bundle\\EzPublishCoreBundle\\Composer\\ScriptHandler::dumpAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
],
(...)
```


### Enable EzPublishLegacyBundle
Edit `app/AppKernel.php`, and add `new eZ\Bundle\EzPublishLegacyBundle\EzPublishLegacyBundle( $this ),`
at the end of the `$bundles` array. Pay close attention to the `$this` argument, LegacyBundle is a bit
spoiled and has high expectations from its collaborators ;)

### Add legacy routes
Edit `app/config/routing.yml`, and add the LegacyBundle routes at the end of the file.

```
# 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
```

### Enable legacy_mode for your backoffice siteaccess

The Legacy Backoffice requires the `legacy_mode` option to be enabled.

This can be done in app/config/config.yml or app/config/ezplatform.yml, where `site_admin` is the name of the admin
siteaccess:

```
ez_publish_legacy:
system:
site_admin:
legacy_mode: true
```

### Optional: add security rules for the Setup Wizard

If you intend to run the legacy setup wizard, you need to allow it in `app/config/security.yml`.

```
ezpublish_setup:
pattern: ^/ezsetup
security: false
```

_Tip:_
> Enabling Setup wizard is only needed if you intend to perform a new install with legacy demo data, you can also install Platform data _(clean, demo)_ and afterwards when everything is setup use Platform UI to change Richtext FieldTypes to XmlText _(using [ezplatform-xmltext-fieldtype](https://github.com/ezsystems/ezplatform-xmltext-fieldtype))_, or install [Netgen RichTextDataType Bundle for legacy](https://github.com/netgen/NetgenRichTextDataTypeBundle) to make legacy allow raw editing of these. If you install eZ Platform Enterprise and it's demo data, there will also be Landing Page field type to handle in similar way _(contributions to Legacy Bridge on this more than welcome ;))_

### Install `ezsystems/legacy-bridge`


Package can be installed using Composer in the following way:

```
composer require --update-no-dev "ezsystems/legacy-bridge:^1.5.0"
```

### Optional: Add missing legacy extensions

Several ezpublish-legacy extensions are no longer installed by default with ezpublish-legacy package, such as ezfind or eztags.
They can still be manually added to the root `composer.json` of your eZ Platform installation.

Previusly bundled extensions, and their composer package names for installing:
- ezsystems/ezscriptmonitor-ls
- ezsystems/ezsi-ls
- ezsystems/ezfind-ls
- ezsystems/eztags-ls

To add the package(s) you want, add them with: `composer require --update-no-dev <package>...`

### Configure virtual host rewrite rules

To access legacy assets (eZ Publish designs and extension designs), add the following rewrite rules to your Apache virtual host:

```
# If using cluster, uncomment the following two lines:
#RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /app.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]
```

Or if using nginx:

```
# If using cluster, uncomment the following two lines:
#rewrite "^/var/([^/]+/)?storage/images(-versioned)?/(.*)" "/app.php" break;
#rewrite "^/var/([^/]+/)?cache/(texttoimage|public)/(.*)" "/index_cluster.php" break;
rewrite "^/var/([^/]+/)?storage/images(-versioned)?/(.*)" "/var/$1storage/images$2/$3" break;
rewrite "^/var/([^/]+/)?cache/(texttoimage|public)/(.*)" "/var/$1cache/$2/$3" break;
rewrite "^/design/([^/]+)/(stylesheets|images|javascript|fonts)/(.*)" "/design/$1/$2/$3" break;
rewrite "^/share/icons/(.*)" "/share/icons/$1" break;
rewrite "^/extension/([^/]+)/design/([^/]+)/(stylesheets|flash|images|lib|javascripts?)/(.*)" "/extension/$1/design/$2/$3/$4" break;
rewrite "^/packages/styles/(.+)/(stylesheets|images|javascript)/([^/]+)/(.*)" "/packages/styles/$1/$2/$3/$4" break;
rewrite "^/packages/styles/(.+)/thumbnail/(.*)" "/packages/styles/$1/thumbnail/$2" break;
rewrite "^/var/storage/packages/(.*)" "/var/storage/packages/$1" break;
```

### Setup Folder Permissions

Last step, if you are on *nix operation system, is to make sure to run
the appropriate command for setting correct folder permissions, you
can find the information you need in [installation guide for eZ Publish 5.x](https://doc.ez.no/display/EZP/Installation).
93 changes: 24 additions & 69 deletions INSTALL.md
@@ -1,78 +1,42 @@
# Installing the eZ Platform legacy bridge

Instructions below will take you true installing legacy bridge and implicit legacy on top of a eZ Platform 1.13.x - 2.x
Instructions below will take you through installing legacy bridge and implicit legacy on top of a eZ Platform 1.13.x - 2.x
install.

### Add the composer `legacy post-*-scripts`
_TIP:_
> Before starting make sure to check-in (e.g. to Git) your eZ Platform project working space so you'll be able to see & verify changes applied to your setup separate from initial clean project install.
Edit `composer.json`, and add those lines to both `post-update-cmd` and `post-install-cmd` blocks at the end, but before
`eZ\Bundle\EzPublishCoreBundle\Composer\ScriptHandler::dumpAssets`:
```
"scripts": {
"legacy-scripts": [
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installAssets",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installLegacyBundlesExtensions",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::generateAutoloads",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::symlinkLegacyFiles"
],
"post-install-cmd": [
...,
"@legacy-scripts"
],
"post-update-cmd": [
...,
"@legacy-scripts"
],
}
```
### Install `ezsystems/legacy-bridge` and run `init` command

Example: In the case of stock eZ Platform 1.13 that would specifically be:
1. Installed package using [Composer](https://getcomposer.org/doc/00-intro.md):
```
"scripts": {
"legacy-scripts": [
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installAssets",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::installLegacyBundlesExtensions",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::generateAutoloads",
"eZ\\Bundle\\EzPublishLegacyBundle\\Composer\\ScriptHandler::symlinkLegacyFiles"
],
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"eZ\\Bundle\\EzPublishCoreBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"@legacy-scripts",
"eZ\\Bundle\\EzPublishCoreBundle\\Composer\\ScriptHandler::dumpAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
],
(...)
composer require --update-no-dev "ezsystems/legacy-bridge"
```


### Enable EzPublishLegacyBundle
2. Enable `EzPublishLegacyBundle`
Edit `app/AppKernel.php`, and add `new eZ\Bundle\EzPublishLegacyBundle\EzPublishLegacyBundle( $this ),`
at the end of the `$bundles` array. Pay close attention to the `$this` argument, LegacyBundle is a bit
spoiled and has high expectations from its collaborators ;)
at the end of the `$bundles` array _(typically just after `new AppBundle\AppBundle(),`)_.

### Add legacy routes
Edit `app/config/routing.yml`, and add the LegacyBundle routes at the end of the file.
_NOTE: Pay close attention to the `$this` argument, LegacyBundle needs it to interact with other eZ bundles._

3. Run the following command to configure your install for legacy usage:
```
# 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
php app/console ezpublish:legacy:init
```

During it's execution it will advice you on which command to run **after** you have moved over your legacy files
_(extensions, settings and optionally designs)_.

_TIP:_
> If you are in need of applying these "init" steps manually, see INSTALL-MANUALLY.md.

### Enable legacy_mode for your backoffice siteaccess

The Legacy Backoffice requires the `legacy_mode` option to be enabled.
This can be done in app/config/config.yml or app/config/ezplatform.yml:

This can be done in app/config/config.yml or app/config/ezplatform.yml, where `site_admin` is the name of the admin
siteaccess:

```
ez_publish_legacy:
Expand All @@ -92,18 +56,9 @@ ezpublish_setup:
```

_Tip:_
> Enabling Setup wizard is only needed if you intend to perform a new install with legacy demo data, you can also install Plaform data _(clean, demo)_ and afterwards when everything is setup use Platform UI to change Richtext FieldTypes to XmlText _(using [ezplatform-xmltext-fieldtype](https://github.com/ezsystems/ezplatform-xmltext-fieldtype))_, or install [Netgen RichTextDataType Bundle for legacy](https://github.com/netgen/NetgenRichTextDataTypeBundle) to make legacy allow raw editing of these. If you install eZ Platform Enterprise and it's demo data, there will also be Landing Page field type to handle in similar way _(contributions to Legacy Bridge on this more than welcome ;))_
> Enabling Setup wizard is only needed if you intend to perform a new install with legacy demo data, you can also install Platform data _(clean, demo)_ and afterwards when everything is setup use Platform UI to change Richtext FieldTypes to XmlText _(using [ezplatform-xmltext-fieldtype](https://github.com/ezsystems/ezplatform-xmltext-fieldtype))_, or install [Netgen RichTextDataType Bundle for legacy](https://github.com/netgen/NetgenRichTextDataTypeBundle) to make legacy allow raw editing of these. If you install eZ Platform Enterprise and it's demo data, there will also be Landing Page field type to handle in similar way _(contributions to Legacy Bridge on this more than welcome ;))_

### Install `ezsystems/legacy-bridge`


Package can be installed using Composer in the following way:

```
composer require --update-no-dev "ezsystems/legacy-bridge:^1.5.0"
```

### Optional: Add missing legacy extensions

Several ezpublish-legacy extensions are no longer installed by default with ezpublish-legacy package, such as ezfind or eztags.
Expand Down Expand Up @@ -155,6 +110,6 @@ rewrite "^/var/storage/packages/(.*)" "/var/storage/packages/$1" break;

### Setup Folder Permissions

Last step, if you are on *nix operation system, is to make sure to run
the appropriate command for setting correct folder permissions, you
Last step, if you are on *nix operation system, is to make sure to run
the appropriate command for setting correct folder permissions, you
can find the information you need in [installation guide for eZ Publish 5.x](https://doc.ez.no/display/EZP/Installation).
1 change: 1 addition & 0 deletions bundle/Command/LegacyConfigurationCommand.php
Expand Up @@ -59,5 +59,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$configurationDumper->dump($configurationConverter->fromLegacy($package, $adminSiteaccess), $options);

$output->writeln('Configuration written to ezpublish.yml and environment related ezpublish configuration files.');
$output->writeln('Make sure to apply the config relevant to your install to your ezplatform.yml file.');
}
}

0 comments on commit 3e3fc7c

Please sign in to comment.