Message-ID: <1001380734.3492.1485853399541.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3491_67944517.1485853399540" ------=_Part_3491_67944517.1485853399540 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Legacy configuration injection

Legacy configuration injection

 

For better integration between 5.x (symfony based) kernel and legacy (4.= x) kernel, injection is used to inject settings, session and current siteaccess from 5.x into legacy using an even= t: kernel.event_subscriber

=20 =20

Injected settings<= /h2>

Several settings are injected to avoid having to duplicate settings acro= ss new and old kernel, this is done in eZ\Bundle\EzPublishLegacyBundle= \LegacyMapper\Configuration.
For mappings below, yml settings prefixed w= ith ezpublish are system settings, while the rest are settings you can defi= ne per siteaccess.

For versions 5.1, 5.2 and 5.3

When viewing ini settings in the Administration Interface, sett= ings for other siteaccess may be incorrectly displayed if the configuration= has been modified in Symfony configuration.

 

Database settings<= /h3>

The settings for "Server", "Port", "User", "Password", "Database" and "D= atabaseImplementation" are set based on the current settings in your yml fi= les, either from the explicit settings defined below, or the "dsn"

Mapping:

yml site.ini [DatabaseSettings]
server Server
port Port
user User
password Password
database_name Database
type DatabaseImplementation

 

Storage settings

The settings for "VarDir" and "StorageDir" are set based on current sett= ings in your yml files as shown below.

Mapping:

yml site.ini [FileSettings]
var_dir VarDir
storage_dir StorageDir

 

Image settings

Some of the settings for image sub system are set based on your yml file= s as shown below.

Mapping:

yml image.ini
ezpublish.image.temporary_dir [FileSettings]\TemporaryDir
ezpublish.image.published_images_dir [FileSettings]\PublishedImages
ezpublish.image.versioned_images_d= ir [FileSettings]\VersionedImag= es
image_variations [FileSettings]\AliasList
ezpublish.image.imagemagick.enable= d [ImageMagick]\IsEnabled
ezpublish.image.imagemagick.execut= able_path [ImageMagick]\ExecutablePath=
ezpublish.image.imagemagick.execut= able [ImageMagick]\Executable
imagemagick.pre_parameters [ImageMagick]\PreParameters
imagemagick.post_parameters [ImageMagick]\PostParameters
ezpublish.image.imagemagick.filter= s [ImageMagick]\Filters

Image aliases : image_variations

Note : for image_variations the small value is referenced in ez= oe configuration and this configuration needs to be changed if the small va= riation is removed.

 

Using Image= Magick filters

The following block shows a valid ImageMagick filter usage example for <= code>ezpublish.yml:

ImageMagick filters usage example
=20
ezpublish:
    imagemagick:
        filters:
            geometry/scale: "-geometry {1}x{2}"
=20

Since ImageMagick filter usage changed from eZ Publish 4.x versions you = can find the list of filters existing by default to use eZ Publish 5.x:

ImageMagick filters list for yml
sharpen: "-sharpen 0.5"
geometry/scale: "-geometry {1}x{2}"=
geometry/scalewidth: "-geometry {1}"
geometry/scaleheight: "-geometry x{1}"
geometry/scaledownonly: "-geometry {1}x{2}= >"
geometry/scalewidthdownonly: "-geometry {1= }>"
geometry/scaleheightdownonly: "-geometry x= {1}>"
geometry/scaleexact: "-geometry {1}x{2}!"<= /code>
geometry/scalepercent: "-geometry {1}x{2}"=
geometry/crop: "-crop {1}x{2}+{3}+{4}"
filter/noise: "-noise {1}"
filter/swirl: "-swirl {1}"
colorspace/gray: "-colorspace GRAY"=
colorspace/transparent: "-colorspace Trans= parent"
colorspace: "-colorspace {1}"
border: "-border {1}x{2}"
border/color: "-bordercolor rgb({1},{2},{3= })"
border/width: "-borderwidth {1}"
flatten: "-flatten"

resize: "-resize {1}"

For more details on setting ImageMagick filters on image.ini please refe= r to the [imagemagick] / filters documentation.

Extending= injected settings

It's possible to add your own kernel event subscriber and also inject yo= ur own settings by following how it is done in LegacyMapper\Configurat= ion, and then at the end merge it with existing injected settings, like so:=

injected-settings
=20
        $event->getParameters()->set(
            "injected-settings",
            $settings + (array)$event->getParameters()->get( "injecte=
d-settings" )
        );
=20

Site settings

You can inject the site.ini SiteAccessSettings in your ezpublish.yml fil= e.

yml site.ini[SiteAccessSetting= s]
location_id PathPrefix
excluded_uri_prefixes PathPrefixExclude
  [SiteSettings]
location_id IndexPage
  DefaultPage
  RootNode
=20
=20 ezpublish.yml=20  Expand source= =20
=20
=20
ezpublish:
    system:
        ezdemo_site_group:
            content:
                tree_root:
                    # Root locationId. Default is top locationId
                    location_id: 123
                    # Every URL aliases starting with those prefixes will b=
e considered
                    # being outside of the subtree starting at root_locatio=
n.
                    # Default value is an empty array.
                    # Prefixes are not case sensitive.
                    excluded_uri_prefixes: [ /media, /images ]
=20
=20

Injected Beha= vior

In addition to injected settings, some injection of behavior i= s also performed.

eZForm= Token (CSRF) integration

This feature is only available as of eZ Publish 5.1 (2013.01)

If your config.yml setting have framework.csrf_protection.enabl= ed set to true, then both kernel.secret an= d framework.csrf_protection.field_name will be sent to ezxFor= mToken class so csrf protection in legacy uses the same token and form fiel= d name.

By making sure all your Symfony forms uses the provided csrf protection, forms with inte= ntion=3Dlegacy can be set up to send data to legacy kernel:

=20
$formOptions =3D array( 'intention' =3D> 'legacy' );
$form =3D $this->createFormBuilder( null, $formOptions )
    ->...
    ->getForm();
=20

framework.csrf_protection.field_name shouldn't be chan= ged as that would prevent eZFormToken from working with most AJAX custom co= de

ezp= Event (Cache clear) integration

A listener is set up for both content/cache and content/cache/= all to make sure Symfony (Internal proxy or Varnish with custom vcl) HTTP c= ache is cleared when cache is cleared in eZ Publish admin interface. <= /p>

 

------=_Part_3491_67944517.1485853399540--