Upgrading XalokNext v3.0 to v3.1
Varnish
Update Varnish's .vcl
file, the section about purging, check Setting up Varnish
Resque
The queue name was always default
in v3.0
and prior. This meant that you couldn't run multiple instances of XalokNext using the same Redis server. In v3.1
the queue name is the same as the public bundle's name. You must update (and reload) the configuration of supervisor:
From (v3.0
):
command=/__PATH_TO_PROJECT__/app/admin/console --env=prod bcc:resque:worker-start default -f
To (v3.1
):
command=/__PATH_TO_PROJECT__/app/admin/console --env=prod bcc:resque:worker-start PROJECT_PUBLIC_BUNDLE_NAME -f
To get the name of the public bundle run:
./app/admin/console debug:container --parameter wf_cms.bundle.public
Project
Prepare the project for update by following these steps:
Varnish.yml
Add app/config/misc/varnish.yml
to .gitignore and add /app/config/misc/varnish.yml.dist
with the contents:
#fos_http_cache:
# proxy_client:
# varnish:
# servers:
# - 127.0.0.1:8080
# base_url: motor.lo
They're all commented, but the .dist
file is required by the installation process and the .yml
file is required by the configuration.
When deploying the updated version to an installation that's running v3.0
, make sure the .yml
file is created and the servers are defined. Remove the old liip_cache_control
definitions.
config_prod.yml
Require the
varnish.yml
file inconfig_prod.yml
(both inapp/admin/config
andapp/public/config
:yaml- { resource: ../../config/misc/varnish.yml }
(under the
imports
section that should already exist there)Make sure the
public_cache.yml
is also imported inapp/public/config/config_prod.yml.dist
. Also, make sure you remove the import ofpublic_cache.yml
fromapp/public/config/config.yml
(thedev
environment doesn't need it)
When deploying the updated version to an installation that's running v3.0
, since the .dist
files won't be copied again (they're copied only on a new installation), make sure you make these changes in the local config_prod.yml
files as well.
public_cache.yml
Before:
liip_cache_control:
rules:
# list of rules
After:
fos_http_cache:
tags:
enabled: true
cache_control:
defaults:
overwrite: true
rules:
# list of rules
For each rule, the following change must be done:
//old
fos_http_cache:
cache_control:
rules:
- { path: ^/page, controls: { public: true } }
//new
fos_http_cache:
cache_control:
rules:
- { match: { path: ^/page }, headers: { cache_control: { public: true } } }
(the path
part is now moved inside a match
directive and controls
becomes cache_control
inside a headers
directive)
The new version of friendsofsymfony/http-cache-bundle
requires at least one proxy server to be enabled, so you need to disable it in dev
environment, by removing the import of public_cache.yml
from app/public/config/config.yml
:
imports:
...
- { resource: public_cache.yml } //<-- remove this line
Remember to place it in app/public/config/config_prod.yml
.
CacheManager
Most of the work done by the CacheManager service (purging Varnish cache) was rebuilt. You must upgrade the code in this file according to the new version. Have a look at the base file /vendor/wfcms/cms-base-bundle/Wf/Bundle/CmsBaseBundle/Frontend/Cache/CacheManager.php
after the update to check
SonataAdmin
Some projects overwrite the templates used by SonataAdminBundle. As this bundle was also updated, it's necessary to use the ones defined in the base bundles:
In /app/config/misc/sonata.yml
:
sonata_admin:
templates:
layout: WfCmsBaseAdminBundle:Admin:layout.html.twig
list: WfCmsBaseAdminBundle:Admin:list.html.twig
The layout file was (normally) just adding the project's stylesheet to the layout. This is now done in the base twig.
vich_uploader.yml
The configuration of vich_uploader was moved to the base bundle. Replace the contents of /app/config/misc/vich_uploader.yml
with the following:
imports:
- { resource: "@WfCmsBaseBundle/Resources/config/third_party/vich_uploader.yml" }
Also remove the file_uploads_path
paramter from /app/config/parameters/parameters.yml
MenuRenderer
If the project overwrites the wf_cms.menu.renderer.class
parameter, check the /src/__PROJECT__/Bundle/CmsBundle/Menu/MenuRenderer.php
code and replace the following:
//old
$item->isCurrent()
//new
$this->matcher->isCurrent($item)
//old
$item->isCurrentAncestor()
//new
$this->matcher->isAncestor($item)
FilesystemLoader
If the project defines /src/__PROJECT__/Bundle/CmsBundle/Templating/Loader/FilesystemLoader.php
, you must update the signature of the findTemplate
method:
//old
protected function findTemplate($template)
{
$templatePath = parent::findTemplate($template);
//...rest of the code remains untouched
}
//new
protected function findTemplate($template, $throw = true)
{
$templatePath = parent::findTemplate($template, $throw);
//...rest of the code remains untouched
}
composer.json
Change the versions of base bundles required by composer.json
:
//old
"wfcms/cms-base-bundle": "3.0.x@dev",
"wfcms/cms-base-admin-bundle": "3.0.x@dev",
//new
"wfcms/cms-base-bundle": "3.1.x@dev",
"wfcms/cms-base-admin-bundle": "3.1.x@dev",
If the project requires codeconsortium/ccdn-user-security-bundle
, make sure it's used - it was included in composer.json
but its usage was removed. Remove it from composer.json
- this bundle was not updated to Symfony 2.8
.
You also need to update the repositories
section and add a custom repository for the friendsofsymfony/elastica-bundle
package. This is because during the development of the 5.0
version they kept compatibility with Symfony 2.8, but before releasing 5.0.0
they changed the compatibility requirement to Symfony 3.2, so there's no 5.x
version that's compatible with Symfony 2.8, so the custom repository for this package pins version 5.0.0 to the last commit compatible with Symfony 2.8
//old
"repositories": [
{
"type": "composer",
"url": "http://composer.webflow.ro"
}
],
//new
"repositories": [
{
"type": "composer",
"url": "http://composer.webflow.ro"
},
{
"type": "vcs",
"url": "https://github.com/geecu/FOQElasticaBundle"
}
],
composer update
After all the above changes have been made, run composer update
in the project to update the dependencies to their latest versions. After composer update
finishes successfully, it'll update the versions in the composer.lock
file - commit these changes (and all the above, if they weren't yet commited). When pulling these changes on another environment, run composer install
to bring these last versions on that environment.