Now checking permissions of all files in /core and /plugins

This commit is contained in:
Max Klaversma 2014-01-24 19:20:11 +01:00 committed by Steffen Schröder
parent 3aa0e8d9a7
commit 1281ed72a6

View File

@ -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;
}
}