How to test the C5 version

Permalink 1 user found helpful
Is there a helper or such that will test for the installed C5 version?

JohntheFish
 
Mnkras replied on at Permalink Reply
Mnkras
What do you mean?
jordanlev replied on at Permalink Reply
jordanlev
I just go to the main dashboard page and look in the upper-right corner for the version number.
If you want to write a tool to do it, just output the APP_VERSION constant.
Mnkras replied on at Permalink Reply
Mnkras
ahh,

Well there are 2 version numbers in c5, there is the database version and the file version,

The database version is found in the config table,
(you can get it using Config::get())

and the file version is in the Constant APP_VERSION as Jordan mentioned.
jordanlev replied on at Permalink Reply
jordanlev
Care to explain the difference between the two (if you know)? Is one more "accurate" than the other?
Mnkras replied on at Permalink Reply
Mnkras
Sure,

lets say you have a 5.4.2.1 install (clean)

the database and file version are both 5.4.2.1,

if we for example, upgrade the core to 5.4.2.2, (without running the upgrade script)

the database version is still 5.4.2.1 but the file version is 5.4.2.2,

you can also have a newer database version if you downgrade your core.

Hope that was clear enough
JohntheFish replied on at Permalink Reply
JohntheFish
Is there any ill effect of then two version numbers being out of synchronisation?

If yes, why are they not enforced to be the same?

If no, why bother to make the distinction?

If I am upgrading an addon to make a decision based on 5.5 (different styling), am I correct in testing the file version?

Is there something that intelligently compares version numbers with all the dots - a straight string compare could be inaccurate - or is it ok to ignore the string compare innacuracies?