From 7ab2c814f89dfcf4920bb7e5b8820ffc93919361 Mon Sep 17 00:00:00 2001 From: wdlee91 Date: Sat, 27 Sep 2008 06:12:42 +0000 Subject: [PATCH] Skip a directory when validator cannot access the directory. git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4571 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- tools/validator/validator.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tools/validator/validator.php b/tools/validator/validator.php index 64463b10c..6d9995b4d 100644 --- a/tools/validator/validator.php +++ b/tools/validator/validator.php @@ -83,18 +83,20 @@ if(substr($base_path,-1)=='/') $base_path = substr($base_path,0,-1); if(in_array($path, $avoid_path)) return; - $oDir = dir($path); - while($item = $oDir->read()) { - if(substr($item,0,1)=='.' && $item != '.htaccess' ) continue; - $new_path = $path.'/'.$item; - if(!is_dir($new_path)) { - $filesize = filesize($new_path); - $filename = substr($new_path, strlen($base_path)+1); - $buff[$filename] = $filesize; - } else { - getFiles($new_path, $base_path, $avoid_path, $buff); + $oDir = @dir($path); + if($oDir) { + while($item = $oDir->read()) { + if(substr($item,0,1)=='.' && $item != '.htaccess' ) continue; + $new_path = $path.'/'.$item; + if(!is_dir($new_path)) { + $filesize = filesize($new_path); + $filename = substr($new_path, strlen($base_path)+1); + $buff[$filename] = $filesize; + } else { + getFiles($new_path, $base_path, $avoid_path, $buff); + } } + $oDir->close(); } - $oDir->close(); } ?>