Upgrading Silverstripe 3.1.x
Instructions for upgrading an installation of SilverStripe 3.1.x to the latest version.
I recently needed to make a small upgrade to my installation of SilverStripe from version 3.1.2 to version 3.1.5. Unlike other popular content management systems (CMS) such as WordPress, Joomla or Drupal, the documentation for SilverStripe can be deficient. For those lacking experience with this particular CMS, this poses risks.
Whilst it’s true that official documentation about minor upgrades exits, it contains obvious inaccuracies. For instance, the official advice advises:
Identify system folders in your webroot (
cms
,framework
,sapphire
and any additional modules).
There hasn’t been a /sapphire/
folder since the release of SilverStripe 3.0! Hence I have prepared this quick how-to based on my experience of upgrading from 3.1.2 (the original installation) to 3.1.5.
Step 1: Confirm your version
To determine the version of SilverStripe that you’re using, log into the CMS.
The current version of SilverStripe CMS and framework will be displayed when the mouse is hovered over the SilverStripe logo in the admin panel.
Check the SilverStripe website for the latest stable release to determine whether your SilverStripe site needs upgrading. (There is no automated upgrade system, such as there is for WordPress).
If an upgrade is required, download the ZIP file and unpack it onto your local machine. Do not log out of the admin when you’ve finished.
Step 2: Backup your files
Copy all of the files on your web root to another location, in case it all goes horribly wrong.
Step 3: Backup your database
Backup your SQL database for the same reason. (The procedure I used was the same as described for WordPress, using phpMyAdmin on cPanel).
Step 4: Copy files to the server
The SilverStripe upgrade installation requires the replacement of files within the following folders:
- /cms/
- /framework/
plus the following files in the root:
- CONTRIBUTING.md
- index.php
- info.php
- install-frameworkmissing.html
- Makefile
- web.config
To do this, I renamed the folders to cms.old and framework.old and moved them off the root, in case I needed to roll everything back. Do not leave these folders in the root, or duplicate files will cause errors later in the installation process.
Do not overwrite, replace or move any other folders.
Using FTP, copy the local version of /cms/
and /framework/
across to the server.
Do the same for the files in the root, but do not replace:
- .htaccess
- php.ini
Step 5: Check Constants.php
If, like me, you had problems with false magic_quotes
warnings during the initial installation of SilverStripe, you may have made changes to Constants.php as per these instructions (go to Step 6). The Constants.php file (located at /framework/core/
) will have been overwritten in the upgrade.
Repeat the changes to Constants.php as described in Step 6 of my post “Installing SilverStripe CMS“. Upload the edited Constants.php file to /framework/core/.
Step 6: Rebuild the database
To flush the database, go to http://yourwebsite.com/dev/build/?flush=1
The first time I did this, I got the following error: “Class ‘MySQLQuery’ not found in /home/silverstripe/framework/model/MySQLDatabase.php on line 152”
At this stage, I rolled back my installation to 3.1.2 until I read of this similar experience and realised that I simply needed to refresh that page. I returned the files back to 3.1.5 and then went back to /dev/build/?flush=1. The database was then rebuilt successfully.
Step 7: Check site functionality
Make sure that the site is working as it should at both the back-end and front-end. (As a final step, I had to remedy an annoying magic_quotes problem).
Once the site is confirmed as working at both the front and back ends, the task is complete.
Comments
2 responses to “Upgrading Silverstripe 3.1.x”
Note, the flush=1 rebuilds the class manifest so your application knows which classes are available :)
I’d also highly suggest looking into managing upgrades via the PHP dependancy management tool “Composer”.
We specialised in upgrading silverstripe websites – if you need help.