Published
Wednesday, February 27, 2008 - 09:46
Written by

This article covers - how to install CiviCRM v2.0 on Joomla 1.5 without Legacy support. It also provides some insight into the way components are organized and accessed through Joomla.

This post is intended as exploratory and to help push things forward towards 1.5 compatibility which is planned for the 2.1 release. Please note that CiviCRM 2.0 is officially NOT COMPATIBLE with Joomla 1.5 and that the CiviCRM team will not provide support for folks trying to run this combination.

 

For Joomla, CiviCRM is nothing but a component. When the component is loaded from the front end (doesn't require admin login), Joomla looks for a file with the component's name ending in .php file (civicrm.php in this case). Similarly if the component is loaded from the back end (admin area), Joomla looks for a file with the name like admin.componentName.php (admin.civicrm.php in our case).

If you extract the CiviCRM tarball, you can see both the files present in the list:

 admin.civicrm.php  civicrm/  civicrm.html.php  civicrm.php  civicrm.xml  configure.php  install.civicrm.php  toolbar.civicrm.php  uninstall.civicrm.php

 

XML component installation files

  • For the most part, XML component installation files for Joomla 1.5 are similar to the ones used in 1.0. For the installation and uninstallation queries, the SQL is now migrated to external files, with the flexibility of including different SQL files for different database types.

    And since, CiviCRM handles all the installation and un-installation operations from configure.php, which is called via admin.civicrm.php (in 2.0), limited set of changes are required in civicrm.xml file.

    Changes required in civicrm.xml file

    1. Replace tags <mosinstall> and </mosinstall> with <install> and </install> tags respectively.

    2. Add version attribute to <install> tag, for e.g <install type="component" version=”2.0”>

  • The back-end code is now sorted into a separate folder that you can specify in the folder parameter of the <files> tag in the <administration> section.

    Changes required in CiviCRM package structure: 1. Create a new directory say admin, where we should move the back-end code. So the new package structure would look like:

     admin/  civicrm.html.php  civicrm.php  civicrm.xml

    Where listing of admin directory would display:

     admin.civicrm.php  civicrm/  configure.php  install.civicrm.php  toolbar.civicrm.php  uninstall.civicrm.php

    Changes required in civicrm.xml file The following section: <administration> .... .... <files> <filename>admin.civicrm.php</filename> <filename>toolbar.civicrm.php</filename> <filename>install.civicrm.php</filename> <filename>uninstall.civicrm.php</filename> <filename>configure.php</filename> . . . . . . . . . . . . </files> .... .... </administration>

    Should now look like : <administration> .... .... <files folder=”admin”> <filename>admin.civicrm.php</filename> <filename>toolbar.civicrm.php</filename> <filename>install.civicrm.php</filename> <filename>uninstall.civicrm.php</filename> <filename>configure.php</filename> . . . . . . . . . . . . </files> .... .... </administration>

 

Security fixes

  • Joomla 1.5 no longer support accessing variables like $mosConfig_absolute_path, $mosConfig_user through global environment, for e.g :   include( $mosConfig_absolute_path . '/components/com_yourcomponent/yourcomponent.class.php' );

    And rather encourages to use constants like:

      define( 'YOURBASEPATH', dirname(__FILE__) );   require_once( YOURBASEPATH . '/file_to_include.php' );

    Joomla 1.5 now allows access to these variables through object of JConfig class. Refer http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tips:mak... for details.

  • Changes in admin.civicrm.php file After applying changes, the following lines :

     if ( ! file_exists( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'civicrm.settings.php' ) ) {   global $mosConfig_absolute_path;   $path =    $mosConfig_absolute_path . DIRECTORY_SEPARATOR .    'administrator' . DIRECTORY_SEPARATOR .    'components' . DIRECTORY_SEPARATOR .    'com_civicrm' . DIRECTORY_SEPARATOR ;   require_once $path . 'configure.php';  }

    would look like :

     define( 'COM_PATH', dirname(__FILE__) );  if ( ! file_exists( COM_PATH . DIRECTORY_SEPARATOR . 'civicrm.settings.php' ) ) {   require_once COM_PATH . DIRECTORY_SEPARATOR . 'configure.php';  }

  • Similarly for file configure.php, the following lines:

     global $mosConfig_user, $mosConfig_password, $mosConfig_host, $mosConfig_db;  $dsn = 'mysql://' .   $mosConfig_user . ':' .   $mosConfig_password . '@' .   $mosConfig_host . '/' .   $mosConfig_db .   '?new_link=true';

    would look like:

     $jConfig = new JConfig( );  define( 'DSN', 'mysql://' .   $jConfig->user . ':' .    $jConfig->password . '@' .    $jConfig->host . '/' .    $jConfig->db .    '?new_link=true' );

  • The corrected version of both the files - admin.civicrm.php and configure.php, can be seen at : admin.civicrm.php, configure.php

 

After having changed these three files - admin.civicrm.php, configure.php and civicrm.xml, we are ready with the package which can be installed on Joomla 1.5, without legacy support. Also make sure variable '$live_site' is set in joomla/configuration.php before you begin with the installation.

 

Note: All The changes shown, are the minimal set of changes required to install CiviCRM without legacy support. There could be many improvements, most of which is expected to be seen with CiviCRM v2.1.

 

Filed under

Comments

I am so psyched, thanks so much for documenting this!

Elin

Thanks for that, worked straight up!

your corrected version of configure.php appears significantly different than the configure.php included in the 2.0.2 zip for Joomla, so I am a little lost on that last correction. Is this for a previous version of 2.0? Thanks!!

Don't think configure.php has gone under any changes in v2.0 sub-revisions (2.0.x).
So should work for any 2.0.x version as long as there hasn't been any changes in the file

Significant changes are result of avoiding the use of global. Check http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tips:mak... for more details.

I installed on Joomla 1.5.6 the current civiccrm-2.1-beta3 today. All went smooth using the install via upload of the zip file. I have done a very quick looksee of the component home/admin and done a few prelims as shown in install instructions, all seems aok. I am certainly not a developer, just a very avg user yet it installed nicely. This is a very good thing of which you should be proud. I wonder if there is any other tutorial instead of the tutorial videos? My system doesn't show them at all, just a blank screen? hmmm? I would appreciate info on developing civimembers mostly as I begin to learn it.
thanks much,
PapaLion