function _acquia_spi_security_review_check_file_perms_scan in Acquia Connector 7.2
Same name and namespace in other branches
- 6.2 acquia_spi/security_review.inc \_acquia_spi_security_review_check_file_perms_scan()
- 7.3 acquia_spi/security_review.inc \_acquia_spi_security_review_check_file_perms_scan()
1 call to _acquia_spi_security_review_check_file_perms_scan()
- acquia_spi_security_review_check_file_perms in acquia_spi/
security_review.inc - Check that files aren't writeable by the server.
File
- acquia_spi/
security_review.inc, line 222 - Stand-alone security checks and review system.
Code
function _acquia_spi_security_review_check_file_perms_scan($directory, $ignore) {
$items = array();
if ($handle = opendir($directory)) {
while (($file = readdir($handle)) !== FALSE) {
// Don't check hidden files or ones we said to ignore.
if ($file[0] != "." && !in_array($file, $ignore)) {
$file = $directory . "/" . $file;
if (is_dir($file) && !in_array($file, $ignore)) {
$items = array_merge($items, _acquia_spi_security_review_check_file_perms_scan($file, $ignore));
if (is_writable($file)) {
$items[] = preg_replace("/\\/\\//si", "/", $file);
}
}
elseif (is_writable($file) && !in_array($file, $ignore)) {
$items[] = preg_replace("/\\/\\//si", "/", $file);
}
}
}
closedir($handle);
}
return $items;
}