From 7fe5312d099d3293d3d185004febf123eec8131d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 2 Jun 2013 20:28:10 +0200 Subject: [PATCH] Ignoring chmod() errors --- wcfsetup/install.php | 6 +++--- wcfsetup/install/files/lib/util/FileUtil.class.php | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 18a96940d3..eb2f14e40a 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -336,14 +336,14 @@ class BasicFileUtil { $startIndex = 0; if (is_dir($filename)) { if (self::$mode == 0644) { - chmod($filename, 0755); + @chmod($filename, 0755); } else { - chmod($filename, 0777); + @chmod($filename, 0777); } } else { - chmod($filename, self::$mode); + @chmod($filename, self::$mode); } if (!is_writable($filename)) { diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index c661f79c11..c4f7de9012 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -504,21 +504,21 @@ final class FileUtil { } else { self::$mode = '0666'; - + $tmpFilename = '__permissions_'.sha1(time()).'.txt'; @touch($tmpFilename); - + // create a new file and check the file owner, if it is the same // as this file (uploaded through FTP), we can safely grant write // permissions exclusively to the owner rather than everyone if (file_exists($tmpFilename)) { $scriptOwner = fileowner(INSTALL_SCRIPT); $fileOwner = fileowner($tmpFilename); - + if ($scriptOwner === $fileOwner) { self::$mode = '0644'; } - + @unlink($tmpFilename); } } @@ -535,14 +535,14 @@ final class FileUtil { if (is_dir($filename)) { if (self::$mode == '0644') { - chmod($filename, 0755); + @chmod($filename, 0755); } else { - chmod($filename, 0777); + @chmod($filename, 0777); } } else { - chmod($filename, octdec(self::$mode)); + @chmod($filename, octdec(self::$mode)); } if (!is_writable($filename)) { -- 2.20.1