From 1281ed72a6e2781e884d4681f47456cad02a4bde Mon Sep 17 00:00:00 2001 From: Max Klaversma Date: Fri, 24 Jan 2014 19:20:11 +0100 Subject: [PATCH] Now checking permissions of all files in /core and /plugins --- application/core/UpdateManager.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/application/core/UpdateManager.php b/application/core/UpdateManager.php index c30bf03a..4cf18dbf 100644 --- a/application/core/UpdateManager.php +++ b/application/core/UpdateManager.php @@ -376,15 +376,20 @@ class UpdateManager implements CallbackListener, CommandListener { private function checkPermissions() { $writableDirectories = array('core/', 'plugins/'); - $ignore = array('.', '..'); $path = str_replace('core', '', realpath(dirname(__FILE__))); foreach($writableDirectories as $writableDirecotry) { - $files = scandir($path.$writableDirecotry); + $files = array(); + $di = new \RecursiveDirectoryIterator($path.$writableDirecotry); + foreach (new \RecursiveIteratorIterator($di) as $filename => $file) { + $files[] = $filename; + } + foreach($files as $file) { - if(!in_array($file, $ignore)) { - if(!is_writable($path.$writableDirecotry.$file)) { - $this->maniaControl->log('Cannot update: the file/directory "'.$path.$writableDirecotry.$file.'" is not writable!'); + if(substr($file, -1) != '.' && substr($file, -2) != '..') { + echo $file."\n\r"; + if(!is_writable($file)) { + $this->maniaControl->log('Cannot update: the file/directory "'.$file.'" is not writable!'); return false; } }