From 2db0f954c1735e131f4519039b01a0c75c965381 Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 2 Apr 2008 19:35:14 +0000 Subject: [PATCH] "Fixes #4414, Folder::!__tree() causing warnings when apache user has no read access to a folder" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6624 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/folder.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cake/libs/folder.php b/cake/libs/folder.php index 82f3b4e6a..7d10ac4b3 100644 --- a/cake/libs/folder.php +++ b/cake/libs/folder.php @@ -148,8 +148,8 @@ class Folder extends Object{ */ function read($sort = true, $exceptions = false) { $dirs = $files = array(); - $dir = opendir($this->path); - if ($dir !== false) { + + if ($dir = @opendir($this->path)) { while (false !== ($n = readdir($dir))) { $item = false; if (is_array($exceptions)) { @@ -433,9 +433,7 @@ class Folder extends Object{ * @access private */ function __tree($path, $hidden) { - if (is_dir($path)) { - $dirHandle = @opendir($path); - + if (is_dir($path) && $dirHandle = @opendir($path)) { while (false !== ($item = @readdir($dirHandle))) { $found = false; @@ -548,7 +546,7 @@ class Folder extends Object{ continue; } if (is_file($file) === true) { - if (unlink($file)) { + if (@unlink($file)) { $this->__messages[] = sprintf(__('%s removed', true), $path); } else { $this->__errors[] = sprintf(__('%s NOT removed', true), $path); @@ -604,8 +602,8 @@ class Folder extends Object{ } $exceptions = array_merge(array('.','..','.svn'), $options['skip']); - $handle = opendir($fromDir); - if ($handle) { + + if ($handle = @opendir($fromDir)) { while (false !== ($item = readdir($handle))) { if (!in_array($item, $exceptions)) { $from = $this->addPathElement($fromDir, $item);