Skip to content

Instantly share code, notes, and snippets.

totten /
Last active June 13, 2019 18:39
Quick and Dirty Intro to Civi CI

Quick and Dirty Intro to Civi CI


I find it easiest to consider the stack in three layers:

  • Host Environment or System Platform: Loosely, this is the collection of MySQL, Apache, PHP, NodeJS, and so on. These system-services and language-runtimes are provided in many distribution channels (e.g. Debian, Ubuntu, CentOS, RHEL, nix, MAMP, XAMPP, Bitnami, Docker, etc).
totten / front-bench.php
Last active January 23, 2019 21:27
Comparing performance of different front-caches
// Total number of times to take measurements.
$trialCount = 3;
// Number of items to write when filling the cache
$writeItems = 1000;
// Number of items to read from the cache.
$readItems = 200;


  • Data Parititioning
    • Unitary/Unpartitioned/Shared: All data from the different sites are mutually accessible.
    • Key-based Partition: The data for all sites are stored in the same DB/table/schema. However, there is a column (eg domain_id) to distinguish them.
    • Schema-based Partition: The data for all sites are stored in separate DB/table/schema.
  • Code Partitioning
    • Unitary/Unpartitioned/Shared: The same code is used for all the sites.
    • Partitioned: Each site has different code.
totten /
Last active October 25, 2017 21:02 — forked from seancolsen/
CiviCRM Review Template SUBLIST-1.0


(Move each criterion that you evaluate into "Passing" or "Failing". Add comments describing any failures.)

  • Not evaluated
    • A JIRA ticket is mentioned (or not needed) (r-jira)
    • The automated tests pass (r-test)
    • The code looks good (r-code)
    • It works as advertised (r-run)
    • Users will be able to transition to this change easily (r-users)
totten / 1-packages.txt
Last active July 17, 2017 19:55
Example listing of hard-coded references to key dirs
$ svngrep packages/ CRM/ api Civi templates/
CRM/Contact/Form/Search.php: ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)
CRM/Contact/Form/Search.php: ->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header');
CRM/Core/BAO/RecurringEntity.php:require_once 'packages/When/When.php';
CRM/Core/ClassLoader.php: $file = dirname(__FILE__) . '/../../packages/IDS/vendors/htmlpurifier/HTMLPurifier/Bootstrap.php';
CRM/Core/CodeGen/Util/Smarty.php: $smarty->plugins_dir = array("$base/packages/Smarty/plugins", "$base/CRM/Core/Smarty/plugins");
CRM/Core/IDS.php: filter_path = {$civicrm_root}/packages/IDS/default_filter.xml
CRM/Core/Resources.php: "packages/jquery/plugins/jquery.mousewheel.min.js",
CRM/Core/Resources.php: "packages/jquery/plugins/jquery.form.min.js",
CRM/Core/Resources.php: "packages/jquery/plugins/jquery.timeentry.min.js",
totten /
Last active February 16, 2021 14:27
An Opinionated Hierarchy of Unified Page Architectures (OHUPA)

An Opinionated Hierarchy of Unified Page Architectures (OHUPA)

OHUPA is a classification scheme for page/form/layout/composition-systems. The main concern of OHUPA is how much your ecosystem relies on you to provide clear, stable, high-quality components.

Table of Contents

  • Context
  • Level 0: Non-Componentized
  • Level 1: Component-Oriented; Component-Library
  • Level 2: Developer Customization (e.g Hook, Selector)
totten / resolve-all-files.php
Last active August 16, 2016 23:28
Test performance of file-lookups
// Locate all PHP files, one-by-one, using smarty_core_get_include_path().
// Display the total runtime.
// usage: cv scr resolve-all-files.php
// The number of times to fetch each file.
$trials = 100;
totten /
Created January 16, 2016 05:09
Page-oriented site customization workflow


  • Gum: A notation for diff'ing and merging HTML documents. (Normal line-oriented diffs are prone to gratuitious merge-conflicts when moving or reindenting code. Gum handles these changes explicitly, but it requires that every HTML node have a unique ID.)
  • Page: A broad HTML document that describes the major elements of the screen. A page is an amalgamation that merges together preferences from multiple sources (e.g. the original/upstream page, the local configuration, the active extensions). (Civi Examples: "View Contact", "Event Registration", "Contribution Page", "New Mailing".)
  • Component: A widget, input, or layout element that can be used within a page. Components look like special HTML tags or attributes. (Angular 1.x Directives, Angular 2.x Components, WebComponents, and Bootstrap CSS would all be examples.) (Civi Examples: "API Field", "Name block", "Billing block", "Emails block")
  • Well-formed page: A page with an open-ended vocabulary of tags, attributes, class
diff --git a/Civi/API/Kernel.php b/Civi/API/Kernel.php
index 9d85508..85c5976 100644
--- a/Civi/API/Kernel.php
+++ b/Civi/API/Kernel.php
@@ -50,6 +50,12 @@ class Kernel {
protected $apiProviders;
+ * @var array
+ * Stack of pending API requests.
// Currently going to outputs:
// Proposed new output (B)
{version: "4.4.0"},
{version: "4.4.1"},
{version: "4.4.2", security: true}
{version: "4.5.0"},
{version: "4.5.1"},