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

Diff of /contributions/modules/civicrm_error/civicrm_error.install

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

revision 1.1, Fri Jul 20 15:44:34 2007 UTC revision 1.1.4.1, Tue Jun 30 13:47:06 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  // $Id$  // $Id: civicrm_error.install,v 1.1 2007/07/20 15:44:34 dalin Exp $
4    
5    /**
6     * @file
7     * Install file for civicrm_error module
8     */
9    
10    
11  /**  /**
12   * Implementation of hook_install().   * Implementation of hook_install().
13   */   */
14  function civicrm_error_install() {  function civicrm_error_install() {
15    civicrm_error_config(true);    civicrm_error_config(TRUE);
16  }  }
17    
18  /**  /**
# Line 17  function civicrm_error_uninstall() { Line 23  function civicrm_error_uninstall() {
23    civicrm_error_config(false);    civicrm_error_config(false);
24  }  }
25    
26  function civicrm_error_config($setup = true) {  function civicrm_error_config($setup = TRUE) {
27    global $db_url;    global $db_url;
28    if (is_array($db_url) && isset($db_url['civicrm'])) {    if (is_array($db_url) && isset($db_url['civicrm'])) {
29      db_set_active('civicrm');      db_set_active('civicrm');
30      $domains = db_result(db_query('SELECT COUNT(id) FROM civicrm_domain'));      $domains = db_result(db_query('SELECT COUNT(id) FROM civicrm_domain'));
31      if ($domains = 1) {      if ($domains = 1) {
32        $config = unserialize(db_result(db_query('SELECT config_backend FROM civicrm_domain WHERE id = 1')));        $config = unserialize(db_result(db_query(
33            'SELECT config_backend FROM civicrm_domain WHERE id = 1')));
34        if (array_key_exists('fatalErrorHandler', $config)) {        if (array_key_exists('fatalErrorHandler', $config)) {
35          $config['fatalErrorHandler'] = ($setup ? 'civicrm_error_handler' : null);          $config['fatalErrorHandler'] = ($setup ? 'civicrm_error_handler' : NULL);
36          /** TODO: this royal screws things up.  Need to fix **/          /** TODO: this royally screws things up.  Need to fix **/
37  //         db_query('UPDATE civicrm_domain SET config_backend = "$s" WHERE id = 1', serialize($config));  //         db_query('UPDATE civicrm_domain SET config_backend = "$s" WHERE id = 1', serialize($config));
38          $fail = true;          $fail = TRUE;
39        }        }
40        else {        else {
41          $fail = true;          $fail = TRUE;
42        }        }
43      }      }
44      else {      else {
45        $fail = true;        $fail = TRUE;
46      }      }
47      db_set_active();      db_set_active();
48    }    }
49    else {    else {
50      $fail = true;      $fail = TRUE;
51    }    }
52    if ($fail) {    if ($fail) {
53      $not = !$setup ? 'not ' : '';      $not = !$setup ? 'not ' : '';
54      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')));      drupal_set_message(t("Unable to set CiviCRM to {$not}use the custom error handler.
55          Please go to %path and set %param to %value",
56          array(
57            '%path' => 'Administer CiviCRM » Global Settings » Debugging',
58            '%param' => 'Fatal Error Handler', '%value' => 'civicrm_error_handler'
59          )
60        ));
61    }    }
62    else {    else {
63      drupal_set_message(t('CiviCRM Error Handler Installed'));      drupal_set_message(t('CiviCRM Error Handler Installed'));

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.4.1

  ViewVC Help
Powered by ViewVC 1.1.2