| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
//////////////////////////////////////////////////////////////////////////////
|
| 5 |
// Core API hooks
|
| 6 |
|
| 7 |
/**
|
| 8 |
* Implementation of hook_enable().
|
| 9 |
*/
|
| 10 |
function trace_enable() {
|
| 11 |
trace_install();
|
| 12 |
drupal_set_message(t('Trace was successfully installed. Please review the available <a href="@settings">configuration settings</a>.', array('@settings' => url('admin/settings/trace'))));
|
| 13 |
}
|
| 14 |
|
| 15 |
/**
|
| 16 |
* Implementation of hook_install(). Installs the current version of the database schema.
|
| 17 |
*/
|
| 18 |
function trace_install() {
|
| 19 |
// Ensure that the module is the first one to be loaded upon bootstrap:
|
| 20 |
db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", -99, 'trace');
|
| 21 |
}
|
| 22 |
|
| 23 |
/**
|
| 24 |
* Implementation of hook_uninstall().
|
| 25 |
*/
|
| 26 |
function trace_uninstall() {
|
| 27 |
db_query("DELETE FROM {variable} WHERE name LIKE '%s_%%'", 'trace');
|
| 28 |
cache_clear_all('variables', 'cache');
|
| 29 |
}
|
| 30 |
|
| 31 |
//////////////////////////////////////////////////////////////////////////////
|
| 32 |
// Schema API updates
|
| 33 |
|
| 34 |
/**
|
| 35 |
* Implementation of hook_update_N(). Upgrades settings for PHP error tracing.
|
| 36 |
*/
|
| 37 |
function trace_update_6100() {
|
| 38 |
$old_value = variable_get('trace_errors', array());
|
| 39 |
if (!is_array($old_value)) {
|
| 40 |
$new_value = empty($old_value) ? array() : array('error', 'warning', 'notice');
|
| 41 |
$new_value = empty($new_value) ? $new_value : array_combine($new_value, $new_value);
|
| 42 |
variable_set('trace_errors', $new_value);
|
| 43 |
}
|
| 44 |
return array();
|
| 45 |
}
|