Commit eeac94c9 authored by kbahey's avatar kbahey

#349797 Move persistent dsm() to hook_requirements, where they belong

parent e941cbdd
......@@ -82,3 +82,54 @@ function performance_uninstall() {
db_query("DROP TABLE {performance_summary}");
db_query("DELETE FROM {variable} WHERE name LIKE 'performance%'");
}
function performance_requirements($phase) {
$requirements = array();
if ($phase != 'runtime') {
return $requirements;
}
if (variable_get('performance_detail', 0)) {
$requirements['performance_detail'] = array(
'title' => t('Performance logging details'),
'value' => 'Enabled',
'severity' => REQUIREMENT_ERROR,
'description' => t('Performance detailed logging is !link. This can cause severe issues on live sites.', array('!link' => l(t('enabled'), 'admin/settings/performance_logging'))),
);
}
if (variable_get('dev_query', 0)) {
if (variable_get('performance_detail', 0) ||
variable_get('performance_summary_db', 0) ||
variable_get('performance_summary_apc', 0)) {
$requirements['performance_query'] = array(
'title' => t('Performance logging query'),
'value' => 'Enabled',
'severity' => REQUIREMENT_ERROR,
'description' => t('Query timing and count logging is !link. This can cause memory size per page to be larger than normal.', array('!link' => l(t('enabled'), 'admin/settings/performance_logging'))),
);
}
}
if (!function_exists('apc_fetch')) {
$requirements['performance_apc'] = array(
'title' => t('Performance logging APC'),
'value' => 'Disabled',
'severity' => REQUIREMENT_WARNING,
'description' => t('Performance logging on live web sites works best if APC is enabled.'),
);
}
$shm_size = ini_get('apc.shm_size');
if ($shm_size < 48) {
$requirements['performance_apc_mem'] = array(
'title' => t('Performance logging APC memory size'),
'value' => $shm_size,
'severity' => REQUIREMENT_ERROR,
'description' => t('APC has been configured for !size, which is less than the recommended 48 MB of memory. If you encounter errors when viewing the summary report, then try to increase that limit for APC.', array('!size' => $shm_size)),
);
}
return $requirements;
}
......@@ -142,31 +142,6 @@ function performance_init() {
// we register a function that runs as late as possible.
register_shutdown_function('performance_shutdown');
}
global $user;
// Give a message on all admin pages, so they are warned.
if ( $user->uid && arg(0) == 'admin') {
if (variable_get('performance_detail', 0)) {
drupal_set_message(t('Performance detailed logging is !link. This can cause severe issues on live sites.', array('!link' => l(t('enabled'), 'admin/settings/performance_logging'))), 'error');
}
if (variable_get('dev_query', 0)) {
if (variable_get('performance_detail', 0) ||
variable_get('performance_summary_db', 0) ||
variable_get('performance_summary_apc', 0)) {
drupal_set_message(t('Query timing and count logging is !link. This can cause memory size per page to be larger than normal.', array('!link' => l(t('enabled'), 'admin/settings/performance_logging'))), 'error');
}
}
if (variable_get('performance_summary_apc', 0)) {
$shm_size = ini_get('apc.shm_size');
if ($shm_size < 48) {
drupal_set_message(t('APC has been configured for !size, which is less than the recommended 48 MB of memory. If you encounter errors when viewing the summary report, then try to increase that limit for APC.', array('!size' => $shm_size)), 'warning');
}
}
}
}
function performance_exit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment