Скрипт для рекурсивной смены прав на файлы и папки
<?
$PARENT_DIR = '/home/sites/public_html/your_site/modules/';
$FILE_MODE = 0777;
$DIR_MODE = 0777;
function chmodex($file) {
global $PARENT_DIR;
global $FILE_MODE;
global $DIR_MODE;
if ( file_exists($file) ) {
if ( is_dir($file) ) {
if ( !($file==$PARENT_DIR) ) { chmod( $file, $DIR_MODE ); }
$handle = opendir( $file );
while( $filename = readdir($handle) )
if ( $filename != "." && $filename != ".." ) chmodex( $file."/".$filename );
closedir($handle);
} else {
chmod( $file, $FILE_MODE );
}
}
return true;
}
if(chmodex($PARENT_DIR)) echo "hello";
?>
|