mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 17:05:33 +02:00
BUGFIX Installer now checks temporary directory is writable, in addition to it being available.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@113962 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0e1f485dc1
commit
9d39d17859
34
install.php
34
install.php
@ -338,7 +338,7 @@ class InstallRequirements {
|
||||
$this->requireWriteable('mysite/_config.php', array("File permissions", "Is the mysite/_config.php file writeable?", null));
|
||||
$this->requireWriteable('assets', array("File permissions", "Is the assets/ folder writeable?", null));
|
||||
|
||||
$this->requireTempFolder(array('File permissions', 'Is the temporary directory writeable?', null));
|
||||
$this->requireTempFolder(array('File permissions', 'Is the temporary directory writeable?', null, $this->getTempFolder()));
|
||||
|
||||
$this->isRunningWebServer(array("Webserver Configuration", "Server software", "Unknown", $webserver));
|
||||
|
||||
@ -613,38 +613,50 @@ class InstallRequirements {
|
||||
}
|
||||
}
|
||||
|
||||
function requireTempFolder($testDetails) {
|
||||
$this->testing($testDetails);
|
||||
|
||||
if(function_exists('sys_get_temp_dir')) {
|
||||
function getTempFolder() {
|
||||
if(file_exists($this->getBaseDir() . 'silverstripe-cache')) {
|
||||
$sysTmp = $this->getBaseDir();
|
||||
} elseif(function_exists('sys_get_temp_dir')) {
|
||||
$sysTmp = sys_get_temp_dir();
|
||||
} elseif(isset($_ENV['TMP'])) {
|
||||
$sysTmp = $_ENV['TMP'];
|
||||
} else {
|
||||
@$tmpFile = tempnam('adfadsfdas','');
|
||||
@$tmpFile = tempnam('adfadsfdas', '');
|
||||
@unlink($tmpFile);
|
||||
$sysTmp = dirname($tmpFile);
|
||||
}
|
||||
|
||||
$worked = true;
|
||||
$ssTmp = "$sysTmp/silverstripe-cache";
|
||||
$ssTmp = $sysTmp . DIRECTORY_SEPARATOR . 'silverstripe-cache';
|
||||
|
||||
if(!@file_exists($ssTmp)) {
|
||||
@$worked = mkdir($ssTmp);
|
||||
|
||||
if(!$worked) {
|
||||
$ssTmp = dirname($_SERVER['SCRIPT_FILENAME']) . "/silverstripe-cache";
|
||||
$ssTmp = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . 'silverstripe-cache';
|
||||
$worked = true;
|
||||
if(!@file_exists($ssTmp)) {
|
||||
@$worked = mkdir($ssTmp);
|
||||
}
|
||||
if(!$worked) {
|
||||
}
|
||||
}
|
||||
|
||||
if($worked) return $ssTmp;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function requireTempFolder($testDetails) {
|
||||
$this->testing($testDetails);
|
||||
|
||||
$tempFolder = $this->getTempFolder();
|
||||
if(!$tempFolder) {
|
||||
$testDetails[2] = "Permission problem gaining access to a temp directory. " .
|
||||
"Please create a folder named silverstripe-cache in the base directory " .
|
||||
"of the installation and ensure it has the adequate permissions";
|
||||
$this->error($testDetails);
|
||||
}
|
||||
}
|
||||
} elseif(!is_writable($tempFolder)) {
|
||||
$testDetails[2] = "$tempFolder is not writable by the webserver. Please ensure appropriate permissions have been set";
|
||||
$this->error($testDetails);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user