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) »
  • Adding a new payment processor type (class) to an existing extension
Pages: [1]

Author Topic: Adding a new payment processor type (class) to an existing extension  (Read 812 times)

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Adding a new payment processor type (class) to an existing extension
August 24, 2014, 07:03:18 am
Payment processor types are stored in a table, and presumably there's a function in the extension management area that will add the new row(s) to the table, when an extension with a payment processor is enabled.

But there's some missing magic when another payment processor type is added to an existing extension - some kind of upgrade function will need to be triggered to do that insertion.

Anyone know what the right invocation should be? I'm okay adding it in manually with the hook_upgrade, I was just wondering if anyone's done this before and if there's a nice elegant way that the extension manager code is already using.

I'm guessing from this comment (https://civicrm.org/comment/7197#comment-7197) that xavier already knows the answer and it involves managed entities ...
« Last Edit: August 24, 2014, 07:06:39 am by adixon »

KarinG

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
  • CiviCRM version: 4+
  • CMS version: Drupal 6 / 7
  • MySQL version: MariaDB
  • PHP version: 5.3/5.4/5.5
Re: Adding a new payment processor type (class) to an existing extension
August 24, 2014, 02:12:18 pm
Swapping old code base for new code base (with the additional payment processor in the hook_civicrm_managed(&$entities) - then hitting disable -> then enable works to get CiviCRM to see the new processor [I tried clearing all sorts of caches but no joy until the disable -> enable]. During an actual upgrade from the manage extensions screen I anticipate that this will work as is - sweet - very sweet.


Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Adding a new payment processor type (class) to an existing extension
August 24, 2014, 07:33:57 pm
the api function system.flush (e.g. drush cvapi system.flush) trigger this refresh I think (although it might take a param)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Adding a new payment processor type (class) to an existing extension
August 24, 2014, 08:43:09 pm
Yeah, the thing is to do a system-flush (which can be achieved by calling the System.flush API; by visiting /civicrm/clearcache; or by toggling an extension). It may be faster to execute "CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();", but the use-case hasn't been tried as much.

FWIW, there's a related issue/patch/IRC-discussion for v4.5: https://issues.civicrm.org/jira/browse/CRM-14871 (The issue has been lingering as open b/c it causes a tangential test fail, but I'm fairly sure that's a problem in the test-suite and not in the runtime.)

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Adding a new payment processor type (class) to an existing extension
September 10, 2014, 06:16:46 am
When I try this (either via the url or in an update function), i get an error "already exists".

When I look at my file error log, it seems to be trying to re-add the existing payment processors of this extension, not just the ones that are new.

Is that more likely to be a messed up database of mine, or does this code presume only one payment processor per extension perhaps?

Going in for a deep dive now ...

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Adding a new payment processor type (class) to an existing extension
September 10, 2014, 06:53:02 am
Happy news - it was indeed a messed up database, now fixed. I caused it because the original extension name was changed at some point (because the github repository changed ownership), and instead of deleting and recreating, I manually changed some entries, but missed it in the managed_entities table.

After updating those fields, the cacheclear url worked fine.

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Adding a new payment processor type (class) to an existing extension
September 10, 2014, 11:48:24 am
Glad you figured it out!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Adding a new payment processor type (class) to an existing extension

This forum was archived on 2017-11-26.