Added open_basedir workaround to installer

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@40498 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
aoneil 2007-08-20 03:42:48 +00:00
parent 1e5fbb9247
commit 014bd34998
1 changed files with 38 additions and 4 deletions

View File

@ -114,9 +114,7 @@ class InstallRequirements {
$this->requireWriteable('tutorial', array("File permissions", "Is the tutorial/ folder writeable?", null));
$this->requireWriteable('assets', array("File permissions", "Is the assets/ folder writeable?", null));
if(!is_writeable(dirname(tempnam('adfadsfdas','')))) {
$this->error(array("File permissions", "Is the temporary folder writeable?", "The temporary folder isn't writeable!"));
}
$this->requireTempFolder(array('File permissions', 'Is the temporary folder writeable?', null));
// Check for rewriting
@ -315,7 +313,43 @@ class InstallRequirements {
$testDetails[2] .= "User '$user[name]' needs to write be able to write to this file:\n$filename";
$this->error($testDetails);
}
}
}
function requireTempFolder($testDetails) {
$this->testing($testDetails);
if(function_exists('sys_get_temp_dir')) {
$sysTmp = sys_get_temp_dir();
} elseif(isset($_ENV['TMP'])) {
$sysTmp = $_ENV['TMP'];
} else {
$tmpFile = tempnam('adfadsfdas','');
unlink($tmpFile);
$sysTmp = dirname($tmpFile);
}
$worked = true;
$ssTmp = "$sysTmp/silverstripe-cache";
if(!@file_exists($ssTmp)) {
@$worked = mkdir($ssTmp);
if(!$worked) {
$ssTmp = dirname($_SERVER['SCRIPT_FILENAME']) . "/silverstripe-cache";
$worked = true;
if(!@file_exists($ssTmp)) {
@$worked = mkdir($ssTmp);
}
if(!$worked) {
$testDetails[2] = "Permission problem gaining access to a temp folder. " .
"Please create a folder named silverstripe-cache in the base folder " .
"of the installation and ensure it has the adequate permissions";
$this->error($testDetails);
}
}
}
}
function requireApacheModule($moduleName, $testDetails) {
$this->testing($testDetails);
if(!in_array($moduleName, apache_get_modules())) $this->error($testDetails);