CiviCRM: Difference between revisions

No edit summary
use Subpages template
 
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
{{#ev:vimeo|192125770}}
{{#ev:vimeo|192125770}}


== Subpages ==
{{Subpages|}}
There are several articles that delve into the specific aspects of CiviCRM
{{#subpages:}}


== Documentation ==
== Documentation ==
Line 55: Line 53:


== Upgrading ==
== Upgrading ==
There is a long guide on [http://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Drupal+7 how to upgrade CiviCRM for drupal]  
[[{{PAGENAMEE}}/upgrade]]


You should be familiar with all the steps described in the manual, and understand how the particular steps impact/affect your installation.  The short version below is known to work with our setup, and with 'routine' upgrades.
== Debugging and the CV command-line ==


Here is the short version:
If you have your CiviCRM sending errors to the Drupal Watchdog Log (CiviCRM Administer > System Settings > [https://equality-tech.com/civicrm/admin/setting/debug?reset=1 Debugging and Error Handling]), you can simply navigate to it in the Drupal Admin (Reports > [https://equality-tech.com/admin/reports/dblog Recent log messages])
# backup your database(s) <code>sudo ~/bin/backup.db.sh drupal</code> <code>sudo ~/bin/backup.db.sh civicrm</code> <ref>[[Mysqldump]]</ref>
# download the code <code> wget https://download.civicrm.org/civicrm-4.6.5-drupal.tar.gz</code>
# put site in maintenance mode<code>drush vset maintenance_mode 1</code> (Make sure you are also logged in as Admin)
# move old code, and unpack new code <code>mv civicrm /tmp/ && tar xvzf civicrm-4.6.5-drupal.tar.gz</code>
# run the upgrade script <code>/civicrm/upgrade?reset=1</code>
# put site in operation mode<code>drush vset maintenance_mode 0</code>
# toast


The even shorter version is to use [[drush]] <code>civivcrm-upgrade</code> does all the above for you.
== Debugging ==
There are many tools you can use to debug your CiviCRM instance.
There are many tools you can use to debug your CiviCRM instance.
One of these is the <code>cv</code> tool [https://github.com/civicrm/cv available on Github].
One of these is the <code>cv</code> tool [https://github.com/civicrm/cv available on Github].
Line 140: Line 128:


<blockquote>
<blockquote>
Custom tokens (based on custom data) can be added for organizations as well. These tokens will not be displayed in the list of available tokens, but can be added manually. The format is {contact.custom_12} where 12 is the ID of the custom data field. To find the custom data field ID, go Administer > Customize Data & Screens > Custom Fields and click on the field you want to use. Look at the URL. The last part of the URL will be an equal sign and a number (=12). The number (12 in this example) is the id of that custom field.
Custom tokens (based on custom data) can be added for organizations as well. These tokens will not be displayed in the list of available tokens, but can be added manually. The format is {contact.custom_12} where 12 is the ID of the custom data field. To find the custom data field ID, go Administer > Customize Data & Screens > Custom Fields and click �edit� on the field you want to use. Look at the URL. The last part of the URL will be an equal sign and a number (=12). The number (12 in this example) is the id of that custom field.
</blockquote>
</blockquote>


You can create your own tokens by implementing <code>hook_civicrm_tokens()</code> and  <code>hook_civicrm_tokenValues()</code>.  See  
You can create your own tokens by implementing <code>hook_civicrm_tokens()</code> and  <code>hook_civicrm_tokenValues()</code>.  See  
<source lang="php">
<syntaxhighlight lang="php">
<?php
<?php
/**
/**
Line 302: Line 290:
     }
     }
}
}
</source>
</syntaxhighlight>


* [https://civicrm.stackexchange.com/questions/2558/tokens-for-custom-field-set-with-multiple-records?rq=1 Stack Exchange]
* [https://civicrm.stackexchange.com/questions/2558/tokens-for-custom-field-set-with-multiple-records?rq=1 Stack Exchange]
Line 324: Line 312:
== Extensions ==
== Extensions ==
* See [https://civicrm.org/extensions/drupal listing of CiviCRM extensions for Drupal]
* See [https://civicrm.org/extensions/drupal listing of CiviCRM extensions for Drupal]
* [http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions Extensions documentation in the wiki]
* [https://docs.civicrm.org/sysadmin/en/latest/customize/extensions/#installing-a-new-extension  Installing extensions]
* [http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Custom-Search+Extension Create a Custom Search extension]
There are multiple ways to use the <code>cv</code> command to download and install extensions:
;Download a published extension from the directory (long name).
:<code>cv dl org.example.foobar</code>
;Download a published extension from the directory (short name).
:<code>cv dl foobar</code>
;Download an unpublished extension (long name and zip URL)
:<code>cv dl org.example.foobar@http://example.org/files/foobar-1.2.zip</code>
;Download a pre-release (alpha/beta) from the directory.
:<code>cv dl --dev foobar</code>
 
 


== Developing Extensions ==
== Developing Extensions ==
Line 347: Line 345:
== Database ==
== Database ==
The database code in CiviCRM is divided into two logical sections: the DAO and the BAO.  The BAO holds the "business logic" for objects and extends the DAO.  The DAO is concerned with data to/from the database backend and it's definition (object to relational database mapping, aka "[[wp:Object-relational mapping|ORM]]").  Both are an extension of the [https://pear.php.net/manual/en/package.database.db-dataobject.php PEAR DB DataObject] class.  As of August 2015, this is true and [https://civicrm.org/node/95 this blog post from 2006] gives some more (early) background.
The database code in CiviCRM is divided into two logical sections: the DAO and the BAO.  The BAO holds the "business logic" for objects and extends the DAO.  The DAO is concerned with data to/from the database backend and it's definition (object to relational database mapping, aka "[[wp:Object-relational mapping|ORM]]").  Both are an extension of the [https://pear.php.net/manual/en/package.database.db-dataobject.php PEAR DB DataObject] class.  As of August 2015, this is true and [https://civicrm.org/node/95 this blog post from 2006] gives some more (early) background.
<source lang="php">
<syntaxhighlight lang="php">
// from CRM/core/DAO.php
// from CRM/core/DAO.php


Line 353: Line 351:
require_once 'DB/DataObject.php'
require_once 'DB/DataObject.php'
class CRM_Core_DAO extends DB_DataObject
class CRM_Core_DAO extends DB_DataObject
</source>
</syntaxhighlight>
In 2009, [https://civicrm.org/node/597 Doctrine was proposed] as a OODB approach instead of an ORM.  There are [https://civicrm.org/blogs/dharmatech/data-mapper-pattern-civicrm-architecture-proposal other discussions too] in the "Architecture Series" that are worth reviewing if you want to know more about database development in CiviCRM.
In 2009, [https://civicrm.org/node/597 Doctrine was proposed] as a OODB approach instead of an ORM.  There are [https://civicrm.org/blogs/dharmatech/data-mapper-pattern-civicrm-architecture-proposal other discussions too] in the "Architecture Series" that are worth reviewing if you want to know more about database development in CiviCRM.