CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • How to test the version/handle incompatibilities?
Pages: [1]

Author Topic: How to test the version/handle incompatibilities?  (Read 388 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
How to test the version/handle incompatibilities?
February 05, 2014, 03:04:21 am
Hi,

the field name civicrm_contribution_recur.next_sched_contribution has been renamed next_sched_contribution_date (between 4.3 and 4.4?)

When it's a small change like that, I'm tempted to keep the two versions in the same branch and add a test to decide the field name to use

what's the best method (ie. one that if fast and doesn't introduce a new db request) to check the version?

The functions I found are around the upgrade progress but not sure if they are deemed stable to be used from extensions, and I didn't find an api.

and comparing versions might be tricky ("3.4.10" > "3.4.2") having a function to use would avoid doing it by hand here and there
X+

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: How to test the version/handle incompatibilities?
February 05, 2014, 04:47:34 am
There are two ways to determine the current version:

 * CRM_Utils_System::version()
 * CRM_Core_BAO_Domain::version()

At runtime, these two should return the same thing -- they only differ if you're upgrading civicrm-core (or if your core upgrade failed). During the core upgrade process, CRM_Utils_System reports the version of the new code, and CRM_Core_BAO_Domain reports the version of the old DB schema. In terms of forward-compatibility and performance, it's hard to say... but I'd probably go with CRM_Utils_System.

For comparing versions, see http://php.net/version_compare
« Last Edit: February 05, 2014, 04:50:40 am by totten »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • How to test the version/handle incompatibilities?

This forum was archived on 2017-11-26.