function security_review_check_temporary_files in Security Review 7
Check for sensitive temporary files like settings.php~.
1 string reference to 'security_review_check_temporary_files'
- _security_review_security_checks in ./
security_review.inc - Core Security Review's checks.
File
- ./
security_review.inc, line 714 - Stand-alone security checks and review system.
Code
function security_review_check_temporary_files($last_check = NULL) {
$result = TRUE;
$check_result_value = array();
$files = array();
$dir = scandir(DRUPAL_ROOT . '/' . conf_path() . '/');
foreach ($dir as $file) {
// Set full path to only files.
if (!is_dir($file)) {
$files[] = DRUPAL_ROOT . '/' . conf_path() . '/' . $file;
}
}
drupal_alter('security_review_temporary_files', $files);
foreach ($files as $path) {
$matches = array();
if (file_exists($path) && preg_match('/.*(~|\\.sw[op]|\\.bak|\\.orig|\\.save)$/', $path, $matches) !== FALSE && !empty($matches)) {
$result = FALSE;
$check_result_value[] = $path;
}
}
return array(
'result' => $result,
'value' => $check_result_value,
);
}