Skip to content

Instantly share code, notes, and snippets.

@totten
Created August 5, 2023 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save totten/e983d23439addeb7f76b0d7f52679031 to your computer and use it in GitHub Desktop.
Save totten/e983d23439addeb7f76b0d7f52679031 to your computer and use it in GitHub Desktop.
Print a notice every time `Civicrm` is instantiated. (Each has its own value of `$initialized`.)
commit beb16c771a2694a2d5cc53005ea77ebfc9dd51be (HEAD -> master-too-much-init)
Author: Tim Otten <totten@civicrm.org>
Date: Fri Aug 4 23:28:05 2023 -0700
(DEBUG) Print initialization message
diff --git a/src/Civicrm.php b/src/Civicrm.php
index 5177177..011c341 100644
--- a/src/Civicrm.php
+++ b/src/Civicrm.php
@@ -17,6 +17,12 @@ class Civicrm {
*/
protected $initialized = FALSE;
+ public function __construct() {
+ static $id = 0;
+ $id++;
+ fprintf(STDERR, "%s init # %d\n", __CLASS__, $id);
+ }
+
/**
* Initialize CiviCRM.
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment