CiviCRM Architecture - CiviCRM directory structure

Publicado
2006-11-06 20:39
Written by
Dave Greenberg - member of the CiviCRM community - view blog guidelines
Make sure you read the Introduction Chapter of this series for a better understanding of the below. Developers might be interested in installing CiviCRM from our svn repository Some of the important directories under CiviCRM svn root are:
  • CRM: Most of the CiviCRM specific source code is stored in the directory. This directory is further sub-divided into other directories based on functionality (Core, Utils, Contact, Contribute, Mailing etc).
  • xml: CiviCRM schema and the base Data access objects (DAO) are automatically generated from a simplified xml scheme which contains a fair amount of sql and type information. This makes it relatively easy for us to change the sql code, figure out what changes were made in a version and add meta information to a table within PHP.
  • api: This directory implements the CiviCRM api functionality. We are moving towards a model where the api code is a thin wrapper around the core code in CRM
  • templates: All the smarty templates reside under this directory. This directory closely mirrors the CRM code directory. Most "destination" php pages refer to a corresponding template (tpl) file. This can be overwritten by the individual class using a virtual function
  • packages,tools: All the external packages reside in the packages directory. These include PEAR, Smarty, Dojo, PayPal SDK. amavisd resides in the tools directory.
  • drupal,joomla: CMS specific code is localized within these two directories. There are a few other system specific files which serve as the link between CiviCRM and a CMS (CRM/Utils/System/Drupal.php,CRM/Utils/System/Joomla.php, CRM/Core/Permission/Drupal.php,CRM/Core/Permission/Joomla.php)
  • distmaker: A set of scripts which generate the downloadable tar.gz packages. These scripts also take care of the php5 -> php4 conversion
  • test:Location for unit tests, web tests and selenium tests
  • extern: There are some php scripts that are called from "outside" the CMS. Examples include soap.php, ipn.php, open.php.
Filed under

Comments

1) thanks for doing this architecture series. It has answered a lot of questions about how it all works.

2) a couple questions/comments:

Is this description only for 1.6 & higher? I notice that the xml directory is absent from the 1.5 package I downloaded and installed (tar-zip). Also, directories like js and css aren't mentioned in this list.

In general, how does the CiviCRM module interact with the native themes?

Also, how does it interact with gerneral enabled site modules? For example, tinyMCE is enabled for basically all textarea form fields, but it won't work with CiviCRM textarea elements.

1. the description is pretty much applicable to all CiviCRM versions. Its more specific to the more recent versions obviously

2. we minimize what folks need to download. You can get the xml files directly from svn etc. You can learn more about this from the wiki page: installing from svn

3. js and css seemed a bit self explanatory :)

4. CiviCRM works with drupal and joomla, as such we minimize interaction with native themes and hence you dont see the same behavior as a native drupal module in some cases