Silverstripe : Common Web Platform CWP 2.0 major release and upgrading

On the 30th of May the first major update became available for the Common Web Platform, in the form of a 2.0.0 stable release. The Common Web Platform is an all of government CMS platform which is built on top of and supported by SilverStripe. Much excitement and anticipation has built up around this monumental effort from a huge team of dedicated people — a small summary of which can be read from an earlier blog post announcing the release, covering reasons for upgrading and new features that have been released… but what does this mean, technically?

A quick list of SilverStripe 4 upgrade points:

  • Modules are now silverstripe-vendormodule, and all reside within the vendor directory as with other PHP ecosystem requirements.
  • Projects are now served from a public folder as the web root (as opposed to the installation base). This is required by CWP 2.
  • In order to load assets such as images, CSS, and JavaScript, there is a new expose directive for modules and themes to use. This includes the root project. There’s a new requirements syntax to help load these in now too.
  • Namespaces. Even when a problem seems like it’s not caused by a namespace, there’s still a high chance it’s caused by a namespace. Even with templates.

Expediting upgrading

In order to help our friends achieve their goals more easily, it’s important that we provide easy solutions to work around any obstacles they may encounter. As such, the SilverStripe core team have been spending a great amount of time developing a tool to help teams convert old code bases to the new hotness with minimal fuss in laborious edit tasks.
It will:

  • ‘recompose’ your requirements
  • update your environment settings
  • help you namespace your code
  • help update your code to use new APIs
  • alert you to any issues it may identify
  • relocate your web root assets
  • re-organise your project layout (more relevant with upcoming releases)

While most of these tasks aren’t the biggest of issues, any automation is certainly a welcome aid. The one thing it will not do though is update your version of PHP. Although not strictly necessary, upgrading a project provides great timing to also upgrade to PHP 7.1 — all it takes is a request to the Service Desk to get this sorted.