From 728b9dd656b6da1e541d8f64cff3a15aa5ce9f7d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 2 Jun 2013 19:40:33 +0200 Subject: [PATCH] Fixed file reference for owner check during WCFSetup --- wcfsetup/install.php | 3 ++- wcfsetup/install/files/lib/util/FileUtil.class.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 21a79c6e35..18a96940d3 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -3,10 +3,11 @@ * This script tries to find the temp folder and unzip all setup files into. * * @author Marcel Werk - * @copyright 2001-2011 WoltLab GmbH + * @copyright 2001-2013 WoltLab GmbH * @license GNU Lesser General Public License */ // define constants +define('INSTALL_SCRIPT', __FILE__); define('INSTALL_SCRIPT_DIR', dirname(__FILE__).'/'); define('SETUP_FILE', INSTALL_SCRIPT_DIR . 'WCFSetup.tar.gz'); define('NO_IMPORTS', 1); diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index 084990f3b6..5761c18167 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -497,7 +497,7 @@ final class FileUtil { if (self::$mode === null) { // WCFSetup - if (defined('NO_IMPORTS')) { + if (defined('INSTALL_SCRIPT')) { // do not use PHP_OS here, as this represents the system it was built on != running on if (strpos(php_uname(), 'Windows') !== false) { self::$mode = '0777'; @@ -512,7 +512,7 @@ final class FileUtil { // 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(__FILE__); + $scriptOwner = fileowner(INSTALL_SCRIPT); $fileOwner = fileowner($tmpFilename); if ($scriptOwner === $fileOwner) { @@ -525,7 +525,7 @@ final class FileUtil { } else { // mirror permissions of WCF.class.php - if (!file_exists(WCF_DIR . 'lib/system/WCF.class.php')) { + if (!file_exists()) { throw new SystemException("Unable to find 'wcf/lib/system/WCF.class.php'."); } -- 2.20.1