function _cdn_requirements_generate_requirement_for_patch in CDN 6.2
Generates a requirement for the given patch.
1 call to _cdn_requirements_generate_requirement_for_patch()
- cdn_requirements in ./
cdn.install - Implementation of hook_requirements().
File
- ./
cdn.requirements.inc, line 12 - Functionality to automatically detect if a patch has been applied.
Code
function _cdn_requirements_generate_requirement_for_patch(&$requirements, $patch_name, $title, $not_properly_applied_severity = REQUIREMENT_ERROR) {
$t = get_t();
$patterns_function = '_cdn_requirements_' . $patch_name . '_patch_patterns';
$patterns = $patterns_function();
// No patterns means the patch file could not be found.
if ($patterns !== FALSE) {
$unpatched_files = _cdn_requirements_check_patch_applied($patterns);
}
$key = 'cdn_' . $patch_name . '_patch';
$requirements[$key]['title'] = $title;
if ($patterns === FALSE) {
$requirements[$key] += array(
'description' => $t('This patch file has been moved or deleted by the administrator. Please restore it, so we can verify that the patch has been properly applied.'),
'severity' => REQUIREMENT_ERROR,
'value' => $t('Unable to check'),
);
}
elseif (count($unpatched_files) == 0) {
$requirements[$key] += array(
'severity' => REQUIREMENT_OK,
'value' => $t('Applied'),
);
}
else {
$requirements[$key] += array(
'description' => $t('This patch has not been properly applied to the following files (or the patch has been updated):') . '<br />' . theme('item_list', $unpatched_files) . '<br />' . t('Please consult the installation instructions in the included README.txt.'),
'severity' => $not_properly_applied_severity,
'value' => $t('Not/incompletely applied patch or updated patch.'),
);
}
}