Don't write the config file when --skip-config flag is given to the installer.
* scripts/installer_cli.php: Read the arguments list before checking if the config file is writeable.
This commit is contained in:
parent
50f9f23ff1
commit
fdd3d63098
@ -85,7 +85,7 @@ abstract class Installer
|
|||||||
$pass = true;
|
$pass = true;
|
||||||
|
|
||||||
$config = INSTALLDIR.'/config.php';
|
$config = INSTALLDIR.'/config.php';
|
||||||
if (file_exists($config)) {
|
if (!$this->skipConfig && file_exists($config)) {
|
||||||
if (!is_writable($config) || filesize($config) > 0) {
|
if (!is_writable($config) || filesize($config) > 0) {
|
||||||
if (filesize($config) == 0) {
|
if (filesize($config) == 0) {
|
||||||
$this->warning('Config file "config.php" already exists and is empty, but is not writable.');
|
$this->warning('Config file "config.php" already exists and is empty, but is not writable.');
|
||||||
@ -126,14 +126,16 @@ abstract class Installer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @fixme this check seems to be insufficient with Windows ACLs
|
// @fixme this check seems to be insufficient with Windows ACLs
|
||||||
if (!is_writable(INSTALLDIR)) {
|
if (!$this->skipConfig && !is_writable(INSTALLDIR)) {
|
||||||
$this->warning(sprintf('Cannot write config file to: <code>%s</code></p>', INSTALLDIR),
|
$this->warning(sprintf('Cannot write config file to: <code>%s</code></p>', INSTALLDIR),
|
||||||
sprintf('On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR));
|
sprintf('On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR));
|
||||||
$pass = false;
|
$pass = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the subdirs used for file uploads
|
// Check the subdirs used for file uploads
|
||||||
$fileSubdirs = array('avatar', 'file');
|
// TODO get another flag for this --skipFileSubdirCreation
|
||||||
|
if (!$this->skipConfig) {
|
||||||
|
$fileSubdirs = array($this->avatarDir, $this->fileDir);
|
||||||
foreach ($fileSubdirs as $fileSubdir) {
|
foreach ($fileSubdirs as $fileSubdir) {
|
||||||
$fileFullPath = INSTALLDIR."/$fileSubdir";
|
$fileFullPath = INSTALLDIR."/$fileSubdir";
|
||||||
if (!file_exists($fileFullPath)) {
|
if (!file_exists($fileFullPath)) {
|
||||||
@ -148,7 +150,7 @@ abstract class Installer
|
|||||||
$pass = false;
|
$pass = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $pass;
|
return $pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,10 +582,10 @@ abstract class Installer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->skipConfig) {
|
||||||
// Make sure we can write to the file twice
|
// Make sure we can write to the file twice
|
||||||
$oldUmask = umask(000);
|
$oldUmask = umask(000);
|
||||||
|
|
||||||
if (!$this->skipConfig) {
|
|
||||||
$this->updateStatus("Writing config file...");
|
$this->updateStatus("Writing config file...");
|
||||||
$res = $this->writeConf();
|
$res = $this->writeConf();
|
||||||
|
|
||||||
@ -616,12 +618,12 @@ abstract class Installer
|
|||||||
$this->updateStatus("Can't write to config file.", true);
|
$this->updateStatus("Can't write to config file.", true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Restore original umask
|
// Restore original umask
|
||||||
umask($oldUmask);
|
umask($oldUmask);
|
||||||
// Set permissions back to something decent
|
// Set permissions back to something decent
|
||||||
chmod(INSTALLDIR.'/config.php', 0644);
|
chmod(INSTALLDIR.'/config.php', 0644);
|
||||||
|
}
|
||||||
|
|
||||||
$scheme = $this->ssl === 'always' ? 'https' : 'http';
|
$scheme = $this->ssl === 'always' ? 'https' : 'http';
|
||||||
$link = "{$scheme}://{$this->server}/{$this->path}";
|
$link = "{$scheme}://{$this->server}/{$this->path}";
|
||||||
|
@ -47,10 +47,10 @@ class CliInstaller extends Installer
|
|||||||
*/
|
*/
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
|
if ($this->prepare()) {
|
||||||
if (!$this->checkPrereqs()) {
|
if (!$this->checkPrereqs()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->prepare()) {
|
|
||||||
return $this->handle();
|
return $this->handle();
|
||||||
} else {
|
} else {
|
||||||
$this->showHelp();
|
$this->showHelp();
|
||||||
|
Loading…
Reference in New Issue
Block a user