drupalmonitor_connector.install in Drupalmonitor 7
Installer file of drupalmonitor_connector module
File
drupalmonitor_connector.installView source
<?php
/**
* @file
* Installer file of drupalmonitor_connector module
*/
/**
* Implements hook_schema().
*/
function drupalmonitor_connector_schema() {
$schema['drupalmonitor_log'] = array(
'fields' => array(
'id' => array(
'type' => 'serial',
'length' => 15,
'not null' => TRUE,
),
'q' => array(
'type' => 'text',
'not null' => TRUE,
),
'dt' => array(
'type' => 'int',
'not null' => TRUE,
),
'memory' => array(
'type' => 'int',
'not null' => TRUE,
),
'execution_time' => array(
'type' => 'int',
'not null' => TRUE,
),
),
'primary key' => array(
'id',
),
);
return $schema;
}
/**
* Implements hook_enable().
*/
function drupalmonitor_connector_enable() {
variable_set('drupalmonitor_hash', md5(microtime() . 'drupalmonitorrocks_salt_666' . time()));
variable_set('drupalmonitor_performance_monitoring', 1);
variable_set('drupalmonitor_server_monitoring', 1);
variable_set('drupalmonitor_user_monitoring', 1);
variable_set('drupalmonitor_files_monitoring', 1);
variable_set('drupalmonitor_node_monitoring', 1);
variable_set('drupalmonitor_modules_monitoring', 1);
variable_set('drupalmonitor_variables_monitoring', 1);
variable_set('drupalmonitor_node_monitoring', 1);
user_role_grant_permissions(1, array(
'access drupalmonitor api',
));
$message = t("You need to create an account on !urldrupalmonitor in order to monitor your website. The sites security hash is @hash. You can configure Drupalmonitor Connector on the !configurl.", array(
'!urldrupalmonitor' => l(t('Drupalmonitor.com'), 'http://www.drupalmonitor.com'),
'@hash' => variable_get('drupalmonitor_hash'),
'!configurl' => l(t('configuration page'), 'admin/config/system/drupalmonitor'),
));
drupal_set_message(filter_xss($message));
}
/**
* Implements hook_uninstall().
*/
function drupalmonitor_connector_uninstall() {
variable_del('drupalmonitor_hash');
variable_del('drupalmonitor_memory_monitoring');
variable_del('drupalmonitor_performance_monitoring');
variable_del('drupalmonitor_server_monitoring');
variable_del('drupalmonitor_user_monitoring');
variable_del('drupalmonitor_files_monitoring');
variable_del('drupalmonitor_node_monitoring');
variable_del('drupalmonitor_modules_monitoring');
variable_del('drupalmonitor_variables_monitoring');
variable_del('drupalmonitor_node_monitoring');
}
/**
* Implementations of hook_update_N().
*/
/**
* Reload the menus so the two menu items will work again.
*/
function drupalmonitor_connector_update_7100() {
variable_set('menu_rebuild_needed', TRUE);
}
Functions
Name | Description |
---|---|
drupalmonitor_connector_enable | Implements hook_enable(). |
drupalmonitor_connector_schema | Implements hook_schema(). |
drupalmonitor_connector_uninstall | Implements hook_uninstall(). |
drupalmonitor_connector_update_7100 | Reload the menus so the two menu items will work again. |