Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Civix generated code #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seamuslee001
Copy link
Contributor

@bjendres

@a-cormick-dockery @johntwyman

@bjendres
Copy link
Member

bjendres commented May 13, 2024

@jaapjansma does this needlessly break compatibility with older CiviCRM versions?

Or even better: do you have a list of things to look out for or roll back to maintain compatibility? And if you do, may I add it to https://github.com/systopia/legacycode/blob/master/README.md?

@jaapjansma
Copy link

jaapjansma commented May 13, 2024

Yes it is two things.

  1. In the ext.civix.php there is a line of code with
    if ($entry{0} == '.') {

which needs to be replaced to

    if ($entry[0] == '.') {
  1. In the ext.civix.php the following lines
     if (is_array($template->template_dir)) {
        array_unshift($template->template_dir, $extDir);
      }
      else {
        $template->template_dir = array($extDir, $template->template_dir);
      }

Needs to be replaced with

     $template->addTemplateDir($extDir);

However a full Civix upgrade will make sure the extension works with the latest version of civicrm (and reduces boileplate code). The drawback is then it loses backwards compatibility. I have tested the lines above with an old CiviCRM installation 5.14 on php 7 and with CiviCRM 5.71 and PHP 8.

@bjendres
Copy link
Member

Yes it is two things.

Ah, ok, understood. But it's not as easy as running a full civix updgrade and then manually changing a few things back, right @jaapjansma?

@seamuslee001 does the civix upgrade add/enable features or compatibility that are important enough to drop support for older CiviCRMs?

@jaapjansma
Copy link

Indeed I avoid running civix upgrades. My solution is manual changes to the code. (I am in a mode that I try to avoid using Civix whenever possible, it gives me too much headache and work)

@bjendres
Copy link
Member

Indeed I avoid running civix upgrades. My solution is manual changes to the code. (I am in a mode that I try to avoid using Civix whenever possible, it gives me too much headache and work)

@seamuslee001 any reasons do that instead of the full civix upgrade?

@seamuslee001
Copy link
Contributor Author

@bjendres I prefer doing civix upgrades because I find it makes my extensions easier to manage and its more the recommended approach. Also as jaap points out it does reduce a bunch of unneded boilerplate.

Also at JMA we tend to be more closer with keeping CiviCRM closer to supported versions for our clients so we don't generally worry about versions back to 5.14 and such. I think our oldest CiviCRM versions is like 5.65 or something like that for our client sites.

The polyfill here should mean that you get mixin support but the :void or the :string may mean you don't support older versions of PHP7 but they should work fine on PHP7.3 and up. I haven't tried this on older versions of CiviCRM but I would have thought it should be fine because you don't need smarty stuff

@eileenmcnaughton
Copy link

eileenmcnaughton commented May 28, 2024

I don't actually use it but there is an OpenStreetMaps geocoder that ships with the geocoder extension - which is compatible with the latest CiviCRM / Smarty - so that could be an option for people who want to use up-to-date civi/Smarty/php

(ie I use the extension - but not that geocoder plugin)

@bjendres
Copy link
Member

@bjendres I prefer doing civix upgrades because I find it makes my extensions easier to manage and its more the recommended approach. Also as jaap points out it does reduce a bunch of unneded boilerplate [...] we tend to be more closer with keeping CiviCRM closer to supported versions for our clients

I understand and agree, but... I think we explained our situation various times: some of our larger clients have dozens of complex extensions to adjust CiviCRM to some European or specific workflows, so a CiviCRM upgrade is a massive endeavour for them. That's why try to keep these extensions as compatible as possible to not unnecessarily add to that complexity.

@bjendres
Copy link
Member

there is an OpenStreetMaps geocoder that ships with the geocoder extension

Interesting, I didn't know that.

@eileenmcnaughton
Copy link

I believe it works cos I get patches every now & then for it - although there is this open issue - might be a good sprint task for me to look at it

eileenmcnaughton/org.wikimedia.geocoder#61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants