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) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Joomla CRON jobs broken on J3.3
Pages: [1]

Author Topic: Joomla CRON jobs broken on J3.3  (Read 2095 times)

combrains

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 2
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 3.1.x
  • MySQL version: 5.1.44
  • PHP version: 5.3.1
Joomla CRON jobs broken on J3.3
May 04, 2014, 03:04:03 pm
Hi Team,

After upgrading to Joomla 3.3, I now receive the following error from PHP when attempting to run cron jobs via the CLI:

Code: [Select]
PHP Fatal error: Class 'JRegistry' not found in <site root>/libraries/joomla/factory.php.

Speaking to the good folks over on the Joomla forum, it appears that the JRegistry class no longer exists, due to changes in the Joomla framework introduced in J3.3.  It would seem that all is needed is some small changes to the way Joomla is bootstrapped in Civi.  See my forum post on the Joomla forums for the full details : http://forum.joomla.org/viewtopic.php?f=708&t=844417&p=3170417#p3170417

I'm not enough of a coder to be able to code a patch, but I'm happy to test on my own site if someone is happy to code one.

Cheers

cvoogt

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.1.4
  • CMS version: Joomla 1.5.25
  • MySQL version: 5.0.92
  • PHP version: 5.2.17
Re: Joomla CRON jobs broken on J3.3
May 08, 2014, 07:09:56 pm
I searched through the CiviCRM code but couldn't figure out where it bootstraps Joomla. If you could enlighten me, I'd be happy to try my hand at fixing the JRegistry issue.

combrains

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 2
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 3.1.x
  • MySQL version: 5.1.44
  • PHP version: 5.3.1
Re: Joomla CRON jobs broken on J3.3
May 08, 2014, 07:26:50 pm
This from one of the Joomla Devs:

Quote
The old class is removed, however, for backward compatibility we added class name aliases to the application bootstrap so that references to JRegistry point to the newer class name.

When writing your scripts, I would highly encourage you to add this snippet to your files:

include <root>/libraries/import.legacy.php;
include <root>/libraries/cms.php;


That will load up the full API into the system the same way the main CMS does. I'd also suggest taking a look at the other scripts in the cli/ folder to see how we launch things up.

I had a look through the Civi code, and from what I can see, all of the bootstrapping is handled by the file <root>/administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php

Towards the bottom of this file is a function called 'loadJoomlaBootstrap' where wyou will find this block of code:

Code: [Select]
// Get the framework.
    if (file_exists($joomlaBase . '/libraries/import.legacy.php')) {
      require $joomlaBase . '/libraries/import.legacy.php';
    }

I the added another block underneath that to include <root>/libraries/cms.php from the Joomla framework:

Code: [Select]
if (file_exists($joomlaBase . '/libraries/cms.php')) {
      require $joomlaBase . '/libraries/cms.php';
    }

This is the file that contains pointers from the old legacy classes that Civi uses, to the new classes used by J3.3.  As I said, this is a hack, and Civi really needs to be updated to use the new classes, but this works for now - in the medium term.

Hope this helps.  If anyone has a better fix, please feel free to share.  Also, can anyone submit a tracker item for this?

Cheers
« Last Edit: May 10, 2014, 06:16:54 am by combrains »

cvoogt

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.1.4
  • CMS version: Joomla 1.5.25
  • MySQL version: 5.0.92
  • PHP version: 5.2.17
Re: Joomla CRON jobs broken on J3.3
May 09, 2014, 07:53:41 am
Thanks combrains, that did the trick! I created an issue for this in the issue tracker; https://issues.civicrm.org/jira/browse/CRM-14671. I copy-pasted much of what you wrote in your last post, but corrected the path of the file, which is /administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php for anyone else trying to implement this fix (note the /civicrm folder).

combrains

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 2
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 3.1.x
  • MySQL version: 5.1.44
  • PHP version: 5.3.1
Re: Joomla CRON jobs broken on J3.3
May 10, 2014, 06:17:32 am
Glad to hear it worked for you.  Updated the path in my post.

Cheers

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Joomla CRON jobs broken on J3.3

This forum was archived on 2017-11-26.