Skip to content

Instantly share code, notes, and snippets.

@totten
totten / 1-current.txt
Created August 21, 2014 22:59
Pseudocode for demo rebuilds
foreach $demosite
mark $demosite offline
civibuild destroy $demosite
civibuild create $demosite
mark $demosite online
// Currently going to latest.civicrm.org/stable.php outputs:
4.5.2
// 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"},
@totten
totten / LoggerInterface.php
Created November 20, 2012 19:59 — forked from Seldaek/LoggerInterface.php
LoggerInterface PSR Proposal (with fluent options)
<?php
namespace PSR\Log;
/**
* Describes a logger instance
*
* The $message MUST be a string.
* The $message MAY contain variable expressions like "%var%" which reference $data.
* The $message SHOULD NOT include runtime data using plain string concatenation.
@totten
totten / LoggerInterface.php
Created November 24, 2012 19:45 — forked from Seldaek/LoggerInterface.php
LoggerInterface PSR Proposal
<?php
namespace PSR\Log;
/**
* Describes a logger instance
*
* The $message MUST be a string.
* The $message MAY contain variable expressions like "%var%" which reference $data['var'].
* The "%var%" notation MUST NOT reference values of nested arrays (eg no "%parent.child%" notation).
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.
@totten
totten / workflow.md
Created January 16, 2016 05:09
Page-oriented site customization workflow

Concepts:

  • 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
@totten
totten / resolve-all-files.php
Last active August 16, 2016 23:28
Test performance of file-lookups
<?php
// 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
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
totten / civicrm-review-template-sublist-1.0.md
Last active October 25, 2017 21:02 — forked from seancolsen/civicrm-review-template-sublist-1.0.md
CiviCRM Review Template SUBLIST-1.0

Checklist

(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)

Definitions

  • 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.