Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-05-27 00:55:36

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

TXP 4.6 version mismatch

Is there any reason why there’s a contradiction in the TXP versions:

txp_version = "v4.6-dev"
$prefs['version'] = "4.5.7"

Only $prefs is available on the public side, so it makes testing for 4.6 awkward.

And, why is the version stored in two different places anyway?

Offline

#2 2016-05-27 11:10:24

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: TXP 4.6 version mismatch

Unsure. Might be for “there’s a new version available for download”, perhaps?

Offline

#3 2016-05-27 12:42:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: TXP 4.6 version mismatch

gomedia wrote #299311:

Is there any reason why there’s a contradiction in the TXP versions:

Yes. The one in prefs is what you are on now (or were on, prior to installing a dev) and the one set in the code is what will become. It’s used for all manner of things, like allowing us to work on the dev release and so we know when to offer upgrade information, and for setting the correct version after upgrade.

The -dev suffix allows us a free pass while testing without having to keep refreshing things or running update by hand. And if we switch to non-dev too soon we get a packaging error and invalidate the version, which has happened before.

In short, don’t dick with it:-)

  • Test the $prefs if you want to know which stable version you’re actually on.
  • Use the, now-badly-named global $txp_using_svn to determine if you’re in development.
  • Test the $txp_version@ and discard any suffix after the hyphen if you want to known what version this purports to become.
  • Better still, feature test by checking if classes exist and stuff prior to executing any code that’s not in the current stable release.

Does that help at all?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2016-05-27 13:03:38

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: TXP 4.6 version mismatch

Bloke wrote #299320:

Does that help at all?

Yes it does, thanks, and as it turns out I’m using your fourth suggestion (test for the existence of an object) to do what I have to do. However, I’m not sure if testing for the presence of something is a reliable way of indicating what version we’re dealing with – e.g. get_prefs() exists in both 4.5 & 4.6 but behaves differently between the two.

Also, am I correct in saying what we’ve got is an admin side that can supply the full information but a public side that can only tell us half the story. For consistency, could the txp_version constant be made available on the public side?

Offline

Board footer

Powered by FluxBB