/[drupal]/contributions/modules/civicrm_error/civicrm_error.install
ViewVC logotype

Contents of /contributions/modules/civicrm_error/civicrm_error.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Fri Jul 20 15:44:34 2007 UTC (2 years, 4 months ago) by dalin
Branch: MAIN
CVS Tags: DRUPAL-5--1-1, DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
File MIME type: text/x-php
Initial commit of civicrm_error module.  Will send you a detailed backtrace of civicrm errors in an email.
1 <?php
2
3 // $Id$
4
5 /**
6 * Implementation of hook_install().
7 */
8 function civicrm_error_install() {
9 civicrm_error_config(true);
10 }
11
12 /**
13 * Implementation of hook_uninstall().
14 */
15 function civicrm_error_uninstall() {
16 variable_del('civicrm_error_to');
17 civicrm_error_config(false);
18 }
19
20 function civicrm_error_config($setup = true) {
21 global $db_url;
22 if (is_array($db_url) && isset($db_url['civicrm'])) {
23 db_set_active('civicrm');
24 $domains = db_result(db_query('SELECT COUNT(id) FROM civicrm_domain'));
25 if ($domains = 1) {
26 $config = unserialize(db_result(db_query('SELECT config_backend FROM civicrm_domain WHERE id = 1')));
27 if (array_key_exists('fatalErrorHandler', $config)) {
28 $config['fatalErrorHandler'] = ($setup ? 'civicrm_error_handler' : null);
29 /** TODO: this royal screws things up. Need to fix **/
30 // db_query('UPDATE civicrm_domain SET config_backend = "$s" WHERE id = 1', serialize($config));
31 $fail = true;
32 }
33 else {
34 $fail = true;
35 }
36 }
37 else {
38 $fail = true;
39 }
40 db_set_active();
41 }
42 else {
43 $fail = true;
44 }
45 if ($fail) {
46 $not = !$setup ? 'not ' : '';
47 drupal_set_message(t("Unable to set CiviCRM to {$not}use the custom error handler. Please go to %path and set %param to %value", array('%path' => 'Administer CiviCRM » Global Settings » Debugging', '%param' => 'Fatal Error Handler', '%value' => 'civicrm_error_handler')));
48 }
49 else {
50 drupal_set_message(t('CiviCRM Error Handler Installed'));
51 }
52 }

  ViewVC Help
Powered by ViewVC 1.1.2