4

I have been given a Silverstripe site to maintain. How do I know which version of Silverstripe it's using, by looking in the source code?

Highly Irregular
  • 38,000
  • 12
  • 52
  • 70

4 Answers4

8

If your SS installation was made through composer you can have a look to composer.json in the root directory.

If it's a 3.x.x version you can also leave the mouse on the SS logo in backend (upper left corner) and the anchor title wil show you the version. Maybe it works also for 2.x.x versions, but I'm not sure.

g4b0
  • 929
  • 1
  • 8
  • 21
  • Turns out I've got a 3.x.x version, and it was installed with composer, so this worked nicely... thanks! – Highly Irregular Sep 03 '14 at 02:13
  • It's worth mentioning the correct file to look in is composer.lock, rather than composer.json, so that you can see the exact version that has been installed by composer. The json file can have a pattern (eg 3.1.*@stable) which installs the latest sub-version available at the time, whereas the lock file contains the exact version currently installed (eg 3.1.2). The lock file is less understandable to read though. – Highly Irregular Nov 10 '15 at 22:14
3

The Depreciation class provides the version.

$version = Deprecation::dump_settings()['version'];

There is a function in the LeftAndMain class called CMSVersion. This is the function which is used to fill in the version information in the title attribute on the ss logo in the cms as mentioned in the accepted answer. This function attempts to get the version information from the composer.lock file. It will fallback to the /framework/silverstripe_version and /cms/silverstripe_version files if the composer.lock file doesn't exist. So to find the version in the source code, look in composer.lock, then /framework/silverstripe_version and /cms/silverstripe_version

Gavin Bruce
  • 1,799
  • 16
  • 28
  • That doesn't tell me how to find the version just by looking at the source code. – Highly Irregular Nov 10 '15 at 22:00
  • 2
    You're right. There is a function in the LeftAndMain class called CMSVersion. This is the function which is used to fill in the version information in the title attribute on the ss logo in the cms as mentioned in the accepted answer. This function attempts to get the version information from the composer.lock file. It will fallback to the /framework/silverstripe_version and /cms/silverstripe_version files if the composer.lock file doesn't exist. So to find the version in the source code, look in composer.lock, then /framework/silverstripe_version and /cms/silverstripe_version – Gavin Bruce Nov 11 '15 at 06:09
  • Wow, thanks for the detailed explanation! It would be great if it was edited into your answer... ;-) – Highly Irregular Nov 11 '15 at 09:45
0

In the folder "framework" is a file "silverstripe_version" with the Silverstripe version.

spekulatius
  • 1,434
  • 14
  • 24
0

Inside the Folder Framework there is a README.md file. Inside that you'll finde the Version Number.

Also inside framework Folder there is _config.php, there you have a variable like Deprecation::notification_version('3.1.0'); In this example, Version 3.1.0

monkee
  • 33
  • 5
  • The README.md file did not help, and the Deprecation::notification version was wrong on the version I was looking at (3.6.1) – davidgo Feb 27 '18 at 00:03