function performance_requirements in Performance Logging and Monitoring 7
Same name and namespace in other branches
- 6.2 performance.install \performance_requirements()
- 6 performance.install \performance_requirements()
- 7.2 performance.install \performance_requirements()
Implementation of hook_requirements().
File
- ./
performance.install, line 83 - Install and update for Performance Logging
Code
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' => t('Enabled'),
'severity' => REQUIREMENT_WARNING,
'description' => t('Performance detailed logging is !link. This can cause severe issues on live sites.', array(
'!link' => l(t('enabled'), PERFORMANCE_SETTINGS),
)),
);
}
$logging = FALSE;
foreach (performance_data_stores() as $data) {
if ($data['#enabled']) {
$logging = TRUE;
break;
}
}
if (variable_get(PERFORMANCE_QUERY_VAR, 0) && $logging) {
$requirements['performance_query'] = array(
'title' => t('Performance logging query'),
'value' => t('Enabled'),
'severity' => REQUIREMENT_WARNING,
'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'), PERFORMANCE_SETTINGS),
)),
);
}
// Since these checks are done at runtime, performance_data_stores() is
// available!
$alt_cache = FALSE;
foreach (performance_data_stores() as $store => $data) {
if ($store != 'db' && $data['#enabled']) {
$alt_cache = TRUE;
break;
}
}
if (!$alt_cache) {
$requirements['performance_apc'] = array(
'title' => t('Performance logging APC / memcache'),
'value' => t('Disabled'),
'severity' => REQUIREMENT_WARNING,
'description' => t('Performance logging on live web sites works best if APC or Memcache is enabled.'),
);
}
$shm_size = ini_get('apc.shm_size');
if (function_exists('apc_fetch') && $shm_size < PERFORMANCE_MIN_MEMORY) {
$requirements['performance_apc_mem'] = array(
'title' => t('Performance logging APC memory size'),
'value' => $shm_size,
'severity' => REQUIREMENT_WARNING,
'description' => t('APC has been configured for !size, which is less than the recommended !min_memory MB of memory. If you encounter errors when viewing the summary report, then try to increase that limit for APC.', array(
'!size' => 1 * $shm_size,
'!min_memory' => PERFORMANCE_MIN_MEMORY,
)),
);
}
return $requirements;
}