mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 17:05:33 +02:00
Improved file can-write checking on Windows (IIS, in particular)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.3@66314 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8aa321743b
commit
292343da48
21
install.php
21
install.php
@ -20,6 +20,7 @@ foreach($envFiles as $envFile) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load database config
|
||||
if(isset($_REQUEST['mysql'])) {
|
||||
$databaseConfig = $_REQUEST['mysql'];
|
||||
@ -369,25 +370,27 @@ class InstallRequirements {
|
||||
|
||||
function requireWriteable($filename, $testDetails) {
|
||||
$this->testing($testDetails);
|
||||
$filename = $this->getBaseDir() . $filename;
|
||||
$filename = $this->getBaseDir() . str_replace("/", DIRECTORY_SEPARATOR,$filename);
|
||||
|
||||
if(function_exists('posix_getgroups')) {
|
||||
if(!is_writeable($filename)) {
|
||||
if(!is_writeable($filename)) {
|
||||
if(function_exists('posix_getgroups')) {
|
||||
$user = posix_getpwuid(posix_geteuid());
|
||||
$groups = posix_getgroups();
|
||||
foreach($groups as $group) {
|
||||
$groupInfo = posix_getgrgid($group);
|
||||
$groupList[] = $groupInfo['name'];
|
||||
}
|
||||
$groupList = "'" . implode("', '", $groupList) . "'";
|
||||
$groupList = "'" . implode("', '", $groupList) . "'"; }
|
||||
|
||||
$testDetails[2] .= "User '$user[name]' needs to be able to write to this file:\n$filename";
|
||||
$this->error($testDetails);
|
||||
}
|
||||
} else {
|
||||
$testDetails[2] .= "User '$user[name]' needs to be able to write to this file:\n$filename";
|
||||
$this->error($testDetails);
|
||||
}
|
||||
/*
|
||||
} else {
|
||||
$testDetails[2] .= "Unable to detect whether I can write to files. Please ensure $filename is writable.";
|
||||
$this->warning($testDetails);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function requireTempFolder($testDetails) {
|
||||
@ -539,7 +542,7 @@ class InstallRequirements {
|
||||
function getBaseDir() {
|
||||
// Cache the value so that when the installer mucks with SCRIPT_FILENAME half way through, this method
|
||||
// still returns the correct value.
|
||||
if(!$this->baseDir) $this->baseDir = realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . '/';
|
||||
if(!$this->baseDir) $this->baseDir = realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . DIRECTORY_SEPARATOR;
|
||||
return $this->baseDir;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user