Created
December 4, 2014 06:01
-
-
Save niksmac/6a62b543de366429557f to your computer and use it in GitHub Desktop.
Automatically Securing file permissions and ownership for Drupal 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function SetPerms($dir = ".") { | |
$listDir = array(); | |
if($handler = opendir($dir)) { | |
while (($sub = readdir($handler)) !== FALSE) { | |
if ($sub != "." && $sub != "..") { | |
if(is_file($dir."/".$sub)) { | |
echo "File: $dir/$sub\n"; | |
chmod($dir."/".$sub, 0644); | |
} else if(is_dir($dir."/".$sub)){ | |
echo "Dir: $dir/$sub :\n"; | |
chmod($dir."/".$sub, 0711); | |
SetPerms($dir."/".$sub); | |
} | |
} | |
} | |
closedir($handler); | |
} | |
return $listDir; | |
} | |
SetPerms(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Drupageddon
rm -f book-tpl.php && rm -f includes/aggregator-api-inc.php && rm -f includes/preview-api.php && rm -f misc/syslog-data.php && rm -f misc/update-info.php && rm -f modules/forum/forum-info.php && rm -f modules/locale/locale-bak.php && rm -f modules/menu/menu-module.php && rm -f modules/search/search-rtl-info.php && rm -f translation-tpl.php
http://bit.ly/1vP8mKw