mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 17:05:33 +02:00
BUGFIX Fixed unlink of mysite/_config.php and truncate it instead - when re-creating the file it may not get write permissions on Windows (from r98783)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@112098 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3c8aba8ed4
commit
7cec02c3f3
23
install.php
23
install.php
@ -928,14 +928,17 @@ class Installer extends InstallRequirements {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists('mysite/_config.php')) {
|
if(file_exists('mysite/_config.php')) {
|
||||||
unlink('mysite/_config.php');
|
// Truncate the contents of _config instead of deleting it - we can't re-create it because Windows handles permissions slightly
|
||||||
|
// differently to UNIX based filesystems - it takes the permissions from the parent directory instead of retaining them
|
||||||
|
$fh = fopen('mysite/_config.php', 'wb');
|
||||||
|
fclose($fh);
|
||||||
}
|
}
|
||||||
$theme = isset($_POST['template']) ? $_POST['template'] : 'blackcandy';
|
$theme = isset($_POST['template']) ? $_POST['template'] : 'blackcandy';
|
||||||
// Write the config file
|
// Write the config file
|
||||||
global $usingEnv;
|
global $usingEnv;
|
||||||
if($usingEnv) {
|
if($usingEnv) {
|
||||||
$this->statusMessage("Creating 'mysite/_config.php' for use with _ss_environment.php...");
|
$this->statusMessage("Setting up 'mysite/_config.php' for use with _ss_environment.php...");
|
||||||
$this->createFile("mysite/_config.php", <<<PHP
|
$this->writeToFile("mysite/_config.php", <<<PHP
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
global \$project;
|
global \$project;
|
||||||
@ -960,12 +963,12 @@ PHP
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->statusMessage("Creating 'mysite/_config.php'...");
|
$this->statusMessage("Setting up 'mysite/_config.php'...");
|
||||||
|
|
||||||
$devServers = $this->var_export_array_nokeys(explode("\n", $_POST['devsites']));
|
$devServers = $this->var_export_array_nokeys(explode("\n", $_POST['devsites']));
|
||||||
|
|
||||||
$escapedPassword = addslashes($config['db']['password']);
|
$escapedPassword = addslashes($config['db']['password']);
|
||||||
$this->createFile("mysite/_config.php", <<<PHP
|
$this->writeToFile("mysite/_config.php", <<<PHP
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
global \$project;
|
global \$project;
|
||||||
@ -997,7 +1000,7 @@ PHP
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->statusMessage("Creating '.htaccess' file...");
|
$this->statusMessage("Setting up '.htaccess' file...");
|
||||||
|
|
||||||
$this->createHtaccess();
|
$this->createHtaccess();
|
||||||
|
|
||||||
@ -1089,9 +1092,9 @@ PHP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFile($filename, $content) {
|
function writeToFile($filename, $content) {
|
||||||
$base = $this->getBaseDir();
|
$base = $this->getBaseDir();
|
||||||
$this->statusMessage("Creating $base$filename");
|
$this->statusMessage("Setting up $base$filename");
|
||||||
|
|
||||||
if((@$fh = fopen($base . $filename, 'wb')) && fwrite($fh, $content) && fclose($fh)) {
|
if((@$fh = fopen($base . $filename, 'wb')) && fwrite($fh, $content) && fclose($fh)) {
|
||||||
return true;
|
return true;
|
||||||
@ -1140,7 +1143,7 @@ TEXT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->createFile('.htaccess', $start . $rewrite . $end);
|
$this->writeToFile('.htaccess', $start . $rewrite . $end);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreHtaccess() {
|
function restoreHtaccess() {
|
||||||
@ -1160,7 +1163,7 @@ TEXT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->createFile('.htaccess', $start . $end);
|
$this->writeToFile('.htaccess', $start . $end);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkModRewrite() {
|
function checkModRewrite() {
|
||||||
|
Loading…
Reference in New Issue
Block a user