For the first example, you need to 1. clear the compiled Smarty templates cache. In the second case you need to 2. rebuild the menu system using your xml file. 3. There are some db cache tables you sometimes need to clear out using mysql or a link in the UI. 4. Caching in the CMS can also affect CiviCRM pages.
- a) One way to do this is to go to Admin > System Settings > Cleanup Caches and Update Paths (civicrm/admin/setting/updateConfigBackend?reset=1), then click Save.
b) A more convenient method during development is to be able to append arguments to the url you are debugging to have the cleanup done automatically. Go to Administer > System Settings > Debugging and Error Handling.
Click to Enable Debugging. At this point you can add a key-value pair to your URLs to clear the compiled Smarty file cache under templates_c, and also if you want the upload file directory:
Directory Cleanup -Empties template cache and/or temporary upload file folders.
To empty template cache (civicrm/templates_c folder), add &directoryCleanup=1
To remove temporary upload files (civicrm/upload folder), add &directoryCleanup=2
To cleanup both, add &directoryCleanup=3
You might also want reset the session, since that caches various values:
Session Reset - Resets all values in your client session. To trigger, add &sessionReset=2
- a) Enter the appropriate one of the following urls to rebuild the menu system, which also clears various caches:
Drupal sites: http:///index.php?q=civicrm/menu/rebuild&reset=1
Joomla 1.5 sites: http:///administrator/index2.php?option=com_civicrm&task=civicrm/menu/rebuild&reset=1
Joomla 1.6 sites: http:///administrator/index.php?option=com_civicrm&task=civicrm/menu/rebuild&reset=1
Wordpress sites: http:///wp-admin/admin.php?page=CiviCRM&q=civicrm/menu/rebuild&reset=1
This action also resets the IDS (intrusion detection system) file.
b) As explained in @Tim Otten's answer, this can be done conveniently from the commandline as well, using a better named wrapper for the same actions:
In Civi-Drupal, the analogous command is:
$ drush cvapi system.flush
In Civi-Wordpress, it's:
$ wp civicrm api system.flush .
Or alternatively, in Firebug's CLI: CRM.api3('system','flush'))
- There are other sorts of caches that may occasionally need to be reset.
a) At Contacts > Manage Groups, it is possible to reset the caches for contacts that are in Smart Groups by clicking near the top left of the page the Update Smart Group Counts link.
b) More generally, depending on the area of CiviCRM you are working on you may need to truncate any of the CiviCRM tables that have cache in their name:
mysql> show tables like '%cache%';
+-------------------------------------+
| Tables_in_clubcdn_civ_new (%cache%) |
+-------------------------------------+
| civicrm_acl_cache |
| civicrm_acl_contact_cache |
| civicrm_cache |
| civicrm_group_contact_cache |
| civicrm_prevnext_cache |
+-------------------------------------+
5 rows in set (0.00 sec)
Use TRUNCATE civicrm_acl_cache; or similar queries on the command line or in phpMyAdmin to clear these tables.
- CMSes have their own caches that can often cause grief when developing in CiviCRM. For example, in Drupal 7, go to Configuration > and in Development set of modules click on Performance. Click to purge the caches. You might also want to disable caching of pages for anonymous users, caching of blocks, and / or aggregrating and compressing css and javascript files.