View source
<?php
define('DRUPALMONITOR_VERSION', '7.x-1.13');
function drupalmonitor_connector_menu() {
$items['drupalmonitor'] = array(
'title' => 'Drupalmonitor connector',
'page callback' => 'drupalmonitor_connector_page_data',
'access arguments' => array(
'access drupalmonitor api',
),
'type' => MENU_CALLBACK,
'description' => 'Output drupalmonitor metrics',
'file' => 'drupalmonitor_connector.pages.inc',
);
$items['admin/config/system/drupalmonitor'] = array(
'title' => 'Drupalmonitor.com',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'drupalmonitor_connector_settings_form',
),
'access arguments' => array(
'administer drupalmonitor',
),
'description' => 'Manage settings for Drupalmonitor connector module. (Security hash, Logging)',
'file' => 'drupalmonitor_connector.admin.inc',
);
return $items;
}
function drupalmonitor_connector_permission() {
return array(
'administer drupalmonitor' => array(
'title' => t('View Drupalmonitor settings page'),
'description' => t('Allow user to change settings on the Drupalmonitor settings page.'),
),
'access drupalmonitor api' => array(
'title' => t('Access the Drupalmonitor API'),
'description' => t('Allow Drupalmonitor.com crawler to access /drupalmonitor.'),
),
);
}
function drupalmonitor_connector_boot() {
register_shutdown_function('drupalmonitor_connector_shutdow');
}
function drupalmonitor_connector_shutdow() {
if (variable_get('drupalmonitor_performance_monitoring', 1) == 1) {
db_insert('drupalmonitor_log')
->fields(array(
'q' => $_GET['q'],
'memory' => memory_get_peak_usage(),
'dt' => REQUEST_TIME,
'execution_time' => timer_read('page'),
))
->execute();
}
}